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
|
||||
WORKDIR /usr/src/guppe
|
||||
EXPOSE 443 80
|
||||
HEALTHCHECK CMD /usr/bin/curl --fail http://localhost/ || exit 1
|
||||
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)
|
||||
})
|
||||
onShutdown(async () => {
|
||||
await client.close()
|
||||
await new Promise((resolve, reject) => {
|
||||
server.close(err => (err ? reject(err) : resolve()))
|
||||
})
|
||||
await client.close()
|
||||
console.log('Guppe server closed')
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue