diff --git a/services/clsi/.nvmrc b/services/clsi/.nvmrc index e1e5d1369a..5917993c09 100644 --- a/services/clsi/.nvmrc +++ b/services/clsi/.nvmrc @@ -1 +1 @@ -6.9.5 +6.13.0 diff --git a/services/clsi/Dockerfile b/services/clsi/Dockerfile index 05be84642a..e195f969fc 100644 --- a/services/clsi/Dockerfile +++ b/services/clsi/Dockerfile @@ -4,13 +4,13 @@ COPY ./ /app WORKDIR /app - RUN npm install RUN [ -e ./install_deps.sh ] && ./install_deps.sh RUN npm run compile +ENV SHARELATEX_CONFIG /app/config/settings.production.coffee ENV NODE_ENV production CMD ["node","/app/app.js"] diff --git a/services/clsi/Makefile b/services/clsi/Makefile index 6e7fca5f18..828e8f8248 100644 --- a/services/clsi/Makefile +++ b/services/clsi/Makefile @@ -1,13 +1,16 @@ # 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.0.1 +# Version: 1.0.3 BUILD_NUMBER ?= local BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD) PROJECT_NAME = clsi DOCKER_COMPOSE_FLAGS ?= -f docker-compose.yml -DOCKER_COMPOSE := docker-compose ${DOCKER_COMPOSE_FLAGS} +DOCKER_COMPOSE := BUILD_NUMBER=$(BUILD_NUMBER) \ + BRANCH_NAME=$(BRANCH_NAME) \ + PROJECT_NAME=$(PROJECT_NAME) \ + docker-compose ${DOCKER_COMPOSE_FLAGS} clean: rm -f app.js @@ -24,7 +27,7 @@ test_acceptance: test_clean # clear the database before each acceptance test run @[ -d test/acceptance ] && $(DOCKER_COMPOSE) run --rm test_acceptance -- ${MOCHA_ARGS} || echo "clsi has no acceptance tests" test_clean: - $(DOCKER_COMPOSE) down + $(DOCKER_COMPOSE) down -t 0 build: docker build --pull --tag quay.io/sharelatex/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) . diff --git a/services/clsi/base.yml b/services/clsi/base.yml new file mode 100644 index 0000000000..ef5f44a1cf --- /dev/null +++ b/services/clsi/base.yml @@ -0,0 +1,14 @@ +version: "2" + +services: + base: + environment: + TEXLIVE_IMAGE: quay.io/sharelatex/texlive-full:2017.1 + TEXLIVE_IMAGE_USER: root + SHARELATEX_CONFIG: /app/config/settings.defaults.coffee + COMMAND_RUNNER: docker-runner-sharelatex + COMPILES_HOST_DIR: $PWD/compiles + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - ./docker-runner:/app/node_modules/docker-runner-sharelatex + - ./compiles:/app/compiles diff --git a/services/clsi/docker-compose.ci.yml b/services/clsi/docker-compose.ci.yml index f34280d803..695ad3cf5d 100644 --- a/services/clsi/docker-compose.ci.yml +++ b/services/clsi/docker-compose.ci.yml @@ -1,7 +1,7 @@ # 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.0.1 +# Version: 1.0.3 version: "2" diff --git a/services/clsi/docker-compose.yml b/services/clsi/docker-compose.yml index a272e753b1..8c612e59ce 100644 --- a/services/clsi/docker-compose.yml +++ b/services/clsi/docker-compose.yml @@ -1,13 +1,13 @@ # 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.0.1 +# Version: 1.0.3 version: "2" services: test_unit: - image: node:6.9.5 + image: node:6.13.0 volumes: - .:/app working_dir: /app @@ -15,16 +15,15 @@ services: test_acceptance: build: . + extends: + file: base.yml + service: base environment: - TEXLIVE_IMAGE: quay.io/sharelatex/texlive-full:2017.1 - TEXLIVE_IMAGE_USER: root # Not ideal, but makes running in dev very simple - SHARELATEX_CONFIG: /app/config/settings.defaults.coffee - COMMAND_RUNNER: docker-runner-sharelatex - COMPILES_HOST_DIR: $PWD/compiles - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - ./docker-runner:/app/node_modules/docker-runner-sharelatex - - ./compiles:/app/compiles + REDIS_HOST: redis + MONGO_HOST: mongo + depends_on: + - redis + - mongo entrypoint: npm run test:acceptance redis: diff --git a/services/clsi/kube.yaml b/services/clsi/kube.yaml new file mode 100644 index 0000000000..44a562d0d5 --- /dev/null +++ b/services/clsi/kube.yaml @@ -0,0 +1,41 @@ +apiVersion: v1 +kind: Service +metadata: + name: clsi + namespace: default +spec: + type: LoadBalancer + ports: + - port: 3009 + protocol: TCP + targetPort: 3009 + selector: + run: clsi +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: clsi + namespace: default +spec: + replicas: 2 + template: + metadata: + labels: + run: clsi + spec: + containers: + - name: clsi + image: gcr.io/henry-terraform-admin/clsi:6e0c79688030117a9c27d0fc01d1271e6ac3dd3e + imagePullPolicy: Always + readinessProbe: + httpGet: + path: status + port: 3009 + periodSeconds: 5 + initialDelaySeconds: 0 + failureThreshold: 3 + successThreshold: 1 + + + diff --git a/services/clsi/nodemon.json b/services/clsi/nodemon.json index 9044f921c6..9a3be8d966 100644 --- a/services/clsi/nodemon.json +++ b/services/clsi/nodemon.json @@ -4,6 +4,7 @@ "node_modules/" ], "verbose": true, + "legacyWatch": true, "execMap": { "js": "npm run start" }, diff --git a/services/clsi/package.json b/services/clsi/package.json index 77e9423c0d..c5d52c949d 100644 --- a/services/clsi/package.json +++ b/services/clsi/package.json @@ -1,67 +1,67 @@ { - "name": "node-clsi", - "description": "A Node.js implementation of the CLSI LaTeX web-API", - "version": "0.1.4", + "name": "node-clsi", + "description": "A Node.js implementation of the CLSI LaTeX web-API", + "version": "0.1.4", "repository": { - "type": "git", + "type": "git", "url": "https://github.com/sharelatex/clsi-sharelatex.git" - }, + }, "scripts": { - "test:acceptance:wait_for_app": "echo 'Waiting for app to be accessible' && while (! curl -s -o /dev/null localhost:3013/status) do sleep 1; done", - "test:acceptance:run": "mocha --recursive --reporter spec --timeout 15000", - "test:acceptance:dir": "npm -q run test:acceptance:wait_for_app && npm -q run test:acceptance:run -- $@", - "test:acceptance": "npm run compile:app && npm run compile:acceptance_tests && npm run test:acceptance:_run -- $@", - "compile:test:acceptance": "coffee -o test/acceptance/js -c test/acceptance/coffee", - "compile:test:smoke": "coffee -o test/smoke/js -c test/smoke/coffee", - "compile:app": "coffee -o app/js -c app/coffee && coffee -c app.coffee", - "compile": "npm run compile:app && npm run compile:test:acceptance && npm run compile:test:smoke", - "start": "npm run compile:app && node app.js", - "test:acceptance:_run": "mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js", - "test:unit:_run": "mocha --recursive --reporter spec $@ test/unit/js", - "test:unit": "npm run compile:app && npm run compile:unit_tests && npm run test:unit:_run -- $@", - "compile:unit_tests": "[ -e test/unit ] && coffee -o test/unit/js -c test/unit/coffee || echo 'No unit tests to compile'", - "compile:acceptance_tests": "[ -e test/acceptance ] && coffee -o test/acceptance/js -c test/acceptance/coffee || echo 'No acceptance tests to compile'", - "compile:all": "npm run compile:app && npm run compile:unit_tests && npm run compile:acceptance_tests", + "test:acceptance:wait_for_app": "echo 'Waiting for app to be accessible' && while (! curl -s -o /dev/null localhost:3013/status) do sleep 1; done", + "test:acceptance:run": "mocha --recursive --reporter spec --timeout 15000", + "test:acceptance:dir": "npm -q run test:acceptance:wait_for_app && npm -q run test:acceptance:run -- $@", + "test:acceptance": "npm run compile:app && npm run compile:acceptance_tests && npm run test:acceptance:_run -- $@", + "compile:test:acceptance": "coffee -o test/acceptance/js -c test/acceptance/coffee", + "compile:test:smoke": "coffee -o test/smoke/js -c test/smoke/coffee", + "compile:app": "coffee -o app/js -c app/coffee && coffee -c app.coffee", + "compile": "npm run compile:app && npm run compile:test:acceptance && npm run compile:test:smoke", + "start": "npm run compile:app && node app.js", + "test:acceptance:_run": "mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js", + "test:unit:_run": "mocha --recursive --reporter spec $@ test/unit/js", + "test:unit": "npm run compile:app && npm run compile:unit_tests && npm run test:unit:_run -- $@", + "compile:unit_tests": "[ -e test/unit ] && coffee -o test/unit/js -c test/unit/coffee || echo 'No unit tests to compile'", + "compile:acceptance_tests": "[ -e test/acceptance ] && coffee -o test/acceptance/js -c test/acceptance/coffee || echo 'No acceptance tests to compile'", + "compile:all": "npm run compile:app && npm run compile:unit_tests && npm run compile:acceptance_tests", "nodemon": "nodemon --config nodemon.json" - }, - "author": "James Allen ", + }, + "author": "James Allen ", "dependencies": { - "async": "0.2.9", - "body-parser": "^1.2.0", - "dockerode": "^2.5.3", - "express": "^4.2.0", - "fs-extra": "^0.16.3", - "grunt-mkdir": "^1.0.0", - "heapdump": "^0.3.5", - "lockfile": "^1.0.3", - "logger-sharelatex": "git+https://github.com/sharelatex/logger-sharelatex.git#v1.5.4", - "lynx": "0.0.11", - "metrics-sharelatex": "git+https://github.com/sharelatex/metrics-sharelatex.git#v1.5.0", - "mkdirp": "0.3.5", - "mysql": "2.6.2", - "request": "^2.21.0", - "sequelize": "^2.1.3", - "settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#v1.0.0", - "smoke-test-sharelatex": "git+https://github.com/sharelatex/smoke-test-sharelatex.git#v0.2.0", - "sqlite3": "^3.1.13", - "underscore": "^1.8.2", - "v8-profiler": "^5.2.4", + "async": "0.2.9", + "body-parser": "^1.2.0", + "dockerode": "^2.5.3", + "express": "^4.2.0", + "fs-extra": "^0.16.3", + "grunt-mkdir": "^1.0.0", + "heapdump": "^0.3.5", + "lockfile": "^1.0.3", + "logger-sharelatex": "git+https://github.com/sharelatex/logger-sharelatex.git#v1.5.4", + "lynx": "0.0.11", + "metrics-sharelatex": "git+https://github.com/sharelatex/metrics-sharelatex.git#v1.5.0", + "mkdirp": "0.3.5", + "mysql": "2.6.2", + "request": "^2.21.0", + "sequelize": "^2.1.3", + "settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#v1.0.0", + "smoke-test-sharelatex": "git+https://github.com/sharelatex/smoke-test-sharelatex.git#v0.2.0", + "sqlite3": "^3.1.13", + "underscore": "^1.8.2", + "v8-profiler": "^5.2.4", "wrench": "~1.5.4" - }, + }, "devDependencies": { - "mocha": "^4.0.1", - "coffee-script": "1.6.0", - "chai": "~1.8.1", - "sinon": "~1.7.3", - "grunt": "~0.4.2", - "grunt-contrib-coffee": "~0.7.0", - "grunt-contrib-clean": "~0.5.0", - "grunt-shell": "~0.6.1", - "grunt-mocha-test": "~0.8.1", - "sandboxed-module": "~0.3.0", - "timekeeper": "0.0.4", - "grunt-execute": "^0.1.5", - "bunyan": "^0.22.1", + "mocha": "^4.0.1", + "coffee-script": "1.6.0", + "chai": "~1.8.1", + "sinon": "~1.7.3", + "grunt": "~0.4.2", + "grunt-contrib-coffee": "~0.7.0", + "grunt-contrib-clean": "~0.5.0", + "grunt-shell": "~0.6.1", + "grunt-mocha-test": "~0.8.1", + "sandboxed-module": "~0.3.0", + "timekeeper": "0.0.4", + "grunt-execute": "^0.1.5", + "bunyan": "^0.22.1", "grunt-bunyan": "^0.5.0" } }