diff --git a/libraries/access-token-encryptor/buildscript.txt b/libraries/access-token-encryptor/buildscript.txt index 764860cd76..f810166e41 100644 --- a/libraries/access-token-encryptor/buildscript.txt +++ b/libraries/access-token-encryptor/buildscript.txt @@ -6,4 +6,4 @@ access-token-encryptor --is-library=True --node-version=14.18.1 --public-repo=False ---script-version=3.13.0 +--script-version=4.0.0 diff --git a/libraries/logger/buildscript.txt b/libraries/logger/buildscript.txt index 34a5e01bc1..bba261613d 100644 --- a/libraries/logger/buildscript.txt +++ b/libraries/logger/buildscript.txt @@ -6,4 +6,4 @@ logger --is-library=True --node-version=14.18.1 --public-repo=False ---script-version=3.13.0 +--script-version=4.0.0 diff --git a/libraries/metrics/buildscript.txt b/libraries/metrics/buildscript.txt index 8918aa1f8d..9b939d7390 100644 --- a/libraries/metrics/buildscript.txt +++ b/libraries/metrics/buildscript.txt @@ -6,4 +6,4 @@ metrics --is-library=True --node-version=14.18.1 --public-repo=False ---script-version=3.13.0 +--script-version=4.0.0 diff --git a/libraries/o-error/buildscript.txt b/libraries/o-error/buildscript.txt index f08dbc2b9d..7a9fe1c48d 100644 --- a/libraries/o-error/buildscript.txt +++ b/libraries/o-error/buildscript.txt @@ -6,4 +6,4 @@ o-error --is-library=True --node-version=14.18.1 --public-repo=False ---script-version=3.13.0 +--script-version=4.0.0 diff --git a/libraries/object-persistor/buildscript.txt b/libraries/object-persistor/buildscript.txt index e1588dc2ea..bfe578e1aa 100644 --- a/libraries/object-persistor/buildscript.txt +++ b/libraries/object-persistor/buildscript.txt @@ -6,4 +6,4 @@ object-persistor --is-library=True --node-version=14.18.1 --public-repo=False ---script-version=3.13.0 +--script-version=4.0.0 diff --git a/libraries/redis-wrapper/buildscript.txt b/libraries/redis-wrapper/buildscript.txt index 8c90edb0ec..8b40bae25d 100644 --- a/libraries/redis-wrapper/buildscript.txt +++ b/libraries/redis-wrapper/buildscript.txt @@ -6,4 +6,4 @@ redis-wrapper --is-library=True --node-version=14.18.1 --public-repo=False ---script-version=3.13.0 +--script-version=4.0.0 diff --git a/libraries/settings/buildscript.txt b/libraries/settings/buildscript.txt index d0bb91795a..9b3b8fee07 100644 --- a/libraries/settings/buildscript.txt +++ b/libraries/settings/buildscript.txt @@ -6,4 +6,4 @@ settings --is-library=True --node-version=14.18.1 --public-repo=False ---script-version=3.13.0 +--script-version=4.0.0 diff --git a/services/chat/Dockerfile b/services/chat/Dockerfile index f203639813..c6d437c54a 100644 --- a/services/chat/Dockerfile +++ b/services/chat/Dockerfile @@ -4,20 +4,17 @@ FROM node:14.18.1 as base -WORKDIR /app +WORKDIR /overleaf/services/chat FROM base as app -#wildcard as some files may not be in all repos -COPY package*.json npm-shrink*.json /app/ +COPY services/chat/package*.json /overleaf/services/chat/ RUN npm ci --quiet -COPY . /app +COPY services/chat /overleaf/services/chat -FROM base - -COPY --from=app /app /app +FROM app USER node CMD ["node", "--expose-gc", "app.js"] diff --git a/services/chat/Makefile b/services/chat/Makefile index 682184f785..3067c96fbe 100644 --- a/services/chat/Makefile +++ b/services/chat/Makefile @@ -86,7 +86,8 @@ endif build: docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ --tag gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ - . + --file Dockerfile \ + ../.. tar: $(DOCKER_COMPOSE) up tar diff --git a/services/chat/buildscript.txt b/services/chat/buildscript.txt index d9dd0cac2a..ce7697790b 100644 --- a/services/chat/buildscript.txt +++ b/services/chat/buildscript.txt @@ -5,4 +5,4 @@ chat --env-pass-through= --node-version=14.18.1 --public-repo=False ---script-version=3.13.0 +--script-version=4.0.0 diff --git a/services/chat/docker-compose.yml b/services/chat/docker-compose.yml index 3cedb93e59..a311dffd51 100644 --- a/services/chat/docker-compose.yml +++ b/services/chat/docker-compose.yml @@ -8,8 +8,8 @@ services: test_unit: image: node:14.18.1 volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/chat + working_dir: /overleaf/services/chat environment: MOCHA_GREP: ${MOCHA_GREP} NODE_ENV: test @@ -20,8 +20,8 @@ services: test_acceptance: image: node:14.18.1 volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/chat + working_dir: /overleaf/services/chat environment: ELASTIC_SEARCH_DSN: es:9200 REDIS_HOST: redis diff --git a/services/clsi/Dockerfile b/services/clsi/Dockerfile index 41ffb1064a..0e112a9bc5 100644 --- a/services/clsi/Dockerfile +++ b/services/clsi/Dockerfile @@ -4,24 +4,21 @@ FROM node:14.18.1 as base -WORKDIR /app -COPY install_deps.sh /app +WORKDIR /overleaf/services/clsi +COPY services/clsi/install_deps.sh /overleaf/services/clsi/ RUN chmod 0755 ./install_deps.sh && ./install_deps.sh -ENTRYPOINT ["/bin/sh", "entrypoint.sh"] -COPY entrypoint.sh /app +ENTRYPOINT ["/bin/sh", "/entrypoint.sh"] +COPY services/clsi/entrypoint.sh / FROM base as app -#wildcard as some files may not be in all repos -COPY package*.json npm-shrink*.json /app/ +COPY services/clsi/package*.json /overleaf/services/clsi/ RUN npm ci --quiet -COPY . /app +COPY services/clsi /overleaf/services/clsi -FROM base - -COPY --from=app /app /app +FROM app RUN mkdir -p cache compiles output \ && chown node:node cache compiles output diff --git a/services/clsi/Makefile b/services/clsi/Makefile index d71d353379..e6e85a6922 100644 --- a/services/clsi/Makefile +++ b/services/clsi/Makefile @@ -94,12 +94,13 @@ build: --cache-from gcr.io/overleaf-ops/$(PROJECT_NAME):main-deps \ --target base \ --file Dockerfile \ - . + ../.. docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ --tag gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ --cache-from gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-deps \ - . + --file Dockerfile \ + ../.. tar: $(DOCKER_COMPOSE) up tar diff --git a/services/clsi/README.md b/services/clsi/README.md index 664569fb92..1868964db8 100644 --- a/services/clsi/README.md +++ b/services/clsi/README.md @@ -61,8 +61,8 @@ Then start the Docker container: -e TEXLIVE_IMAGE=texlive/texlive \ -e TEXLIVE_IMAGE_USER=root \ -e COMPILES_HOST_DIR="$PWD/compiles" \ - -v "$PWD/compiles:/app/compiles" \ - -v "$PWD/cache:/app/cache" \ + -v "$PWD/compiles:/overleaf/services/clsi/compiles" \ + -v "$PWD/cache:/overleaf/services/clsi/cache" \ -v /var/run/docker.sock:/var/run/docker.sock \ --name clsi \ overleaf/clsi diff --git a/services/clsi/buildscript.txt b/services/clsi/buildscript.txt index 2401f81395..975f772211 100644 --- a/services/clsi/buildscript.txt +++ b/services/clsi/buildscript.txt @@ -7,4 +7,4 @@ clsi --has-custom-cloudbuild=True --node-version=14.18.1 --public-repo=True ---script-version=3.13.0 +--script-version=4.0.0 diff --git a/services/clsi/docker-compose-config.yml b/services/clsi/docker-compose-config.yml index 9cc9cf4d98..9a9a7ee01c 100644 --- a/services/clsi/docker-compose-config.yml +++ b/services/clsi/docker-compose-config.yml @@ -6,13 +6,13 @@ services: ALLOWED_IMAGES: "quay.io/sharelatex/texlive-full:2017.1" TEXLIVE_IMAGE: quay.io/sharelatex/texlive-full:2017.1 TEXLIVE_IMAGE_USER: "tex" - SHARELATEX_CONFIG: /app/config/settings.defaults.js + SHARELATEX_CONFIG: /overleaf/services/clsi/config/settings.defaults.js DOCKER_RUNNER: "true" COMPILES_HOST_DIR: $PWD/compiles volumes: - /var/run/docker.sock:/var/run/docker.sock - - ./compiles:/app/compiles - - ./cache:/app/cache + - ./compiles:/overleaf/services/clsi/compiles + - ./cache:/overleaf/services/clsi/cache ci: @@ -20,10 +20,10 @@ services: ALLOWED_IMAGES: ${TEXLIVE_IMAGE} TEXLIVE_IMAGE: quay.io/sharelatex/texlive-full:2017.1 TEXLIVE_IMAGE_USER: "tex" - SHARELATEX_CONFIG: /app/config/settings.defaults.js + SHARELATEX_CONFIG: /overleaf/services/clsi/config/settings.defaults.js DOCKER_RUNNER: "true" COMPILES_HOST_DIR: $PWD/compiles volumes: - /var/run/docker.sock:/var/run/docker.sock:rw - - ./compiles:/app/compiles - - ./cache:/app/cache + - ./compiles:/overleaf/services/clsi/compiles + - ./cache:/overleaf/services/clsi/cache diff --git a/services/clsi/docker-compose.yml b/services/clsi/docker-compose.yml index 0c3b4eb52a..27290fdc27 100644 --- a/services/clsi/docker-compose.yml +++ b/services/clsi/docker-compose.yml @@ -7,11 +7,12 @@ version: "2.3" services: test_unit: build: - context: . + context: ../.. + dockerfile: services/clsi/Dockerfile target: base volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/clsi + working_dir: /overleaf/services/clsi environment: MOCHA_GREP: ${MOCHA_GREP} NODE_ENV: test @@ -20,11 +21,12 @@ services: test_acceptance: build: - context: . + context: ../.. + dockerfile: services/clsi/Dockerfile target: base volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/clsi + working_dir: /overleaf/services/clsi extends: file: docker-compose-config.yml service: dev diff --git a/services/clsi/entrypoint.sh b/services/clsi/entrypoint.sh index e1722ac3cb..1f906c8c7d 100755 --- a/services/clsi/entrypoint.sh +++ b/services/clsi/entrypoint.sh @@ -8,9 +8,9 @@ groupadd --non-unique --gid ${DOCKER_GROUP} dockeronhost usermod -aG dockeronhost node # compatibility: initial volume setup -mkdir -p /app/cache && chown node:node /app/cache -mkdir -p /app/compiles && chown node:node /app/compiles -mkdir -p /app/db && chown node:node /app/db -mkdir -p /app/output && chown node:node /app/output +mkdir -p /overleaf/services/clsi/cache && chown node:node /overleaf/services/clsi/cache +mkdir -p /overleaf/services/clsi/compiles && chown node:node /overleaf/services/clsi/compiles +mkdir -p /overleaf/services/clsi/db && chown node:node /overleaf/services/clsi/db +mkdir -p /overleaf/services/clsi/output && chown node:node /overleaf/services/clsi/output exec runuser -u node -- "$@" diff --git a/services/clsi/test/unit/js/ContentCacheManagerTests.js b/services/clsi/test/unit/js/ContentCacheManagerTests.js index e59bd68d93..fc806bc482 100644 --- a/services/clsi/test/unit/js/ContentCacheManagerTests.js +++ b/services/clsi/test/unit/js/ContentCacheManagerTests.js @@ -31,9 +31,9 @@ describe('ContentCacheManager', function () { } before(function () { contentDir = - '/app/output/602cee6f6460fca0ba7921e6/content/1797a7f48f9-5abc1998509dea1f' + '/overleaf/services/clsi/output/602cee6f6460fca0ba7921e6/content/1797a7f48f9-5abc1998509dea1f' pdfPath = - '/app/output/602cee6f6460fca0ba7921e6/generated-files/1797a7f48ea-8ac6805139f43351/output.pdf' + '/overleaf/services/clsi/output/602cee6f6460fca0ba7921e6/generated-files/1797a7f48ea-8ac6805139f43351/output.pdf' reclaimed = 0 Settings.pdfCachingMinChunkSize = 1024 diff --git a/services/contacts/Dockerfile b/services/contacts/Dockerfile index f203639813..db4c984a0c 100644 --- a/services/contacts/Dockerfile +++ b/services/contacts/Dockerfile @@ -4,20 +4,17 @@ FROM node:14.18.1 as base -WORKDIR /app +WORKDIR /overleaf/services/contacts FROM base as app -#wildcard as some files may not be in all repos -COPY package*.json npm-shrink*.json /app/ +COPY services/contacts/package*.json /overleaf/services/contacts/ RUN npm ci --quiet -COPY . /app +COPY services/contacts /overleaf/services/contacts -FROM base - -COPY --from=app /app /app +FROM app USER node CMD ["node", "--expose-gc", "app.js"] diff --git a/services/contacts/Makefile b/services/contacts/Makefile index d5eaff315d..92a117fad0 100644 --- a/services/contacts/Makefile +++ b/services/contacts/Makefile @@ -86,7 +86,8 @@ endif build: docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ --tag gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ - . + --file Dockerfile \ + ../.. tar: $(DOCKER_COMPOSE) up tar diff --git a/services/contacts/buildscript.txt b/services/contacts/buildscript.txt index 5b3c96371b..70d8f37cd3 100644 --- a/services/contacts/buildscript.txt +++ b/services/contacts/buildscript.txt @@ -5,4 +5,4 @@ contacts --env-pass-through= --node-version=14.18.1 --public-repo=False ---script-version=3.13.0 +--script-version=4.0.0 diff --git a/services/contacts/docker-compose.yml b/services/contacts/docker-compose.yml index 3cedb93e59..6a37a3488f 100644 --- a/services/contacts/docker-compose.yml +++ b/services/contacts/docker-compose.yml @@ -8,8 +8,8 @@ services: test_unit: image: node:14.18.1 volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/contacts + working_dir: /overleaf/services/contacts environment: MOCHA_GREP: ${MOCHA_GREP} NODE_ENV: test @@ -20,8 +20,8 @@ services: test_acceptance: image: node:14.18.1 volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/contacts + working_dir: /overleaf/services/contacts environment: ELASTIC_SEARCH_DSN: es:9200 REDIS_HOST: redis diff --git a/services/docstore/Dockerfile b/services/docstore/Dockerfile index f203639813..5293cc465b 100644 --- a/services/docstore/Dockerfile +++ b/services/docstore/Dockerfile @@ -4,20 +4,17 @@ FROM node:14.18.1 as base -WORKDIR /app +WORKDIR /overleaf/services/docstore FROM base as app -#wildcard as some files may not be in all repos -COPY package*.json npm-shrink*.json /app/ +COPY services/docstore/package*.json /overleaf/services/docstore/ RUN npm ci --quiet -COPY . /app +COPY services/docstore /overleaf/services/docstore -FROM base - -COPY --from=app /app /app +FROM app USER node CMD ["node", "--expose-gc", "app.js"] diff --git a/services/docstore/Makefile b/services/docstore/Makefile index bb976cf1a7..1fba7ae5ca 100644 --- a/services/docstore/Makefile +++ b/services/docstore/Makefile @@ -86,7 +86,8 @@ endif build: docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ --tag gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ - . + --file Dockerfile \ + ../.. tar: $(DOCKER_COMPOSE) up tar diff --git a/services/docstore/buildscript.txt b/services/docstore/buildscript.txt index 7e7baa4fd8..30b6a90151 100644 --- a/services/docstore/buildscript.txt +++ b/services/docstore/buildscript.txt @@ -5,4 +5,4 @@ docstore --env-pass-through= --node-version=14.18.1 --public-repo=True ---script-version=3.13.0 +--script-version=4.0.0 diff --git a/services/docstore/docker-compose.yml b/services/docstore/docker-compose.yml index a80c5f5d47..ad45656462 100644 --- a/services/docstore/docker-compose.yml +++ b/services/docstore/docker-compose.yml @@ -8,8 +8,8 @@ services: test_unit: image: node:14.18.1 volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/docstore + working_dir: /overleaf/services/docstore environment: MOCHA_GREP: ${MOCHA_GREP} NODE_ENV: test @@ -20,8 +20,8 @@ services: test_acceptance: image: node:14.18.1 volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/docstore + working_dir: /overleaf/services/docstore extends: file: docker-compose-config.yml service: dev diff --git a/services/document-updater/Dockerfile b/services/document-updater/Dockerfile index f203639813..5ccd1bd140 100644 --- a/services/document-updater/Dockerfile +++ b/services/document-updater/Dockerfile @@ -4,20 +4,17 @@ FROM node:14.18.1 as base -WORKDIR /app +WORKDIR /overleaf/services/document-updater FROM base as app -#wildcard as some files may not be in all repos -COPY package*.json npm-shrink*.json /app/ +COPY services/document-updater/package*.json /overleaf/services/document-updater/ RUN npm ci --quiet -COPY . /app +COPY services/document-updater /overleaf/services/document-updater -FROM base - -COPY --from=app /app /app +FROM app USER node CMD ["node", "--expose-gc", "app.js"] diff --git a/services/document-updater/Makefile b/services/document-updater/Makefile index a8a6d7ac17..8e5322e0af 100644 --- a/services/document-updater/Makefile +++ b/services/document-updater/Makefile @@ -86,7 +86,8 @@ endif build: docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ --tag gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ - . + --file Dockerfile \ + ../.. tar: $(DOCKER_COMPOSE) up tar diff --git a/services/document-updater/buildscript.txt b/services/document-updater/buildscript.txt index 186e89cf28..be77d6afed 100644 --- a/services/document-updater/buildscript.txt +++ b/services/document-updater/buildscript.txt @@ -5,4 +5,4 @@ document-updater --env-pass-through= --node-version=14.18.1 --public-repo=True ---script-version=3.13.0 +--script-version=4.0.0 diff --git a/services/document-updater/docker-compose.yml b/services/document-updater/docker-compose.yml index 694aff43b7..08a408e9a9 100644 --- a/services/document-updater/docker-compose.yml +++ b/services/document-updater/docker-compose.yml @@ -8,8 +8,8 @@ services: test_unit: image: node:14.18.1 volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/document-updater + working_dir: /overleaf/services/document-updater environment: MOCHA_GREP: ${MOCHA_GREP} NODE_ENV: test @@ -20,8 +20,8 @@ services: test_acceptance: image: node:14.18.1 volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/document-updater + working_dir: /overleaf/services/document-updater environment: ELASTIC_SEARCH_DSN: es:9200 REDIS_HOST: redis diff --git a/services/filestore/Dockerfile b/services/filestore/Dockerfile index 4a34a75366..2907311aa4 100644 --- a/services/filestore/Dockerfile +++ b/services/filestore/Dockerfile @@ -4,22 +4,19 @@ FROM node:14.18.1 as base -WORKDIR /app -COPY install_deps.sh /app +WORKDIR /overleaf/services/filestore +COPY services/filestore/install_deps.sh /overleaf/services/filestore/ RUN chmod 0755 ./install_deps.sh && ./install_deps.sh FROM base as app -#wildcard as some files may not be in all repos -COPY package*.json npm-shrink*.json /app/ +COPY services/filestore/package*.json /overleaf/services/filestore/ RUN npm ci --quiet -COPY . /app +COPY services/filestore /overleaf/services/filestore -FROM base - -COPY --from=app /app /app +FROM app RUN mkdir -p uploads user_files template_files \ && chown node:node uploads user_files template_files USER node diff --git a/services/filestore/Makefile b/services/filestore/Makefile index fb666c0f8b..8751a7f5ab 100644 --- a/services/filestore/Makefile +++ b/services/filestore/Makefile @@ -94,12 +94,13 @@ build: --cache-from gcr.io/overleaf-ops/$(PROJECT_NAME):main-deps \ --target base \ --file Dockerfile \ - . + ../.. docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ --tag gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ --cache-from gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-deps \ - . + --file Dockerfile \ + ../.. tar: $(DOCKER_COMPOSE) up tar diff --git a/services/filestore/buildscript.txt b/services/filestore/buildscript.txt index 9c61c56f75..7ac264e154 100644 --- a/services/filestore/buildscript.txt +++ b/services/filestore/buildscript.txt @@ -6,4 +6,4 @@ filestore --env-pass-through= --node-version=14.18.1 --public-repo=True ---script-version=3.13.0 +--script-version=4.0.0 diff --git a/services/filestore/docker-compose.yml b/services/filestore/docker-compose.yml index 1172975721..6150a754b2 100644 --- a/services/filestore/docker-compose.yml +++ b/services/filestore/docker-compose.yml @@ -7,11 +7,12 @@ version: "2.3" services: test_unit: build: - context: . + context: ../.. + dockerfile: services/filestore/Dockerfile target: base volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/filestore + working_dir: /overleaf/services/filestore environment: MOCHA_GREP: ${MOCHA_GREP} NODE_ENV: test @@ -21,11 +22,12 @@ services: test_acceptance: build: - context: . + context: ../.. + dockerfile: services/filestore/Dockerfile target: base volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/filestore + working_dir: /overleaf/services/filestore environment: ELASTIC_SEARCH_DSN: es:9200 REDIS_HOST: redis diff --git a/services/notifications/Dockerfile b/services/notifications/Dockerfile index f203639813..9d13cef05b 100644 --- a/services/notifications/Dockerfile +++ b/services/notifications/Dockerfile @@ -4,20 +4,17 @@ FROM node:14.18.1 as base -WORKDIR /app +WORKDIR /overleaf/services/notifications FROM base as app -#wildcard as some files may not be in all repos -COPY package*.json npm-shrink*.json /app/ +COPY services/notifications/package*.json /overleaf/services/notifications/ RUN npm ci --quiet -COPY . /app +COPY services/notifications /overleaf/services/notifications -FROM base - -COPY --from=app /app /app +FROM app USER node CMD ["node", "--expose-gc", "app.js"] diff --git a/services/notifications/Makefile b/services/notifications/Makefile index 9cb40412ce..375d5f019e 100644 --- a/services/notifications/Makefile +++ b/services/notifications/Makefile @@ -86,7 +86,8 @@ endif build: docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ --tag gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ - . + --file Dockerfile \ + ../.. tar: $(DOCKER_COMPOSE) up tar diff --git a/services/notifications/buildscript.txt b/services/notifications/buildscript.txt index 9c80e1cea4..861d695010 100644 --- a/services/notifications/buildscript.txt +++ b/services/notifications/buildscript.txt @@ -5,4 +5,4 @@ notifications --env-pass-through= --node-version=14.18.1 --public-repo=True ---script-version=3.13.0 +--script-version=4.0.0 diff --git a/services/notifications/docker-compose.yml b/services/notifications/docker-compose.yml index 3cedb93e59..fd48751c43 100644 --- a/services/notifications/docker-compose.yml +++ b/services/notifications/docker-compose.yml @@ -8,8 +8,8 @@ services: test_unit: image: node:14.18.1 volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/notifications + working_dir: /overleaf/services/notifications environment: MOCHA_GREP: ${MOCHA_GREP} NODE_ENV: test @@ -20,8 +20,8 @@ services: test_acceptance: image: node:14.18.1 volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/notifications + working_dir: /overleaf/services/notifications environment: ELASTIC_SEARCH_DSN: es:9200 REDIS_HOST: redis diff --git a/services/real-time/Dockerfile b/services/real-time/Dockerfile index f203639813..4cabbfbe79 100644 --- a/services/real-time/Dockerfile +++ b/services/real-time/Dockerfile @@ -4,20 +4,17 @@ FROM node:14.18.1 as base -WORKDIR /app +WORKDIR /overleaf/services/real-time FROM base as app -#wildcard as some files may not be in all repos -COPY package*.json npm-shrink*.json /app/ +COPY services/real-time/package*.json /overleaf/services/real-time/ RUN npm ci --quiet -COPY . /app +COPY services/real-time /overleaf/services/real-time -FROM base - -COPY --from=app /app /app +FROM app USER node CMD ["node", "--expose-gc", "app.js"] diff --git a/services/real-time/Makefile b/services/real-time/Makefile index 11fd7c0909..2a392f80d7 100644 --- a/services/real-time/Makefile +++ b/services/real-time/Makefile @@ -86,7 +86,8 @@ endif build: docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ --tag gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ - . + --file Dockerfile \ + ../.. tar: $(DOCKER_COMPOSE) up tar diff --git a/services/real-time/buildscript.txt b/services/real-time/buildscript.txt index 12382f8e37..37b30e4093 100644 --- a/services/real-time/buildscript.txt +++ b/services/real-time/buildscript.txt @@ -5,4 +5,4 @@ real-time --env-pass-through= --node-version=14.18.1 --public-repo=True ---script-version=3.13.0 +--script-version=4.0.0 diff --git a/services/real-time/docker-compose.yml b/services/real-time/docker-compose.yml index 2812df44a2..8e1cd780e1 100644 --- a/services/real-time/docker-compose.yml +++ b/services/real-time/docker-compose.yml @@ -8,8 +8,8 @@ services: test_unit: image: node:14.18.1 volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/real-time + working_dir: /overleaf/services/real-time environment: MOCHA_GREP: ${MOCHA_GREP} NODE_ENV: test @@ -20,8 +20,8 @@ services: test_acceptance: image: node:14.18.1 volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/real-time + working_dir: /overleaf/services/real-time environment: ELASTIC_SEARCH_DSN: es:9200 REDIS_HOST: redis diff --git a/services/spelling/Dockerfile b/services/spelling/Dockerfile index 8753c136c2..f2544d4c54 100644 --- a/services/spelling/Dockerfile +++ b/services/spelling/Dockerfile @@ -4,22 +4,19 @@ FROM node:14.18.1 as base -WORKDIR /app -COPY install_deps.sh /app +WORKDIR /overleaf/services/spelling +COPY services/spelling/install_deps.sh /overleaf/services/spelling/ RUN chmod 0755 ./install_deps.sh && ./install_deps.sh FROM base as app -#wildcard as some files may not be in all repos -COPY package*.json npm-shrink*.json /app/ +COPY services/spelling/package*.json /overleaf/services/spelling/ RUN npm ci --quiet -COPY . /app +COPY services/spelling /overleaf/services/spelling -FROM base - -COPY --from=app /app /app +FROM app RUN mkdir -p cache \ && chown node:node cache USER node diff --git a/services/spelling/Makefile b/services/spelling/Makefile index db078814e3..e3c0c9457c 100644 --- a/services/spelling/Makefile +++ b/services/spelling/Makefile @@ -94,12 +94,13 @@ build: --cache-from gcr.io/overleaf-ops/$(PROJECT_NAME):main-deps \ --target base \ --file Dockerfile \ - . + ../.. docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ --tag gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ --cache-from gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-deps \ - . + --file Dockerfile \ + ../.. tar: $(DOCKER_COMPOSE) up tar diff --git a/services/spelling/buildscript.txt b/services/spelling/buildscript.txt index 1e900b877a..1a076deeb1 100644 --- a/services/spelling/buildscript.txt +++ b/services/spelling/buildscript.txt @@ -6,4 +6,4 @@ spelling --env-pass-through= --node-version=14.18.1 --public-repo=False ---script-version=3.13.0 +--script-version=4.0.0 diff --git a/services/spelling/docker-compose.yml b/services/spelling/docker-compose.yml index 03ae188514..7cb04c4c6e 100644 --- a/services/spelling/docker-compose.yml +++ b/services/spelling/docker-compose.yml @@ -7,11 +7,12 @@ version: "2.3" services: test_unit: build: - context: . + context: ../.. + dockerfile: services/spelling/Dockerfile target: base volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/spelling + working_dir: /overleaf/services/spelling environment: MOCHA_GREP: ${MOCHA_GREP} NODE_ENV: test @@ -21,11 +22,12 @@ services: test_acceptance: build: - context: . + context: ../.. + dockerfile: services/spelling/Dockerfile target: base volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/spelling + working_dir: /overleaf/services/spelling environment: ELASTIC_SEARCH_DSN: es:9200 REDIS_HOST: redis diff --git a/services/track-changes/Dockerfile b/services/track-changes/Dockerfile index f203639813..788d172bf7 100644 --- a/services/track-changes/Dockerfile +++ b/services/track-changes/Dockerfile @@ -4,20 +4,17 @@ FROM node:14.18.1 as base -WORKDIR /app +WORKDIR /overleaf/services/track-changes FROM base as app -#wildcard as some files may not be in all repos -COPY package*.json npm-shrink*.json /app/ +COPY services/track-changes/package*.json /overleaf/services/track-changes/ RUN npm ci --quiet -COPY . /app +COPY services/track-changes /overleaf/services/track-changes -FROM base - -COPY --from=app /app /app +FROM app USER node CMD ["node", "--expose-gc", "app.js"] diff --git a/services/track-changes/Makefile b/services/track-changes/Makefile index c121f1dfba..341c01fcea 100644 --- a/services/track-changes/Makefile +++ b/services/track-changes/Makefile @@ -86,7 +86,8 @@ endif build: docker build --pull --tag ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ --tag gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) \ - . + --file Dockerfile \ + ../.. tar: $(DOCKER_COMPOSE) up tar diff --git a/services/track-changes/buildscript.txt b/services/track-changes/buildscript.txt index 978febd83e..07a3868cf8 100644 --- a/services/track-changes/buildscript.txt +++ b/services/track-changes/buildscript.txt @@ -5,4 +5,4 @@ track-changes --env-pass-through= --node-version=14.18.1 --public-repo=True ---script-version=3.13.0 +--script-version=4.0.0 diff --git a/services/track-changes/docker-compose.yml b/services/track-changes/docker-compose.yml index c56b44da03..e3188f021a 100644 --- a/services/track-changes/docker-compose.yml +++ b/services/track-changes/docker-compose.yml @@ -8,8 +8,8 @@ services: test_unit: image: node:14.18.1 volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/track-changes + working_dir: /overleaf/services/track-changes environment: MOCHA_GREP: ${MOCHA_GREP} NODE_ENV: test @@ -20,8 +20,8 @@ services: test_acceptance: image: node:14.18.1 volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/track-changes + working_dir: /overleaf/services/track-changes environment: ELASTIC_SEARCH_DSN: es:9200 REDIS_HOST: redis diff --git a/services/web/Dockerfile b/services/web/Dockerfile index 34ee6a4996..d15cb921bd 100644 --- a/services/web/Dockerfile +++ b/services/web/Dockerfile @@ -1,7 +1,8 @@ -# the base image is suitable for running web with /app bind mounted +# the base image is suitable for running web with /overleaf/services/web bind +# mounted FROM node:14.18.1 as base -WORKDIR /app +WORKDIR /overleaf/services/web # install_deps changes app files and installs npm packages # as such it has to run at a later stage @@ -10,12 +11,13 @@ RUN apt-get update \ && apt-get install -y parallel \ && rm -rf /var/lib/apt/lists/* -RUN mkdir /app/node_modules && chown node:node /app/node_modules +RUN mkdir /overleaf/services/web/node_modules \ +&& chown node:node /overleaf/services/web/node_modules # the deps image is used for caching npm ci FROM base as deps -COPY package.json package-lock.json /app/ +COPY services/web/package.json services/web/package-lock.json /overleaf/services/web/ RUN npm ci --quiet @@ -23,16 +25,16 @@ RUN npm ci --quiet # the dev is suitable for running tests FROM deps as dev -COPY . /app +COPY services/web /overleaf/services/web -RUN mkdir -p /app/data/dumpFolder && \ - mkdir -p /app/data/logs && \ - mkdir -p /app/data/pdf && \ - mkdir -p /app/data/uploads && \ - mkdir -p /app/data/zippedProjects && \ - mkdir -p /app/data/projectHistories && \ - chmod -R 0755 /app/data/ && \ - chown -R node:node /app/data/ +RUN mkdir -p /overleaf/services/web/data/dumpFolder \ +&& mkdir -p /overleaf/services/web/data/logs \ +&& mkdir -p /overleaf/services/web/data/pdf \ +&& mkdir -p /overleaf/services/web/data/uploads \ +&& mkdir -p /overleaf/services/web/data/zippedProjects \ +&& mkdir -p /overleaf/services/web/data/projectHistories \ +&& chmod -R 0755 /overleaf/services/web/data \ +&& chown -R node:node /overleaf/services/web/data ARG SENTRY_RELEASE ENV SENTRY_RELEASE=$SENTRY_RELEASE @@ -50,8 +52,8 @@ RUN chmod 0755 ./install_deps.sh && ./install_deps.sh # the final production image without webpack source maps FROM webpack as app -RUN find /app/public -name '*.js.map' -delete -RUN rm /app/modules/server-ce-scripts -rf +RUN find /overleaf/services/web/public -name '*.js.map' -delete +RUN rm /overleaf/services/web/modules/server-ce-scripts -rf USER node CMD ["node", "--expose-gc", "app.js"] diff --git a/services/web/Makefile b/services/web/Makefile index 421c479f59..41ef34628a 100644 --- a/services/web/Makefile +++ b/services/web/Makefile @@ -5,12 +5,12 @@ BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD) PROJECT_NAME = web BUILD_DIR_NAME = $(shell pwd | xargs basename | tr -cd '[a-zA-Z0-9_.\-]') -export SHARELATEX_CONFIG ?= /app/test/acceptance/config/settings.test.saas.js +export SHARELATEX_CONFIG ?= /overleaf/services/web/test/acceptance/config/settings.test.saas.js export BASE_CONFIG ?= ${SHARELATEX_CONFIG} -CFG_SAAS=/app/test/acceptance/config/settings.test.saas.js -CFG_SERVER_CE=/app/test/acceptance/config/settings.test.server-ce.js -CFG_SERVER_PRO=/app/test/acceptance/config/settings.test.server-pro.js +CFG_SAAS=/overleaf/services/web/test/acceptance/config/settings.test.saas.js +CFG_SERVER_CE=/overleaf/services/web/test/acceptance/config/settings.test.server-ce.js +CFG_SERVER_PRO=/overleaf/services/web/test/acceptance/config/settings.test.server-pro.js DOCKER_COMPOSE := BUILD_NUMBER=$(BUILD_NUMBER) \ BRANCH_NAME=$(BRANCH_NAME) \ @@ -29,6 +29,27 @@ $(MODULE_MAKEFILES): Makefile.module # Clean # +clean: + -$(DOCKER_COMPOSE) down --rmi local + -COMPOSE_PROJECT_NAME=unit_test_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down --rmi local + -COMPOSE_PROJECT_NAME=unit_test_all_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down --rmi local + -COMPOSE_PROJECT_NAME=unit_test_parallel_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down --rmi local + -COMPOSE_PROJECT_NAME=unit_test_parallel_make_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down --rmi local + -COMPOSE_PROJECT_NAME=acceptance_test_saas_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down --rmi local + -COMPOSE_PROJECT_NAME=acceptance_test_server_ce_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down --rmi local + -COMPOSE_PROJECT_NAME=acceptance_test_server_pro_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down --rmi local + -COMPOSE_PROJECT_NAME=acceptance_modules_merged_saas_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down --rmi local + -COMPOSE_PROJECT_NAME=acceptance_modules_merged_saas_1_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down --rmi local + -COMPOSE_PROJECT_NAME=acceptance_modules_merged_saas_2_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down --rmi local + -COMPOSE_PROJECT_NAME=acceptance_modules_merged_saas_3_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down --rmi local + -COMPOSE_PROJECT_NAME=acceptance_modules_merged_saas_4_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down --rmi local + -COMPOSE_PROJECT_NAME=acceptance_modules_merged_server_ce_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down --rmi local + -COMPOSE_PROJECT_NAME=acceptance_modules_merged_server_pro_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down --rmi local + -COMPOSE_PROJECT_NAME=karma_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down --rmi local + -COMPOSE_PROJECT_NAME=karma_test_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down --rmi local + -COMPOSE_PROJECT_NAME=frontend_test_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down --rmi local + -COMPOSE_PROJECT_NAME=tar_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) down --rmi local + clean_ci: $(DOCKER_COMPOSE) down -v -t 0 docker container list | grep 'days ago' | cut -d ' ' -f 1 - | xargs -r docker container stop @@ -163,7 +184,7 @@ $(TEST_ACCEPTANCE_APP): # Target: modules/server-ce-scripts/test_acceptance_server_ce # -> depends on modules/server-ce-scripts/Makefile # -> add environment variable BASE_CONFIG=$(CFG_SERVER_CE) -# -> BASE_CONFIG=/app/test/acceptance/config/settings.test.server-ce.js +# -> BASE_CONFIG=/overleaf/services/web/test/acceptance/config/settings.test.server-ce.js # -> automatic target: `make -C server-ce-scripts test_acceptance_server_ce` # -> automatic target: run `make test_acceptance_server_ce` in module # Target: modules/server-ce-scripts/Makefile @@ -338,7 +359,7 @@ ORG_PATH = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUN_LINT_FORMAT ?= \ docker run --rm ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) -NODE_MODULES_PATH := ${PATH}:${PWD}/node_modules/.bin:/app/node_modules/.bin +NODE_MODULES_PATH := ${PATH}:${PWD}/node_modules/.bin:/overleaf/services/web/node_modules/.bin WITH_NODE_MODULES_PATH = \ format_backend \ format_frontend \ @@ -450,7 +471,8 @@ build_deps: --cache-from $(IMAGE_REPO_MASTER)-deps \ --tag $(IMAGE_REPO_BRANCH)-deps \ --target deps \ - . + --file Dockerfile \ + ../.. build_dev: docker build \ @@ -460,7 +482,8 @@ build_dev: --tag $(IMAGE_CI) \ --tag $(IMAGE_CI)-dev \ --target dev \ - . + --file Dockerfile \ + ../.. build_webpack: $(MAKE) build_webpack_once \ @@ -473,7 +496,8 @@ build_webpack_once: --cache-from $(IMAGE_CI)-webpack \ --tag $(IMAGE_CI)-webpack \ --target webpack \ - . + --file Dockerfile \ + ../.. build: docker build \ @@ -481,7 +505,8 @@ build: --cache-from $(IMAGE_CI)-webpack \ --cache-from $(IMAGE_REPO_FINAL) \ --tag $(IMAGE_REPO_FINAL) \ - . + --file Dockerfile \ + ../.. build_test_karma: COMPOSE_PROJECT_NAME=karma_$(BUILD_DIR_NAME) $(DOCKER_COMPOSE) build test_karma diff --git a/services/web/Makefile.module b/services/web/Makefile.module index d4951cf82e..69bb9971d0 100644 --- a/services/web/Makefile.module +++ b/services/web/Makefile.module @@ -3,12 +3,12 @@ MODULE_NAME := $(notdir $(shell pwd)) MODULE_DIR := modules/$(MODULE_NAME) PROJECT_NAME = web -export SHARELATEX_CONFIG = /app/$(MODULE_DIR)/test/acceptance/config/settings.test.js -export BASE_CONFIG ?= /app/test/acceptance/config/settings.test.saas.js +export SHARELATEX_CONFIG = /overleaf/services/web/$(MODULE_DIR)/test/acceptance/config/settings.test.js +export BASE_CONFIG ?= /overleaf/services/web/test/acceptance/config/settings.test.saas.js -CFG_SAAS=/app/test/acceptance/config/settings.test.saas.js -CFG_SERVER_CE=/app/test/acceptance/config/settings.test.server-ce.js -CFG_SERVER_PRO=/app/test/acceptance/config/settings.test.server-pro.js +CFG_SAAS=/overleaf/services/web/test/acceptance/config/settings.test.saas.js +CFG_SERVER_CE=/overleaf/services/web/test/acceptance/config/settings.test.server-ce.js +CFG_SERVER_PRO=/overleaf/services/web/test/acceptance/config/settings.test.server-pro.js DOCKER_COMPOSE_FLAGS ?= -f docker-compose.yml --log-level ERROR DOCKER_COMPOSE := cd ../../ && \ diff --git a/services/web/docker-compose.ci.yml b/services/web/docker-compose.ci.yml index 6cccaaafd7..3878bde522 100644 --- a/services/web/docker-compose.ci.yml +++ b/services/web/docker-compose.ci.yml @@ -18,7 +18,7 @@ services: test_acceptance: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER - working_dir: /app + working_dir: /overleaf/services/web env_file: docker-compose.common.env environment: BASE_CONFIG: @@ -41,7 +41,7 @@ services: PROJECT_NAME: $PROJECT_NAME BRANCH_NAME: $BRANCH_NAME BUILD_NUMBER: $BUILD_NUMBER - working_dir: /app + working_dir: /overleaf/services/web command: npm run test:karma:single user: node environment: diff --git a/services/web/docker-compose.yml b/services/web/docker-compose.yml index 9d6a00072d..995f835ad1 100644 --- a/services/web/docker-compose.yml +++ b/services/web/docker-compose.yml @@ -7,11 +7,12 @@ services: test_unit: build: - context: . + context: ../.. + dockerfile: services/web/Dockerfile target: base volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/web + working_dir: /overleaf/services/web environment: BASE_CONFIG: SHARELATEX_CONFIG: @@ -23,8 +24,8 @@ services: test_acceptance: image: node:14.18.1 volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/web + working_dir: /overleaf/services/web env_file: docker-compose.common.env environment: BASE_CONFIG: @@ -45,22 +46,23 @@ services: test_karma: build: - context: . - dockerfile: Dockerfile.frontend + context: ../.. + dockerfile: services/web/Dockerfile.frontend volumes: - - .:/app + - .:/overleaf/services/web environment: NODE_OPTIONS: "--unhandled-rejections=strict" - working_dir: /app + working_dir: /overleaf/services/web command: npm run --silent test:karma:single test_frontend: build: - context: . + context: ../.. + dockerfile: services/web/Dockerfile target: base volumes: - - .:/app - working_dir: /app + - .:/overleaf/services/web + working_dir: /overleaf/services/web environment: MOCHA_GREP: ${MOCHA_GREP} NODE_OPTIONS: "--unhandled-rejections=strict" diff --git a/services/web/install_deps.sh b/services/web/install_deps.sh index e3db71de6c..7ff6a88e05 100755 --- a/services/web/install_deps.sh +++ b/services/web/install_deps.sh @@ -1,5 +1,5 @@ #!/bin/bash -SHARELATEX_CONFIG=/app/config/settings.webpack.js npm run webpack:production & WEBPACK=$! +SHARELATEX_CONFIG=/overleaf/services/web/config/settings.webpack.js npm run webpack:production & WEBPACK=$! wait $WEBPACK && echo "Webpack complete" || exit 1