add healthcheck and fix shutdown order

This commit is contained in:
Will Murphy 2022-11-07 21:35:16 -06:00
parent 367ca308d6
commit c38f40158b
2 changed files with 2 additions and 1 deletions

View file

@ -20,4 +20,5 @@ RUN npm run build
# entry # entry
WORKDIR /usr/src/guppe WORKDIR /usr/src/guppe
EXPOSE 443 80 EXPOSE 443 80
HEALTHCHECK CMD /usr/bin/curl --fail http://localhost/ || exit 1
CMD [ "node", "index.js" ] CMD [ "node", "index.js" ]

View file

@ -225,10 +225,10 @@ client.connect()
console.log('Guppe server listening on port ' + PORT_HTTPS) console.log('Guppe server listening on port ' + PORT_HTTPS)
}) })
onShutdown(async () => { onShutdown(async () => {
await client.close()
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
server.close(err => (err ? reject(err) : resolve())) server.close(err => (err ? reject(err) : resolve()))
}) })
await client.close()
console.log('Guppe server closed') console.log('Guppe server closed')
}) })
}) })