Просмотр исходного кода

Merge branch 'ho-docker' of github.com:sharelatex/docstore-sharelatex into ho-docker

Henry Oswald 8 лет назад
Родитель
Сommit
ed4e2775c2

+ 2 - 3
services/docstore/Jenkinsfile

@@ -2,7 +2,7 @@ String cron_string = BRANCH_NAME == "master" ? "@daily" : ""
 
 
 pipeline {
 pipeline {
   agent any
   agent any
-  
+
   triggers {
   triggers {
     pollSCM('* * * * *')
     pollSCM('* * * * *')
     cron(cron_string)
     cron(cron_string)
@@ -24,12 +24,11 @@ pipeline {
     stage('Acceptance Tests') {
     stage('Acceptance Tests') {
       steps {
       steps {
         withCredentials([usernamePassword(credentialsId: 'S3_DOCSTORE_TEST_AWS_KEYS', passwordVariable: 'AWS_SECRET_ACCESS_KEY', usernameVariable: 'AWS_ACCESS_KEY_ID')]) {
         withCredentials([usernamePassword(credentialsId: 'S3_DOCSTORE_TEST_AWS_KEYS', passwordVariable: 'AWS_SECRET_ACCESS_KEY', usernameVariable: 'AWS_ACCESS_KEY_ID')]) {
-          sh 'AWS_BUCKET="sl-doc-archive-testing" AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_acceptance'
+          sh 'AWS_BUCKET="sl-acceptance-tests" AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_acceptance'
         }
         }
       }
       }
     }
     }
 
 
-
     stage('Package and publish build') {
     stage('Package and publish build') {
       steps {
       steps {
         sh 'make publish'
         sh 'make publish'

+ 2 - 2
services/docstore/Makefile

@@ -1,7 +1,7 @@
 # This file was auto-generated, do not edit it directly.
 # This file was auto-generated, do not edit it directly.
 # Instead run bin/update_build_scripts from
 # Instead run bin/update_build_scripts from
 # https://github.com/sharelatex/sharelatex-dev-environment
 # https://github.com/sharelatex/sharelatex-dev-environment
-# Version: 1.1.3
+# Version: 1.1.4
 
 
 BUILD_NUMBER ?= local
 BUILD_NUMBER ?= local
 BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
 BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
@@ -14,7 +14,7 @@ DOCKER_COMPOSE := BUILD_NUMBER=$(BUILD_NUMBER) \
 	AWS_BUCKET=${AWS_BUCKET} \
 	AWS_BUCKET=${AWS_BUCKET} \
 	AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
 	AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
 	AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
 	AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
-	docker-compose ${DOCKER_COMPOSE_FLAGS} 
+	docker-compose ${DOCKER_COMPOSE_FLAGS}
 
 
 
 
 clean:
 clean:

+ 11 - 5
services/docstore/config/settings.defaults.coffee

@@ -1,14 +1,13 @@
 http = require('http')
 http = require('http')
 http.globalAgent.maxSockets = 300
 http.globalAgent.maxSockets = 300
 
 
-module.exports = Settings =
+Settings =
 	internal:
 	internal:
 		docstore:
 		docstore:
 			port: 3016
 			port: 3016
 			host: process.env['LISTEN_ADDRESS'] or "localhost"
 			host: process.env['LISTEN_ADDRESS'] or "localhost"
 
 
-	mongo:
-		url: "#{process.env['MONGO_CONNECTION_STRING'] or 'mongodb://127.0.0.1/sharelatex'}"
+	mongo:{}
 
 
 	docstore:
 	docstore:
 		healthCheck:
 		healthCheck:
@@ -16,10 +15,17 @@ module.exports = Settings =
 
 
 	max_doc_length: 2 * 1024 * 1024 # 2mb
 	max_doc_length: 2 * 1024 * 1024 # 2mb
 
 
+if process.env['MONGO_CONNECTION_STRING']?
+	Settings.mongo.url = process.env['MONGO_CONNECTION_STRING']
+else if process.env['MONGO_HOST']?
+	Settings.mongo.url = "mongodb://#{process.env['MONGO_HOST']}/sharelatex"
+else
+	Settings.mongo.url = "mongodb://127.0.0.1/sharelatex"
+
 if process.env['AWS_ACCESS_KEY_ID']? and process.env['AWS_SECRET_ACCESS_KEY']? and process.env['AWS_BUCKET']?
 if process.env['AWS_ACCESS_KEY_ID']? and process.env['AWS_SECRET_ACCESS_KEY']? and process.env['AWS_BUCKET']?
 	Settings.docstore.s3 =
 	Settings.docstore.s3 =
 		key: process.env['AWS_ACCESS_KEY_ID']
 		key: process.env['AWS_ACCESS_KEY_ID']
 		secret: process.env['AWS_SECRET_ACCESS_KEY']
 		secret: process.env['AWS_SECRET_ACCESS_KEY']
 		bucket: process.env['AWS_BUCKET']
 		bucket: process.env['AWS_BUCKET']
-console.log "SETTINGS"
-console.log Settings.docstore.s3
+
+module.exports = Settings

+ 1 - 1
services/docstore/docker-compose.ci.yml

@@ -1,7 +1,7 @@
 # This file was auto-generated, do not edit it directly.
 # This file was auto-generated, do not edit it directly.
 # Instead run bin/update_build_scripts from
 # Instead run bin/update_build_scripts from
 # https://github.com/sharelatex/sharelatex-dev-environment
 # https://github.com/sharelatex/sharelatex-dev-environment
-# Version: 1.1.3
+# Version: 1.1.4
 
 
 version: "2"
 version: "2"
 
 

+ 2 - 2
services/docstore/docker-compose.yml

@@ -1,7 +1,7 @@
 # This file was auto-generated, do not edit it directly.
 # This file was auto-generated, do not edit it directly.
 # Instead run bin/update_build_scripts from
 # Instead run bin/update_build_scripts from
 # https://github.com/sharelatex/sharelatex-dev-environment
 # https://github.com/sharelatex/sharelatex-dev-environment
-# Version: 1.1.3
+# Version: 1.1.4
 
 
 version: "2"
 version: "2"
 
 
@@ -25,8 +25,8 @@ services:
       REDIS_HOST: redis
       REDIS_HOST: redis
       MONGO_HOST: mongo
       MONGO_HOST: mongo
       POSTGRES_HOST: postgres
       POSTGRES_HOST: postgres
-      AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
       AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
       AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
+      AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
       AWS_BUCKET: ${AWS_BUCKET}
       AWS_BUCKET: ${AWS_BUCKET}
       MOCHA_GREP: ${MOCHA_GREP}
       MOCHA_GREP: ${MOCHA_GREP}
     user: node
     user: node

+ 1 - 1
services/docstore/package.json

@@ -12,7 +12,7 @@
     "start": "npm run compile:app && node $NODE_APP_OPTIONS app.js",
     "start": "npm run compile:app && node $NODE_APP_OPTIONS app.js",
     "test:acceptance:_run": "AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY AWS_BUCKET=$AWS_BUCKET AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
     "test:acceptance:_run": "AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY AWS_BUCKET=$AWS_BUCKET AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
     "test:acceptance": "npm run compile:app && npm run compile:acceptance_tests && npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
     "test:acceptance": "npm run compile:app && npm run compile:acceptance_tests && npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
-    "test:unit:_run": "mocha --recursive --reporter spec $@ test/unit/js",
+    "test:unit:_run": "mocha --recursive --reporter spec --exit $@ test/unit/js",
     "test:unit": "npm run compile:app && npm run compile:unit_tests && npm run test:unit:_run -- --grep=$MOCHA_GREP",
     "test:unit": "npm run compile:app && npm run compile:unit_tests && npm run test:unit:_run -- --grep=$MOCHA_GREP",
     "compile:unit_tests": "[ ! -e test/unit/coffee ] &&  echo 'No unit tests to compile' || coffee -o test/unit/js -c test/unit/coffee",
     "compile:unit_tests": "[ ! -e test/unit/coffee ] &&  echo 'No unit tests to compile' || coffee -o test/unit/js -c test/unit/coffee",
     "compile:acceptance_tests": "[ ! -e test/acceptance/coffee ] && echo 'No acceptance tests to compile' || coffee -o test/acceptance/js -c test/acceptance/coffee",
     "compile:acceptance_tests": "[ ! -e test/acceptance/coffee ] && echo 'No acceptance tests to compile' || coffee -o test/acceptance/js -c test/acceptance/coffee",