mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #18856 from overleaf/jpa-server-ce-shutdown
[server-ce] improve shutdown procedure GitOrigin-RevId: 5a99868d17f597c366e42625cd39f05146dcb682
This commit is contained in:
parent
6980a44f8b
commit
e36de5a62d
8 changed files with 14 additions and 10 deletions
|
@ -12,6 +12,7 @@ class LogLevelChecker {
|
|||
this.checkLogLevel()
|
||||
// re-check log level every minute
|
||||
this.checkInterval = setInterval(this.checkLogLevel.bind(this), 1000 * 60)
|
||||
this.checkInterval.unref()
|
||||
}
|
||||
|
||||
stop() {
|
||||
|
|
|
@ -101,6 +101,7 @@ ENV OPTIMISE_PDF "true"
|
|||
# ----------------------------------------------------------
|
||||
ENV KILL_PROCESS_TIMEOUT 55
|
||||
ENV KILL_ALL_PROCESSES_TIMEOUT 55
|
||||
ENV GRACEFUL_SHUTDOWN_DELAY_SECONDS 1
|
||||
|
||||
ENV NODE_ENV "production"
|
||||
ENV LOG_LEVEL "info"
|
||||
|
|
|
@ -18,9 +18,12 @@ EXIT_CODE="$?"
|
|||
if [ $EXIT_CODE -ne 0 ]
|
||||
then
|
||||
echo "scripts/disconnect_all_users.js failed with exit code $EXIT_CODE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# wait for disconnection
|
||||
sleep 5
|
||||
while ! sv stop real-time-overleaf; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -9,6 +9,7 @@ EXIT_CODE="$?"
|
|||
if [ $EXIT_CODE -ne 0 ]
|
||||
then
|
||||
echo "document-updater/scripts/flush_all.js failed with exit code $EXIT_CODE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -9,6 +9,7 @@ EXIT_CODE="$?"
|
|||
if [ $EXIT_CODE -ne 0 ]
|
||||
then
|
||||
echo "project-history/scripts/flush_all.js failed with exit code $EXIT_CODE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -2,8 +2,6 @@ version: '2.2'
|
|||
services:
|
||||
sharelatex:
|
||||
image: ${IMAGE_TAG_CE:-sharelatex/sharelatex:latest}
|
||||
# TODO(das7pad): increase timeout after speeding up the graceful shutdown procedure
|
||||
# stop_grace_period: 60s
|
||||
stop_grace_period: 0s
|
||||
depends_on:
|
||||
mongo:
|
||||
|
|
|
@ -93,10 +93,6 @@ async function gracefulShutdown(server, signal) {
|
|||
'optionalAfterDrainingConnections',
|
||||
optionalCleanupHandlersAfterDrainingConnections.concat([
|
||||
{ label: 'metrics module', handler: () => Metrics.close() },
|
||||
{
|
||||
label: 'logger module',
|
||||
handler: () => logger.logLevelChecker?.stop(),
|
||||
},
|
||||
])
|
||||
)
|
||||
} catch (err) {
|
||||
|
|
|
@ -19,7 +19,8 @@ async function main() {
|
|||
)
|
||||
process.exit(1)
|
||||
}
|
||||
if (Settings.overleaf && args['confirm-site-url'] !== Settings.siteUrl) {
|
||||
const isSaaS = Boolean(Settings.overleaf)
|
||||
if (isSaaS && args['confirm-site-url'] !== Settings.siteUrl) {
|
||||
console.error()
|
||||
console.error(
|
||||
'Please confirm the environment you want to disconnect ALL USERS from by specifying the site URL aka PUBLIC_URL, e.g. --confirm-site-url=https://www.dev-overleaf.com for the dev-env'
|
||||
|
@ -46,8 +47,10 @@ async function main() {
|
|||
`Disconnect all users from ${args['confirm-site-url']}, with delay ${delay}`
|
||||
)
|
||||
|
||||
if (isSaaS) {
|
||||
console.error(' Use CTRL+C in the next 5s to abort.')
|
||||
await sleep(5 * 1000)
|
||||
}
|
||||
|
||||
await AdminController._sendDisconnectAllUsersMessage(delay)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue