mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-27 19:02:46 +00:00
Merge pull request #125 from overleaf/sk-upgrade-dependencies
Upgrade dependencies
This commit is contained in:
commit
853dbd8880
13 changed files with 1445 additions and 689 deletions
|
@ -1,7 +1,6 @@
|
|||
# This file was auto-generated, do not edit it directly.
|
||||
# Instead run bin/update_build_scripts from
|
||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||
# Version: 1.3.5
|
||||
|
||||
FROM node:10.19.0 as base
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# This file was auto-generated, do not edit it directly.
|
||||
# Instead run bin/update_build_scripts from
|
||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||
# Version: 1.3.5
|
||||
|
||||
BUILD_NUMBER ?= local
|
||||
BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
|
||||
|
|
|
@ -21,15 +21,14 @@ mongojs = require "./app/js/mongojs"
|
|||
async = require "async"
|
||||
|
||||
Path = require "path"
|
||||
bodyParser = require "body-parser"
|
||||
|
||||
Metrics.mongodb.monitor(Path.resolve(__dirname + "/node_modules/mongojs/node_modules/mongodb"), logger)
|
||||
Metrics.event_loop.monitor(logger, 100)
|
||||
|
||||
app = express()
|
||||
app.configure ->
|
||||
app.use(Metrics.http.monitor(logger));
|
||||
app.use express.bodyParser({limit: (Settings.max_doc_length + 64 * 1024)})
|
||||
app.use app.router
|
||||
app.use(Metrics.http.monitor(logger));
|
||||
app.use bodyParser.json({limit: (Settings.max_doc_length + 64 * 1024)})
|
||||
Metrics.injectMetricsRoute(app)
|
||||
|
||||
DispatchManager.createAndStartDispatchers(Settings.dispatcherCount || 10)
|
||||
|
@ -62,20 +61,20 @@ app.post '/project/:project_id/history/resync', HttpCont
|
|||
app.post '/project/:project_id/flush', HttpController.flushProject
|
||||
app.post '/project/:project_id/doc/:doc_id/change/:change_id/accept', HttpController.acceptChanges
|
||||
app.post '/project/:project_id/doc/:doc_id/change/accept', HttpController.acceptChanges
|
||||
app.del '/project/:project_id/doc/:doc_id/comment/:comment_id', HttpController.deleteComment
|
||||
app.delete '/project/:project_id/doc/:doc_id/comment/:comment_id', HttpController.deleteComment
|
||||
|
||||
app.get '/flush_all_projects', HttpController.flushAllProjects
|
||||
app.get '/flush_queued_projects', HttpController.flushQueuedProjects
|
||||
|
||||
app.get '/total', (req, res)->
|
||||
timer = new Metrics.Timer("http.allDocList")
|
||||
timer = new Metrics.Timer("http.allDocList")
|
||||
RedisManager.getCountOfDocsInMemory (err, count)->
|
||||
timer.done()
|
||||
res.send {total:count}
|
||||
|
||||
|
||||
app.get '/status', (req, res)->
|
||||
if Settings.shuttingDown
|
||||
res.send 503 # Service unavailable
|
||||
res.sendStatus 503 # Service unavailable
|
||||
else
|
||||
res.send('document updater is alive')
|
||||
|
||||
|
@ -84,22 +83,22 @@ app.get "/health_check/redis", (req, res, next) ->
|
|||
pubsubClient.healthCheck (error) ->
|
||||
if error?
|
||||
logger.err {err: error}, "failed redis health check"
|
||||
res.send 500
|
||||
res.sendStatus 500
|
||||
else
|
||||
res.send 200
|
||||
|
||||
res.sendStatus 200
|
||||
|
||||
docUpdaterRedisClient = require("redis-sharelatex").createClient(Settings.redis.documentupdater)
|
||||
app.get "/health_check/redis_cluster", (req, res, next) ->
|
||||
docUpdaterRedisClient.healthCheck (error) ->
|
||||
if error?
|
||||
logger.err {err: error}, "failed redis cluster health check"
|
||||
res.send 500
|
||||
res.sendStatus 500
|
||||
else
|
||||
res.send 200
|
||||
res.sendStatus 200
|
||||
|
||||
app.get "/health_check", (req, res, next) ->
|
||||
async.series [
|
||||
(cb) ->
|
||||
(cb) ->
|
||||
pubsubClient.healthCheck (error) ->
|
||||
if error?
|
||||
logger.err {err: error}, "failed redis health check"
|
||||
|
@ -116,20 +115,20 @@ app.get "/health_check", (req, res, next) ->
|
|||
cb(error)
|
||||
] , (error) ->
|
||||
if error?
|
||||
res.send 500
|
||||
res.sendStatus 500
|
||||
else
|
||||
res.send 200
|
||||
res.sendStatus 200
|
||||
|
||||
app.use (error, req, res, next) ->
|
||||
if error instanceof Errors.NotFoundError
|
||||
res.send 404
|
||||
res.sendStatus 404
|
||||
else if error instanceof Errors.OpRangeNotAvailableError
|
||||
res.send 422 # Unprocessable Entity
|
||||
res.sendStatus 422 # Unprocessable Entity
|
||||
else if error.statusCode is 413
|
||||
res.send(413, "request entity too large")
|
||||
res.status(413).send("request entity too large")
|
||||
else
|
||||
logger.error err: error, req: req, "request errored"
|
||||
res.send(500, "Oops, something went wrong")
|
||||
res.status(500).send("Oops, something went wrong")
|
||||
|
||||
shutdownCleanly = (signal) ->
|
||||
return () ->
|
||||
|
|
|
@ -57,7 +57,7 @@ module.exports = HttpController =
|
|||
ProjectManager.getProjectDocsAndFlushIfOld project_id, projectStateHash, excludeVersions, (error, result) ->
|
||||
timer.done()
|
||||
if error instanceof Errors.ProjectStateChangedError
|
||||
res.send 409 # conflict
|
||||
res.sendStatus 409 # conflict
|
||||
else if error?
|
||||
return next(error)
|
||||
else
|
||||
|
@ -73,7 +73,7 @@ module.exports = HttpController =
|
|||
if error?
|
||||
return next(error)
|
||||
else
|
||||
res.send 200
|
||||
res.sendStatus 200
|
||||
|
||||
setDoc: (req, res, next = (error) ->) ->
|
||||
doc_id = req.params.doc_id
|
||||
|
@ -82,14 +82,14 @@ module.exports = HttpController =
|
|||
lineSize = HttpController._getTotalSizeOfLines(lines)
|
||||
if lineSize > TWO_MEGABYTES
|
||||
logger.log {project_id, doc_id, source, lineSize, user_id}, "document too large, returning 406 response"
|
||||
return res.send 406
|
||||
return res.sendStatus 406
|
||||
logger.log {project_id, doc_id, lines, source, user_id, undoing}, "setting doc via http"
|
||||
timer = new Metrics.Timer("http.setDoc")
|
||||
DocumentManager.setDocWithLock project_id, doc_id, lines, source, user_id, undoing, (error) ->
|
||||
timer.done()
|
||||
return next(error) if error?
|
||||
logger.log project_id: project_id, doc_id: doc_id, "set doc via http"
|
||||
res.send 204 # No Content
|
||||
res.sendStatus 204 # No Content
|
||||
|
||||
|
||||
flushDocIfLoaded: (req, res, next = (error) ->) ->
|
||||
|
@ -101,7 +101,7 @@ module.exports = HttpController =
|
|||
timer.done()
|
||||
return next(error) if error?
|
||||
logger.log project_id: project_id, doc_id: doc_id, "flushed doc via http"
|
||||
res.send 204 # No Content
|
||||
res.sendStatus 204 # No Content
|
||||
|
||||
deleteDoc: (req, res, next = (error) ->) ->
|
||||
doc_id = req.params.doc_id
|
||||
|
@ -117,7 +117,7 @@ module.exports = HttpController =
|
|||
|
||||
return next(error) if error?
|
||||
logger.log project_id: project_id, doc_id: doc_id, "deleted doc via http"
|
||||
res.send 204 # No Content
|
||||
res.sendStatus 204 # No Content
|
||||
|
||||
flushProject: (req, res, next = (error) ->) ->
|
||||
project_id = req.params.project_id
|
||||
|
@ -127,7 +127,7 @@ module.exports = HttpController =
|
|||
timer.done()
|
||||
return next(error) if error?
|
||||
logger.log project_id: project_id, "flushed project via http"
|
||||
res.send 204 # No Content
|
||||
res.sendStatus 204 # No Content
|
||||
|
||||
deleteProject: (req, res, next = (error) ->) ->
|
||||
project_id = req.params.project_id
|
||||
|
@ -139,14 +139,14 @@ module.exports = HttpController =
|
|||
ProjectManager.queueFlushAndDeleteProject project_id, (error) ->
|
||||
return next(error) if error?
|
||||
logger.log project_id: project_id, "queue delete of project via http"
|
||||
res.send 204 # No Content
|
||||
res.sendStatus 204 # No Content
|
||||
else
|
||||
timer = new Metrics.Timer("http.deleteProject")
|
||||
ProjectManager.flushAndDeleteProjectWithLocks project_id, options, (error) ->
|
||||
timer.done()
|
||||
return next(error) if error?
|
||||
logger.log project_id: project_id, "deleted project via http"
|
||||
res.send 204 # No Content
|
||||
res.sendStatus 204 # No Content
|
||||
|
||||
deleteMultipleProjects: (req, res, next = (error) ->) ->
|
||||
project_ids = req.body?.project_ids || []
|
||||
|
@ -156,7 +156,7 @@ module.exports = HttpController =
|
|||
ProjectManager.queueFlushAndDeleteProject project_id, cb
|
||||
, (error) ->
|
||||
return next(error) if error?
|
||||
res.send 204 # No Content
|
||||
res.sendStatus 204 # No Content
|
||||
|
||||
acceptChanges: (req, res, next = (error) ->) ->
|
||||
{project_id, doc_id} = req.params
|
||||
|
@ -169,7 +169,7 @@ module.exports = HttpController =
|
|||
timer.done()
|
||||
return next(error) if error?
|
||||
logger.log {project_id, doc_id}, "accepted #{ change_ids.length } changes via http"
|
||||
res.send 204 # No Content
|
||||
res.sendStatus 204 # No Content
|
||||
|
||||
deleteComment: (req, res, next = (error) ->) ->
|
||||
{project_id, doc_id, comment_id} = req.params
|
||||
|
@ -179,7 +179,7 @@ module.exports = HttpController =
|
|||
timer.done()
|
||||
return next(error) if error?
|
||||
logger.log {project_id, doc_id, comment_id}, "deleted comment via http"
|
||||
res.send 204 # No Content
|
||||
res.sendStatus 204 # No Content
|
||||
|
||||
updateProject: (req, res, next = (error) ->) ->
|
||||
timer = new Metrics.Timer("http.updateProject")
|
||||
|
@ -191,7 +191,7 @@ module.exports = HttpController =
|
|||
timer.done()
|
||||
return next(error) if error?
|
||||
logger.log project_id: project_id, "updated project via http"
|
||||
res.send 204 # No Content
|
||||
res.sendStatus 204 # No Content
|
||||
|
||||
resyncProjectHistory: (req, res, next = (error) ->) ->
|
||||
project_id = req.params.project_id
|
||||
|
@ -201,7 +201,7 @@ module.exports = HttpController =
|
|||
HistoryManager.resyncProjectHistory project_id, projectHistoryId, docs, files, (error) ->
|
||||
return next(error) if error?
|
||||
logger.log {project_id}, "queued project history resync via http"
|
||||
res.send 204
|
||||
res.sendStatus 204
|
||||
|
||||
flushAllProjects: (req, res, next = (error)-> )->
|
||||
res.setTimeout(5 * 60 * 1000)
|
||||
|
@ -212,7 +212,7 @@ module.exports = HttpController =
|
|||
ProjectFlusher.flushAllProjects options, (err, project_ids)->
|
||||
if err?
|
||||
logger.err err:err, "error bulk flushing projects"
|
||||
res.send 500
|
||||
res.sendStatus 500
|
||||
else
|
||||
res.send project_ids
|
||||
|
||||
|
@ -225,7 +225,7 @@ module.exports = HttpController =
|
|||
DeleteQueueManager.flushAndDeleteOldProjects options, (err, flushed)->
|
||||
if err?
|
||||
logger.err err:err, "error flushing old projects"
|
||||
res.send 500
|
||||
res.sendStatus 500
|
||||
else
|
||||
logger.log {flushed: flushed}, "flush of queued projects completed"
|
||||
res.send {flushed: flushed}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
document-updater
|
||||
--public-repo=True
|
||||
--language=coffeescript
|
||||
--env-add=
|
||||
--node-version=10.19.0
|
||||
--acceptance-creds=None
|
||||
--dependencies=mongo,redis
|
||||
--docker-repos=gcr.io/overleaf-ops
|
||||
--env-add=
|
||||
--env-pass-through=
|
||||
--script-version=1.3.5
|
||||
--language=coffeescript
|
||||
--node-version=10.19.0
|
||||
--public-repo=True
|
||||
--script-version=2.0.0
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# This file was auto-generated, do not edit it directly.
|
||||
# Instead run bin/update_build_scripts from
|
||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||
# Version: 1.3.5
|
||||
|
||||
version: "2.3"
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# This file was auto-generated, do not edit it directly.
|
||||
# Instead run bin/update_build_scripts from
|
||||
# https://github.com/sharelatex/sharelatex-dev-environment
|
||||
# Version: 1.3.5
|
||||
|
||||
version: "2.3"
|
||||
|
||||
|
|
1986
services/document-updater/package-lock.json
generated
1986
services/document-updater/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -21,15 +21,16 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"async": "^2.5.0",
|
||||
"body-parser": "^1.19.0",
|
||||
"bunyan": "~0.22.1",
|
||||
"coffee-script": "~1.7.0",
|
||||
"express": "3.11.0",
|
||||
"express": "4.17.1",
|
||||
"lodash": "^4.17.13",
|
||||
"logger-sharelatex": "^1.9.1",
|
||||
"metrics-sharelatex": "^2.6.2",
|
||||
"mongojs": "^2.6.0",
|
||||
"mongojs": "^3.1.0",
|
||||
"redis-sharelatex": "^1.0.12",
|
||||
"request": "^2.47.0",
|
||||
"request": "^2.88.2",
|
||||
"requestretry": "^4.1.0",
|
||||
"settings-sharelatex": "^1.1.0"
|
||||
},
|
||||
|
|
|
@ -9,9 +9,9 @@ module.exports = MockProjectHistoryApi =
|
|||
app.post "/project/:project_id/flush", (req, res, next) =>
|
||||
@flushProject req.params.project_id, (error) ->
|
||||
if error?
|
||||
res.send 500
|
||||
res.sendStatus 500
|
||||
else
|
||||
res.send 204
|
||||
res.sendStatus 204
|
||||
|
||||
app.listen 3054, (error) ->
|
||||
throw error if error?
|
||||
|
|
|
@ -9,9 +9,9 @@ module.exports = MockTrackChangesApi =
|
|||
app.post "/project/:project_id/doc/:doc_id/flush", (req, res, next) =>
|
||||
@flushDoc req.params.doc_id, (error) ->
|
||||
if error?
|
||||
res.send 500
|
||||
res.sendStatus 500
|
||||
else
|
||||
res.send 204
|
||||
res.sendStatus 204
|
||||
|
||||
app.listen 3015, (error) ->
|
||||
throw error if error?
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
express = require("express")
|
||||
bodyParser = require("body-parser")
|
||||
app = express()
|
||||
MAX_REQUEST_SIZE = 2*(2*1024*1024 + 64*1024)
|
||||
|
||||
|
@ -30,18 +31,18 @@ module.exports = MockWebApi =
|
|||
app.get "/project/:project_id/doc/:doc_id", (req, res, next) =>
|
||||
@getDocument req.params.project_id, req.params.doc_id, (error, doc) ->
|
||||
if error?
|
||||
res.send 500
|
||||
res.sendStatus 500
|
||||
else if doc?
|
||||
res.send JSON.stringify doc
|
||||
else
|
||||
res.send 404
|
||||
res.sendStatus 404
|
||||
|
||||
app.post "/project/:project_id/doc/:doc_id", express.bodyParser({limit: MAX_REQUEST_SIZE}), (req, res, next) =>
|
||||
app.post "/project/:project_id/doc/:doc_id", bodyParser.json({limit: MAX_REQUEST_SIZE}), (req, res, next) =>
|
||||
MockWebApi.setDocument req.params.project_id, req.params.doc_id, req.body.lines, req.body.version, req.body.ranges, req.body.lastUpdatedAt, req.body.lastUpdatedBy, (error) ->
|
||||
if error?
|
||||
res.send 500
|
||||
res.sendStatus 500
|
||||
else
|
||||
res.send 204
|
||||
res.sendStatus 204
|
||||
|
||||
app.listen 3000, (error) ->
|
||||
throw error if error?
|
||||
|
|
|
@ -24,8 +24,9 @@ describe "HttpController", ->
|
|||
@next = sinon.stub()
|
||||
@res =
|
||||
send: sinon.stub()
|
||||
sendStatus: sinon.stub()
|
||||
json: sinon.stub()
|
||||
|
||||
|
||||
describe "getDoc", ->
|
||||
beforeEach ->
|
||||
@lines = ["one", "two", "three"]
|
||||
|
@ -119,7 +120,7 @@ describe "HttpController", ->
|
|||
@next
|
||||
.calledWith(new Error("oops"))
|
||||
.should.equal true
|
||||
|
||||
|
||||
describe "setDoc", ->
|
||||
beforeEach ->
|
||||
@lines = ["one", "two", "three"]
|
||||
|
@ -147,7 +148,7 @@ describe "HttpController", ->
|
|||
.should.equal true
|
||||
|
||||
it "should return a successful No Content response", ->
|
||||
@res.send
|
||||
@res.sendStatus
|
||||
.calledWith(204)
|
||||
.should.equal true
|
||||
|
||||
|
@ -179,7 +180,7 @@ describe "HttpController", ->
|
|||
@HttpController.setDoc(@req, @res, @next)
|
||||
|
||||
it 'should send back a 406 response', ->
|
||||
@res.send.calledWith(406).should.equal true
|
||||
@res.sendStatus.calledWith(406).should.equal true
|
||||
|
||||
it 'should not call setDocWithLock', ->
|
||||
@DocumentManager.setDocWithLock.callCount.should.equal 0
|
||||
|
@ -201,7 +202,7 @@ describe "HttpController", ->
|
|||
.should.equal true
|
||||
|
||||
it "should return a successful No Content response", ->
|
||||
@res.send
|
||||
@res.sendStatus
|
||||
.calledWith(204)
|
||||
.should.equal true
|
||||
|
||||
|
@ -222,7 +223,7 @@ describe "HttpController", ->
|
|||
@next
|
||||
.calledWith(new Error("oops"))
|
||||
.should.equal true
|
||||
|
||||
|
||||
describe "flushDocIfLoaded", ->
|
||||
beforeEach ->
|
||||
@lines = ["one", "two", "three"]
|
||||
|
@ -243,7 +244,7 @@ describe "HttpController", ->
|
|||
.should.equal true
|
||||
|
||||
it "should return a successful No Content response", ->
|
||||
@res.send
|
||||
@res.sendStatus
|
||||
.calledWith(204)
|
||||
.should.equal true
|
||||
|
||||
|
@ -289,7 +290,7 @@ describe "HttpController", ->
|
|||
.should.equal true
|
||||
|
||||
it "should return a successful No Content response", ->
|
||||
@res.send
|
||||
@res.sendStatus
|
||||
.calledWith(204)
|
||||
.should.equal true
|
||||
|
||||
|
@ -313,7 +314,7 @@ describe "HttpController", ->
|
|||
.should.equal true
|
||||
|
||||
it "should return a successful No Content response", ->
|
||||
@res.send.calledWith(204).should.equal true
|
||||
@res.sendStatus.calledWith(204).should.equal true
|
||||
|
||||
describe "when an errors occurs", ->
|
||||
beforeEach ->
|
||||
|
@ -329,7 +330,7 @@ describe "HttpController", ->
|
|||
@next
|
||||
.calledWith(new Error("oops"))
|
||||
.should.equal true
|
||||
|
||||
|
||||
describe "deleteProject", ->
|
||||
beforeEach ->
|
||||
@req =
|
||||
|
@ -347,7 +348,7 @@ describe "HttpController", ->
|
|||
.should.equal true
|
||||
|
||||
it "should return a successful No Content response", ->
|
||||
@res.send
|
||||
@res.sendStatus
|
||||
.calledWith(204)
|
||||
.should.equal true
|
||||
|
||||
|
@ -379,7 +380,7 @@ describe "HttpController", ->
|
|||
@next
|
||||
.calledWith(new Error("oops"))
|
||||
.should.equal true
|
||||
|
||||
|
||||
describe "acceptChanges", ->
|
||||
beforeEach ->
|
||||
@req =
|
||||
|
@ -399,7 +400,7 @@ describe "HttpController", ->
|
|||
.should.equal true
|
||||
|
||||
it "should return a successful No Content response", ->
|
||||
@res.send
|
||||
@res.sendStatus
|
||||
.calledWith(204)
|
||||
.should.equal true
|
||||
|
||||
|
@ -438,7 +439,7 @@ describe "HttpController", ->
|
|||
@next
|
||||
.calledWith(new Error("oops"))
|
||||
.should.equal true
|
||||
|
||||
|
||||
describe "deleteComment", ->
|
||||
beforeEach ->
|
||||
@req =
|
||||
|
@ -458,7 +459,7 @@ describe "HttpController", ->
|
|||
.should.equal true
|
||||
|
||||
it "should return a successful No Content response", ->
|
||||
@res.send
|
||||
@res.sendStatus
|
||||
.calledWith(204)
|
||||
.should.equal true
|
||||
|
||||
|
@ -524,7 +525,7 @@ describe "HttpController", ->
|
|||
@HttpController.getProjectDocsAndFlushIfOld(@req, @res, @next)
|
||||
|
||||
it "should return an HTTP 409 Conflict response", ->
|
||||
@res.send
|
||||
@res.sendStatus
|
||||
.calledWith(409)
|
||||
.should.equal true
|
||||
|
||||
|
@ -561,7 +562,7 @@ describe "HttpController", ->
|
|||
.should.equal true
|
||||
|
||||
it "should return a successful No Content response", ->
|
||||
@res.send
|
||||
@res.sendStatus
|
||||
.calledWith(204)
|
||||
.should.equal true
|
||||
|
||||
|
@ -601,7 +602,7 @@ describe "HttpController", ->
|
|||
.should.equal true
|
||||
|
||||
it "should return a successful No Content response", ->
|
||||
@res.send
|
||||
@res.sendStatus
|
||||
.calledWith(204)
|
||||
.should.equal true
|
||||
|
||||
|
|
Loading…
Reference in a new issue