mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #37 from sharelatex/csh-ho-docker-issue-1338-bulk-upgrade
Services bulk upgrade - docstore
This commit is contained in:
commit
6a0d78b101
6 changed files with 1843 additions and 109 deletions
1
services/docstore/.gitignore
vendored
1
services/docstore/.gitignore
vendored
|
@ -3,4 +3,5 @@ app/js/
|
|||
test/unit/js
|
||||
test/acceptance/js
|
||||
app.js
|
||||
**/*.map
|
||||
forever
|
||||
|
|
|
@ -1,102 +0,0 @@
|
|||
spawn = require("child_process").spawn
|
||||
|
||||
module.exports = (grunt) ->
|
||||
grunt.initConfig
|
||||
forever:
|
||||
app:
|
||||
options:
|
||||
index: "app.js"
|
||||
|
||||
coffee:
|
||||
app_src:
|
||||
expand: true,
|
||||
flatten: true,
|
||||
cwd: "app"
|
||||
src: ['coffee/*.coffee'],
|
||||
dest: 'app/js/',
|
||||
ext: '.js'
|
||||
|
||||
app:
|
||||
src: "app.coffee"
|
||||
dest: "app.js"
|
||||
|
||||
unit_tests:
|
||||
expand: true
|
||||
cwd: "test/unit/coffee"
|
||||
src: ["**/*.coffee"]
|
||||
dest: "test/unit/js/"
|
||||
ext: ".js"
|
||||
|
||||
acceptance_tests:
|
||||
expand: true
|
||||
cwd: "test/acceptance/coffee"
|
||||
src: ["**/*.coffee"]
|
||||
dest: "test/acceptance/js/"
|
||||
ext: ".js"
|
||||
|
||||
smoke_tests:
|
||||
expand: true
|
||||
cwd: "test/smoke/coffee"
|
||||
src: ["**/*.coffee"]
|
||||
dest: "test/smoke/js"
|
||||
ext: ".js"
|
||||
|
||||
clean:
|
||||
app: ["app/js/"]
|
||||
unit_tests: ["test/unit/js"]
|
||||
acceptance_tests: ["test/acceptance/js"]
|
||||
smoke_tests: ["test/smoke/js"]
|
||||
|
||||
execute:
|
||||
app:
|
||||
src: "app.js"
|
||||
|
||||
mochaTest:
|
||||
unit:
|
||||
options:
|
||||
reporter: grunt.option('reporter') or 'spec'
|
||||
grep: grunt.option("grep")
|
||||
src: ["test/unit/js/**/*.js"]
|
||||
acceptance:
|
||||
options:
|
||||
reporter: grunt.option('reporter') or 'spec'
|
||||
timeout: 40000
|
||||
grep: grunt.option("grep")
|
||||
src: ["test/acceptance/js/**/*.js"]
|
||||
smoke:
|
||||
options:
|
||||
reporter: grunt.option('reporter') or 'spec'
|
||||
timeout: 10000
|
||||
src: ["test/smoke/js/**/*.js"]
|
||||
|
||||
shell:
|
||||
dockerTests:
|
||||
command: 'docker run -v "$(pwd):/app" -e AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" -e AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" -e AWS_BUCKET="$AWS_BUCKET" --rm sl-acceptance-test-runner'
|
||||
|
||||
grunt.loadNpmTasks 'grunt-contrib-coffee'
|
||||
grunt.loadNpmTasks 'grunt-contrib-clean'
|
||||
grunt.loadNpmTasks 'grunt-mocha-test'
|
||||
grunt.loadNpmTasks 'grunt-shell'
|
||||
grunt.loadNpmTasks 'grunt-execute'
|
||||
grunt.loadNpmTasks 'grunt-bunyan'
|
||||
grunt.loadNpmTasks 'grunt-forever'
|
||||
|
||||
grunt.registerTask 'compile:app', ['clean:app', 'coffee:app', 'coffee:app_src']
|
||||
grunt.registerTask 'run', ['compile:app', 'bunyan', 'execute']
|
||||
|
||||
grunt.registerTask 'compile:unit_tests', ['clean:unit_tests', 'coffee:unit_tests']
|
||||
grunt.registerTask 'test:unit', ['compile:app', 'compile:unit_tests', 'mochaTest:unit']
|
||||
|
||||
grunt.registerTask 'compile:acceptance_tests', ['clean:acceptance_tests', 'coffee:acceptance_tests']
|
||||
grunt.registerTask 'test:acceptance', ['compile:acceptance_tests', 'mochaTest:acceptance']
|
||||
|
||||
grunt.registerTask 'compile:smoke_tests', ['clean:smoke_tests', 'coffee:smoke_tests']
|
||||
grunt.registerTask 'test:smoke', ['compile:smoke_tests', 'mochaTest:smoke']
|
||||
|
||||
grunt.registerTask 'install', 'compile:app'
|
||||
|
||||
grunt.registerTask 'test:acceptance:docker', ['compile:acceptance_tests', 'shell:dockerTests']
|
||||
|
||||
grunt.registerTask 'default', ['run']
|
||||
|
||||
|
|
@ -5,6 +5,13 @@ A CRUD API for storing and updating text documents in projects
|
|||
|
||||
[![Build Status](https://travis-ci.org/sharelatex/docstore-sharelatex.png?branch=master)](https://travis-ci.org/sharelatex/docstore-sharelatex)
|
||||
|
||||
Acceptance tests can be run with the command
|
||||
```
|
||||
docker run --rm -e AWS_BUCKET="<bucket-name>" -e AWS_ACCESS_KEY_ID=<aws-access-key> -e AWS_SECRET_ACCESS_KEY=<aws-secret-access-key> -v $(pwd):/app sharelatex/acceptance-test-runner
|
||||
```
|
||||
where `bucket-name`, `aws-access-key` and `aws-secret-access-key` are the credentials for an AWS S3 bucket.
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
Metrics = require "metrics-sharelatex"
|
||||
Metrics.initialize("docstore")
|
||||
Settings = require "settings-sharelatex"
|
||||
logger = require "logger-sharelatex"
|
||||
express = require "express"
|
||||
|
@ -7,7 +8,7 @@ Errors = require "./app/js/Errors"
|
|||
HttpController = require "./app/js/HttpController"
|
||||
Path = require "path"
|
||||
|
||||
Metrics.initialize("docstore")
|
||||
|
||||
logger.initialize("docstore")
|
||||
Metrics.event_loop?.monitor(logger)
|
||||
|
||||
|
@ -15,6 +16,8 @@ app = express()
|
|||
|
||||
app.use Metrics.http.monitor(logger)
|
||||
|
||||
Metrics.injectMetricsRoute(app)
|
||||
|
||||
app.param 'project_id', (req, res, next, project_id) ->
|
||||
if project_id?.match /^[0-9a-f]{24}$/
|
||||
next()
|
||||
|
@ -33,8 +36,8 @@ app.get '/project/:project_id/doc', HttpController.getAllDocs
|
|||
app.get '/project/:project_id/ranges', HttpController.getAllRanges
|
||||
app.get '/project/:project_id/doc/:doc_id', HttpController.getDoc
|
||||
app.get '/project/:project_id/doc/:doc_id/raw', HttpController.getRawDoc
|
||||
# Add 16kb overhead for the JSON encoding
|
||||
app.post '/project/:project_id/doc/:doc_id', bodyParser.json(limit: Settings.max_doc_length + 16 * 1024), HttpController.updateDoc
|
||||
# Add 64kb overhead for the JSON encoding
|
||||
app.post '/project/:project_id/doc/:doc_id', bodyParser.json(limit: Settings.max_doc_length + 64 * 1024), HttpController.updateDoc
|
||||
app.del '/project/:project_id/doc/:doc_id', HttpController.deleteDoc
|
||||
|
||||
app.post '/project/:project_id/archive', HttpController.archiveAllDocs
|
||||
|
@ -60,4 +63,4 @@ if !module.parent # Called directly
|
|||
throw error if error?
|
||||
logger.info "Docstore starting up, listening on #{host}:#{port}"
|
||||
|
||||
module.exports = app
|
||||
module.exports = app
|
||||
|
|
1825
services/docstore/npm-shrinkwrap.json
generated
Normal file
1825
services/docstore/npm-shrinkwrap.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -25,10 +25,10 @@
|
|||
"body-parser": "~1.0.2",
|
||||
"coffee-script": "^1.12.7",
|
||||
"express": "~4.1.1",
|
||||
"logger-sharelatex": "git+https://github.com/sharelatex/logger-sharelatex.git#v1.4.0",
|
||||
"metrics-sharelatex": "git+https://github.com/sharelatex/metrics-sharelatex.git#v2.0.10",
|
||||
"logger-sharelatex": "git+https://github.com/sharelatex/logger-sharelatex.git#v1.5.9",
|
||||
"metrics-sharelatex": "git+https://github.com/sharelatex/metrics-sharelatex.git#v2.0.12",
|
||||
"mongojs": "2.4.0",
|
||||
"settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#v1.0.0",
|
||||
"settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#v1.1.0",
|
||||
"underscore": "~1.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
Loading…
Reference in a new issue