Merge pull request #16058 from overleaf/jpa-faster-restart

[misc] faster service shutdown in dev-env

GitOrigin-RevId: c5589844aefe3ca097756b188e02354ab518b94d
This commit is contained in:
Mathias Jakobsen 2023-12-07 10:05:50 +00:00 committed by Copybot
parent a722ca9483
commit 4763cfd59e
39 changed files with 73 additions and 70 deletions

View file

@ -1,8 +1,8 @@
services:
clsi:
command: ["npm", "run", "nodemon"]
command: ["node", "--watch", "app.js"]
environment:
- NODE_APP_OPTIONS=--inspect=0.0.0.0:9229
- NODE_OPTIONS=--inspect=0.0.0.0:9229
ports:
- "127.0.0.1:9230:9229"
volumes:
@ -11,9 +11,9 @@ services:
- ../services/clsi/config:/overleaf/services/clsi/config
chat:
command: ["npm", "run", "nodemon"]
command: ["node", "--watch", "app.js"]
environment:
- NODE_APP_OPTIONS=--inspect=0.0.0.0:9229
- NODE_OPTIONS=--inspect=0.0.0.0:9229
ports:
- "127.0.0.1:9231:9229"
volumes:
@ -22,9 +22,9 @@ services:
- ../services/chat/config:/overleaf/services/chat/config
contacts:
command: ["npm", "run", "nodemon"]
command: ["node", "--watch", "app.js"]
environment:
- NODE_APP_OPTIONS=--inspect=0.0.0.0:9229
- NODE_OPTIONS=--inspect=0.0.0.0:9229
ports:
- "127.0.0.1:9232:9229"
volumes:
@ -33,9 +33,9 @@ services:
- ../services/contacts/config:/overleaf/services/contacts/config
docstore:
command: ["npm", "run", "nodemon"]
command: ["node", "--watch", "app.js"]
environment:
- NODE_APP_OPTIONS=--inspect=0.0.0.0:9229
- NODE_OPTIONS=--inspect=0.0.0.0:9229
ports:
- "127.0.0.1:9233:9229"
volumes:
@ -44,9 +44,9 @@ services:
- ../services/docstore/config:/overleaf/services/docstore/config
document-updater:
command: ["npm", "run", "nodemon"]
command: ["node", "--watch", "app.js"]
environment:
- NODE_APP_OPTIONS=--inspect=0.0.0.0:9229
- NODE_OPTIONS=--inspect=0.0.0.0:9229
ports:
- "127.0.0.1:9234:9229"
volumes:
@ -55,9 +55,9 @@ services:
- ../services/document-updater/config:/overleaf/services/document-updater/config
filestore:
command: ["npm", "run", "nodemon"]
command: ["node", "--watch", "app.js"]
environment:
- NODE_APP_OPTIONS=--inspect=0.0.0.0:9229
- NODE_OPTIONS=--inspect=0.0.0.0:9229
ports:
- "127.0.0.1:9235:9229"
volumes:
@ -66,9 +66,9 @@ services:
- ../services/filestore/config:/overleaf/services/filestore/config
history-v1:
command: [ "npm", "run", "nodemon" ]
command: ["node", "--watch", "app.js"]
environment:
- NODE_APP_OPTIONS=--inspect=0.0.0.0:9229
- NODE_OPTIONS=--inspect=0.0.0.0:9229
ports:
- "127.0.0.1:9239:9229"
volumes:
@ -80,9 +80,9 @@ services:
- ../services/history-v1/migrations:/overleaf/services/history-v1/migrations
notifications:
command: ["npm", "run", "nodemon"]
command: ["node", "--watch", "app.js"]
environment:
- NODE_APP_OPTIONS=--inspect=0.0.0.0:9229
- NODE_OPTIONS=--inspect=0.0.0.0:9229
ports:
- "127.0.0.1:9236:9229"
volumes:
@ -91,9 +91,9 @@ services:
- ../services/notifications/config:/overleaf/services/notifications/config
project-history:
command: [ "npm", "run", "nodemon" ]
command: ["node", "--watch", "app.js"]
environment:
- NODE_APP_OPTIONS=--inspect=0.0.0.0:9229
- NODE_OPTIONS=--inspect=0.0.0.0:9229
ports:
- "127.0.0.1:9240:9229"
volumes:
@ -102,9 +102,9 @@ services:
- ../services/project-history/config:/overleaf/services/project-history/config
real-time:
command: ["npm", "run", "nodemon"]
command: ["node", "--watch", "app.js"]
environment:
- NODE_APP_OPTIONS=--inspect=0.0.0.0:9229
- NODE_OPTIONS=--inspect=0.0.0.0:9229
ports:
- "127.0.0.1:9237:9229"
volumes:
@ -113,9 +113,9 @@ services:
- ../services/real-time/config:/overleaf/services/real-time/config
web:
command: ["npm", "run", "nodemon"]
command: ["node", "--watch", "app.js", "--watch-locales"]
environment:
- NODE_APP_OPTIONS=--inspect=0.0.0.0:9229
- NODE_OPTIONS=--inspect=0.0.0.0:9229
ports:
- "127.0.0.1:9229:9229"
volumes:

View file

@ -7,4 +7,4 @@ access-token-encryptor
--is-library=True
--node-version=18.18.2
--public-repo=False
--script-version=4.4.0
--script-version=4.5.0

View file

@ -7,4 +7,4 @@ fetch-utils
--is-library=True
--node-version=18.18.2
--public-repo=False
--script-version=4.4.0
--script-version=4.5.0

View file

@ -7,4 +7,4 @@ logger
--is-library=True
--node-version=18.18.2
--public-repo=False
--script-version=4.4.0
--script-version=4.5.0

View file

@ -7,4 +7,4 @@ metrics
--is-library=True
--node-version=18.18.2
--public-repo=False
--script-version=4.4.0
--script-version=4.5.0

View file

@ -7,4 +7,4 @@ o-error
--is-library=True
--node-version=18.18.2
--public-repo=False
--script-version=4.4.0
--script-version=4.5.0

View file

@ -7,4 +7,4 @@ object-persistor
--is-library=True
--node-version=18.18.2
--public-repo=False
--script-version=4.4.0
--script-version=4.5.0

View file

@ -7,4 +7,4 @@ overleaf-editor-core
--is-library=True
--node-version=18.18.2
--public-repo=False
--script-version=4.4.0
--script-version=4.5.0

View file

@ -7,4 +7,4 @@ promise-utils
--is-library=True
--node-version=18.18.2
--public-repo=False
--script-version=4.4.0
--script-version=4.5.0

View file

@ -7,4 +7,4 @@ ranges-tracker
--is-library=True
--node-version=18.18.2
--public-repo=False
--script-version=4.4.0
--script-version=4.5.0

View file

@ -7,4 +7,4 @@ redis-wrapper
--is-library=True
--node-version=18.18.2
--public-repo=False
--script-version=4.4.0
--script-version=4.5.0

View file

@ -7,4 +7,4 @@ settings
--is-library=True
--node-version=18.18.2
--public-repo=False
--script-version=4.4.0
--script-version=4.5.0

View file

@ -7,4 +7,4 @@ stream-utils
--is-library=True
--node-version=18.18.2
--public-repo=False
--script-version=4.4.0
--script-version=4.5.0

View file

@ -6,4 +6,4 @@ chat
--esmock-loader=False
--node-version=18.18.2
--public-repo=False
--script-version=4.4.0
--script-version=4.5.0

View file

