Merge pull request #10912 from overleaf/em-remove-mongo-from-spelling

Remove mongo dependency from spelling

GitOrigin-RevId: 1fff65610b7c64537697574ef35d9a7c9f295089
This commit is contained in:
Eric Mc Sween 2022-12-15 11:06:18 -05:00 committed by Copybot
parent 1f566c3556
commit bcf20abbc2
8 changed files with 8 additions and 55 deletions

2
package-lock.json generated
View file

@ -37863,7 +37863,6 @@
"bunyan": "^1.8.15",
"express": "^4.17.1",
"lru-cache": "^5.1.1",
"mongodb": "^3.6.0",
"request": "^2.88.2",
"underscore": "1.13.1"
},
@ -48170,7 +48169,6 @@
"express": "^4.17.1",
"lru-cache": "^5.1.1",
"mocha": "^8.4.0",
"mongodb": "^3.6.0",
"request": "^2.88.2",
"sandboxed-module": "2.0.4",
"sinon": "^9.2.4",

View file

@ -1,6 +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
# https://github.com/overleaf/internal/
FROM node:16.17.1 as base
@ -24,7 +24,7 @@ COPY services/spelling/ /overleaf/services/spelling/
FROM app
RUN mkdir -p cache \
&& chown node:node cache
&& chown node:node cache
USER node
CMD ["node", "--expose-gc", "app.js"]

View file

@ -1,6 +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
# https://github.com/overleaf/internal/
BUILD_NUMBER ?= local
BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
@ -83,6 +83,9 @@ ifneq (,$(wildcard test/acceptance/js/scripts/pre-run))
$(DOCKER_COMPOSE_TEST_ACCEPTANCE) run --rm test_acceptance test/acceptance/js/scripts/pre-run
endif
benchmarks:
$(DOCKER_COMPOSE_TEST_ACCEPTANCE) run --rm test_acceptance npm run benchmarks
build:
docker pull gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-deps \
|| docker pull gcr.io/overleaf-ops/$(PROJECT_NAME):main-deps \
@ -110,4 +113,4 @@ publish:
docker push $(DOCKER_REPO)/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
.PHONY: clean test test_unit test_acceptance test_clean build publish
.PHONY: clean test test_unit test_acceptance test_clean benchmarks build publish

View file

@ -1,28 +0,0 @@
const Settings = require('@overleaf/settings')
const { MongoClient, ObjectId } = require('mongodb')
const clientPromise = MongoClient.connect(
Settings.mongo.url,
Settings.mongo.options
)
let setupDbPromise
async function waitForDb() {
if (!setupDbPromise) {
setupDbPromise = setupDb()
}
await setupDbPromise
}
const db = {}
async function setupDb() {
const internalDb = (await clientPromise).db()
db.spellingPreferences = internalDb.collection('spellingPreferences')
}
module.exports = {
db,
ObjectId,
waitForDb,
}

View file

@ -1,6 +1,6 @@
spelling
--data-dirs=cache
--dependencies=mongo
--dependencies=
--docker-repos=gcr.io/overleaf-ops
--env-add=
--env-pass-through=

View file

@ -27,9 +27,6 @@ services:
MOCHA_GREP: ${MOCHA_GREP}
NODE_ENV: test
NODE_OPTIONS: "--unhandled-rejections=strict"
depends_on:
mongo:
condition: service_healthy
user: node
command: npm run test:acceptance:_run
@ -41,9 +38,3 @@ services:
- ./:/tmp/build/
command: tar -czf /tmp/build/build.tar.gz --exclude=build.tar.gz --exclude-vcs .
user: root
mongo:
image: mongo:4.4.16
healthcheck:
test: "mongo --quiet localhost/test --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 1)'"
interval: 1s
retries: 20

View file

@ -44,15 +44,5 @@ services:
NODE_ENV: test
NODE_OPTIONS: "--unhandled-rejections=strict"
user: node
depends_on:
mongo:
condition: service_healthy
command: npm run --silent test:acceptance
mongo:
image: mongo:4.4.16
healthcheck:
test: "mongo --quiet localhost/test --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 1)'"
interval: 1s
retries: 20

View file

@ -31,7 +31,6 @@
"bunyan": "^1.8.15",
"express": "^4.17.1",
"lru-cache": "^5.1.1",
"mongodb": "^3.6.0",
"request": "^2.88.2",
"underscore": "1.13.1"
},