add healthcheck and fix shutdown order
This commit is contained in:
parent
367ca308d6
commit
c38f40158b
2 changed files with 2 additions and 1 deletions
|
@ -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" ]
|
||||||
|
|
2
index.js
2
index.js
|
@ -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')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue