Merge pull request #17 from sharelatex/ja-dockerize-dev

Provide hosts as environment settings and add npm run start script
This commit is contained in:
James Allen 2018-01-16 17:08:30 +00:00 committed by GitHub
commit 6d44176ab5
3 changed files with 20 additions and 15 deletions

View file

@ -44,7 +44,7 @@ module.exports = RedisManager =
docLines = JSON.stringify(docLines) docLines = JSON.stringify(docLines)
if docLines.indexOf("\u0000") != -1 if docLines.indexOf("\u0000") != -1
error = new Error("null bytes found in doc lines") error = new Error("null bytes found in doc lines")
logger.error err: error, doc_id: doc_id, docLines: docLines, error.message logger.error {err: error, doc_id: doc_id, docLines: docLines}, error.message
return callback(error) return callback(error)
docHash = RedisManager._computeHash(docLines) docHash = RedisManager._computeHash(docLines)
logger.log project_id:project_id, doc_id:doc_id, version: version, hash:docHash, "putting doc in redis" logger.log project_id:project_id, doc_id:doc_id, version: version, hash:docHash, "putting doc in redis"
@ -216,13 +216,13 @@ module.exports = RedisManager =
for op in jsonOps for op in jsonOps
if op.indexOf("\u0000") != -1 if op.indexOf("\u0000") != -1
error = new Error("null bytes found in jsonOps") error = new Error("null bytes found in jsonOps")
logger.error err: error, doc_id: doc_id, jsonOps: jsonOps, error.message logger.error {err: error, doc_id: doc_id, jsonOps: jsonOps}, error.message
return callback(error) return callback(error)
newDocLines = JSON.stringify(docLines) newDocLines = JSON.stringify(docLines)
if newDocLines.indexOf("\u0000") != -1 if newDocLines.indexOf("\u0000") != -1
error = new Error("null bytes found in doc lines") error = new Error("null bytes found in doc lines")
logger.error err: error, doc_id: doc_id, newDocLines: newDocLines, error.message logger.error {err: error, doc_id: doc_id, newDocLines: newDocLines}, error.message
return callback(error) return callback(error)
newHash = RedisManager._computeHash(newDocLines) newHash = RedisManager._computeHash(newDocLines)

View file

@ -5,23 +5,24 @@ http.globalAgent.maxSockets = 300
module.exports = module.exports =
internal: internal:
documentupdater: documentupdater:
host: process.env["LISTEN_ADDRESS"] or "localhost"
port: 3003 port: 3003
apis: apis:
web: web:
url: "http://localhost:3000" url: "http://#{process.env["WEB_HOST"] or "localhost"}:3000"
user: "sharelatex" user: "sharelatex"
pass: "password" pass: "password"
trackchanges: trackchanges:
url: "http://localhost:3015" url: "http://#{process.env["TRACK_CHANGES_HOST"] or "localhost"}:3015"
project_history: project_history:
enabled: process.env.SHARELATEX_ENABLE_PROJECT_HISTORY == 'true' enabled: process.env.SHARELATEX_ENABLE_PROJECT_HISTORY == 'true'
url: "http://localhost:3054" url: "http://#{process.env["PROJECT_HISTORY_HOST"] or "localhost"}:3054"
redis: redis:
realtime: realtime:
port: "6379" port: "6379"
host:"localhost" host: process.env["REDIS_HOST"] or "localhost"
password:"" password:""
key_schema: key_schema:
pendingUpdates: ({doc_id}) -> "PendingUpdates:#{doc_id}" pendingUpdates: ({doc_id}) -> "PendingUpdates:#{doc_id}"
@ -33,7 +34,7 @@ module.exports =
# pendingUpdates: ({doc_id}) -> "PendingUpdates:{#{doc_id}}" # pendingUpdates: ({doc_id}) -> "PendingUpdates:{#{doc_id}}"
documentupdater: documentupdater:
port: "6379" port: "6379"
host: "localhost" host: process.env["REDIS_HOST"] or "localhost"
password: "" password: ""
key_schema: key_schema:
blockingKey: ({doc_id}) -> "Blocking:#{doc_id}" blockingKey: ({doc_id}) -> "Blocking:#{doc_id}"
@ -63,7 +64,7 @@ module.exports =
# projectState: ({project_id}) -> "ProjectState:{#{project_id}}" # projectState: ({project_id}) -> "ProjectState:{#{project_id}}"
history: history:
port: "6379" port: "6379"
host:"localhost" host: process.env["REDIS_HOST"] or "localhost"
password:"" password:""
key_schema: key_schema:
uncompressedHistoryOps: ({doc_id}) -> "UncompressedHistoryOps:#{doc_id}" uncompressedHistoryOps: ({doc_id}) -> "UncompressedHistoryOps:#{doc_id}"
@ -81,7 +82,7 @@ module.exports =
# docsWithHistoryOps: ({project_id}) -> "DocsWithHistoryOps:{#{project_id}}" # docsWithHistoryOps: ({project_id}) -> "DocsWithHistoryOps:{#{project_id}}"
lock: lock:
port: "6379" port: "6379"
host:"localhost" host: process.env["REDIS_HOST"] or "localhost"
password:"" password:""
key_schema: key_schema:
blockingKey: ({doc_id}) -> "Blocking:#{doc_id}" blockingKey: ({doc_id}) -> "Blocking:#{doc_id}"
@ -95,4 +96,4 @@ module.exports =
max_doc_length: 2 * 1024 * 1024 # 2mb max_doc_length: 2 * 1024 * 1024 # 2mb
mongo: mongo:
url: 'mongodb://127.0.0.1/sharelatex' url: "mongodb://#{process.env["MONGO_HOST"] or "localhost"}/sharelatex"

View file

@ -6,9 +6,13 @@
"type": "git", "type": "git",
"url": "https://github.com/sharelatex/document-updater-sharelatex.git" "url": "https://github.com/sharelatex/document-updater-sharelatex.git"
}, },
"scripts": {
"compile:app": "coffee -o app/js -c app/coffee && coffee -c app.coffee",
"start": "npm run compile:app && node app.js"
},
"dependencies": { "dependencies": {
"async": "^2.5.0", "async": "^2.5.0",
"coffee-script": "1.4.0", "coffee-script": "~1.7.0",
"express": "3.3.4", "express": "3.3.4",
"logger-sharelatex": "git+https://github.com/sharelatex/logger-sharelatex.git#v1.5.6", "logger-sharelatex": "git+https://github.com/sharelatex/logger-sharelatex.git#v1.5.6",
"lynx": "0.0.11", "lynx": "0.0.11",