@ -5,10 +5,10 @@
"main": "app.js",
"type": "module",
"scripts": {
"start": "node $NODE_APP_OPTIONS app.js",
"start": "node app.js",
"test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
"nodemon": "node --watch $NODE_APP_OPTIONS app.js",
"nodemon": "node --watch 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",
"lint": "eslint --max-warnings 0 --format unix .",

View file

@ -8,4 +8,4 @@ clsi
--has-custom-cloudbuild=True
--node-version=18.18.2
--public-repo=True
--script-version=4.4.0
--script-version=4.5.0

View file

@ -4,12 +4,12 @@
"private": true,
"main": "app.js",
"scripts": {
"start": "node $NODE_APP_OPTIONS app.js",
"start": "node app.js",
"test:acceptance:_run": "mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
"test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:unit:_run": "mocha --recursive --reporter spec $@ test/unit/js",
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
"nodemon": "node --watch $NODE_APP_OPTIONS app.js",
"nodemon": "node --watch app.js",
"lint": "eslint --max-warnings 0 --format unix .",
"format": "prettier --list-different $PWD/'**/*.js'",
"format:fix": "prettier --write $PWD/'**/*.js'",

View file

@ -6,4 +6,4 @@ contacts
--esmock-loader=True
--node-version=18.18.2
--public-repo=False
--script-version=4.4.0
--script-version=4.5.0

View file

@ -5,12 +5,12 @@
"type": "module",
"main": "app.js",
"scripts": {
"start": "node $NODE_APP_OPTIONS app.js",
"start": "node app.js",
"test:acceptance:_run": "LOG_LEVEL=fatal mocha --loader=esmock --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
"test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:unit:_run": "LOG_LEVEL=fatal mocha --loader=esmock --recursive --reporter spec $@ test/unit/js",
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
"nodemon": "node --watch $NODE_APP_OPTIONS app.js",
"nodemon": "node --watch app.js",
"lint": "eslint --max-warnings 0 --format unix .",
"format": "prettier --list-different $PWD/'**/*.js'",
"format:fix": "prettier --write $PWD/'**/*.js'",

View file

@ -6,4 +6,4 @@ docstore
--esmock-loader=False
--node-version=18.18.2
--public-repo=True
--script-version=4.4.0
--script-version=4.5.0

View file

@ -4,12 +4,12 @@
"private": true,
"main": "app.js",
"scripts": {
"start": "node $NODE_APP_OPTIONS app.js",
"start": "node app.js",
"test:acceptance:_run": "mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
"test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:unit:_run": "mocha --recursive --reporter spec $@ test/unit/js",
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
"nodemon": "node --watch $NODE_APP_OPTIONS app.js",
"nodemon": "node --watch app.js",
"lint": "eslint --max-warnings 0 --format unix .",
"format": "prettier --list-different $PWD/'**/*.js'",
"format:fix": "prettier --write $PWD/'**/*.js'",

View file

@ -217,7 +217,7 @@ const shutdownCleanly = signal => () => {
setTimeout(() => {
logger.info({ signal }, 'shutting down')
process.exit()
}, 10000)
}, Settings.delayShutdownMs)
}
const watchForEvent = eventName => {

View file

@ -6,4 +6,4 @@ document-updater
--esmock-loader=False
--node-version=18.18.2
--public-repo=True
--script-version=4.4.0
--script-version=4.5.0

View file

@ -166,4 +166,5 @@ module.exports = {
continuousBackgroundFlush: process.env.CONTINUOUS_BACKGROUND_FLUSH === 'true',
smoothingOffset: process.env.SMOOTHING_OFFSET || 1000, // milliseconds
delayShutdownMs: parseInt(process.env.DELAY_SHUTDOWN_MS || '10000', 10),
}

View file

@ -4,13 +4,13 @@
"private": true,
"main": "app.js",
"scripts": {
"start": "node $NODE_APP_OPTIONS app.js",
"start": "node app.js",
"test:acceptance:_run": "mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
"test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:unit:_run": "mocha --recursive --reporter spec $@ test/unit/js",
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
"nodemon": "node --watch app.js",
"benchmark:apply": "node benchmarks/apply",
"nodemon": "node --watch $NODE_APP_OPTIONS app.js",
"lint": "eslint --max-warnings 0 --format unix .",
"format": "prettier --list-different $PWD/'**/*.js'",
"format:fix": "prettier --write $PWD/'**/*.js'",

View file

@ -7,4 +7,4 @@ filestore
--esmock-loader=False
--node-version=18.18.2
--public-repo=True
--script-version=4.4.0
--script-version=4.5.0

View file

@ -8,8 +8,8 @@
"test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:unit:run": "mocha --recursive --reporter spec $@ test/unit/js",
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
"start": "node $NODE_APP_OPTIONS app.js",
"nodemon": "node --watch $NODE_APP_OPTIONS app.js",
"start": "node app.js",
"nodemon": "node --watch app.js",
"lint": "eslint --max-warnings 0 --format unix .",
"format": "prettier --list-different $PWD/'**/*.js'",
"format:fix": "prettier --write $PWD/'**/*.js'",

View file

@ -6,4 +6,4 @@ history-v1
--esmock-loader=False
--node-version=18.18.2
--public-repo=False
--script-version=4.4.0
--script-version=4.5.0

View file

@ -49,7 +49,7 @@
"yauzl": "^2.9.1"
},
"scripts": {
"start": "node $NODE_APP_OPTIONS app.js",
"start": "node app.js",
"lint": "eslint --max-warnings 0 --format unix .",
"lint:fix": "eslint --fix .",
"format": "prettier --list-different $PWD/'**/*.js'",
@ -58,7 +58,7 @@
"test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:unit:_run": "mocha --recursive --reporter spec $@ test/unit/js",
"test:acceptance:_run": "mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
"nodemon": "node --watch $NODE_APP_OPTIONS app.js",
"nodemon": "node --watch app.js",
"migrate": "knex migrate:latest",
"delete_old_chunks": "node storage/tasks/delete_old_chunks.js",
"fix_duplicate_versions": "node storage/tasks/fix_duplicate_versions.js",

View file

@ -6,4 +6,4 @@ notifications
--esmock-loader=False
--node-version=18.18.2
--public-repo=True
--script-version=4.4.0
--script-version=4.5.0

View file

@ -4,12 +4,12 @@
"private": true,
"main": "app.js",
"scripts": {
"start": "node $NODE_APP_OPTIONS app.js",
"start": "node app.js",
"test:acceptance:_run": "mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
"test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:unit:_run": "mocha --recursive --reporter spec $@ test/unit/js",
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
"nodemon": "node --watch $NODE_APP_OPTIONS app.js",
"nodemon": "node --watch app.js",
"lint": "eslint --max-warnings 0 --format unix .",
"format": "prettier --list-different $PWD/'**/*.js'",
"format:fix": "prettier --write $PWD/'**/*.js'",

View file

@ -6,4 +6,4 @@ project-history
--esmock-loader=True
--node-version=18.18.2
--public-repo=False
--script-version=4.4.0
--script-version=4.5.0

View file

@ -7,8 +7,8 @@
"scripts": {
"test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
"start": "node $NODE_APP_OPTIONS app.js",
"nodemon": "node --watch $NODE_APP_OPTIONS app.js",
"start": "node app.js",
"nodemon": "node --watch app.js",
"test:acceptance:_run": "LOG_LEVEL=fatal mocha --loader=esmock --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
"test:unit:_run": "LOG_LEVEL=fatal mocha --loader=esmock --recursive --reporter spec $@ test/unit/js",
"lint": "eslint --max-warnings 0 --format unix .",

View file

@ -6,4 +6,4 @@ real-time
--esmock-loader=False
--node-version=18.18.2
--public-repo=False
--script-version=4.4.0
--script-version=4.5.0

View file

@ -4,12 +4,12 @@
"private": true,
"main": "app.js",
"scripts": {
"start": "node $NODE_APP_OPTIONS app.js",
"start": "node app.js",
"test:acceptance:_run": "mocha --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
"test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:unit:_run": "mocha --recursive --reporter spec $@ test/unit/js",
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
"nodemon": "node --watch $NODE_APP_OPTIONS app.js",
"nodemon": "node --watch app.js",
"lint": "eslint --max-warnings 0 --format unix .",
"format": "prettier --list-different $PWD/'**/*.js'",
"format:fix": "prettier --write $PWD/'**/*.js'",

View file

@ -5,6 +5,7 @@ import Settings from '@overleaf/settings'
import logger from '@overleaf/logger'
import { app } from './app/js/server.js'
import * as ASpell from './app/js/ASpell.js'
import Metrics from '@overleaf/metrics'
const { host = 'localhost', port = 3005 } = Settings.internal?.spelling ?? {}
@ -21,5 +22,6 @@ process.on('SIGTERM', () => {
ASpell.stopCacheDump()
server.close(() => {
logger.info({ host, port }, 'spelling HTTP server closed')
Metrics.close()
})
})

View file

@ -7,4 +7,4 @@ spelling
--esmock-loader=True
--node-version=18.18.2-buster
--public-repo=False
--script-version=4.4.0
--script-version=4.5.0

View file

@ -6,7 +6,7 @@
"type": "module",
"scripts": {
"compile:app": "([ -e app/coffee ] && coffee -m $COFFEE_OPTIONS -o app/js -c app/coffee || echo 'No CoffeeScript folder to compile') && ( [ -e app.coffee ] && coffee -m $COFFEE_OPTIONS -c app.coffee || echo 'No CoffeeScript app to compile')",
"start": "node $NODE_APP_OPTIONS app.js",
"start": "node app.js",
"test:acceptance:_run": "LOG_LEVEL=fatal mocha --loader=esmock --recursive --reporter spec --timeout 15000 --exit $@ test/acceptance/js",
"test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:unit:_run": "LOG_LEVEL=fatal mocha --loader=esmock --recursive --reporter spec $@ test/unit/js",
@ -14,7 +14,7 @@
"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:all": "npm run compile:app && npm run compile:unit_tests && npm run compile:acceptance_tests && npm run compile:smoke_tests",
"nodemon": "node --watch $NODE_APP_OPTIONS app.js",
"nodemon": "node --watch app.js",
"compile:smoke_tests": "[ ! -e test/smoke/coffee ] && echo 'No smoke tests to compile' || coffee -o test/smoke/js -c test/smoke/coffee",
"lint": "eslint --max-warnings 0 --format unix .",
"format": "prettier --list-different $PWD/'**/*.js'",

View file

@ -15,8 +15,8 @@
"test:unit:app": "npm run test:unit:run_dir -- test/unit/src",
"test:frontend": "NODE_ENV=test TZ=GMT mocha --recursive --timeout 5000 --exit --extension js,jsx,mjs,ts,tsx --grep=$MOCHA_GREP --require test/frontend/bootstrap.js --ignore '**/*.spec.{js,jsx,ts,tsx}' test/frontend modules/*/test/frontend",
"test:frontend:coverage": "c8 --all --include 'frontend/js' --include 'modules/*/frontend/js' --exclude 'frontend/js/vendor' --reporter=lcov --reporter=text-summary npm run test:frontend",
"start": "node $NODE_APP_OPTIONS app.js",
"nodemon": "node --watch $NODE_APP_OPTIONS app.js --watch-locales",
"start": "node app.js",
"nodemon": "node --watch app.js --watch-locales",
"webpack": "webpack serve --config webpack.config.dev.js",
"webpack:production": "webpack --config webpack.config.prod.js",
"webpack:profile": "webpack --config webpack.config.prod.js --profile --json > stats.json",