mirror of
https://github.com/fcwu/docker-ubuntu-vnc-desktop
synced 2025-12-06 16:32:47 +01:00
feat: add Docker HEALTHCHECK (issue #69)
This commit is contained in:
parent
ba3e2c2595
commit
e2d659d992
3 changed files with 9 additions and 3 deletions
|
|
@ -90,4 +90,5 @@ EXPOSE 80
|
|||
WORKDIR /root
|
||||
ENV HOME=/home/ubuntu \
|
||||
SHELL=/bin/bash
|
||||
HEALTHCHECK --interval=30s --timeout=5s CMD curl --fail http://127.0.0.1/api/health
|
||||
ENTRYPOINT ["/startup.sh"]
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ from flask import (
|
|||
request,
|
||||
Response,
|
||||
jsonify,
|
||||
abort,
|
||||
)
|
||||
from gevent import subprocess as gsp, spawn, sleep
|
||||
from geventwebsocket.exceptions import WebSocketError
|
||||
|
|
@ -35,6 +36,13 @@ def apistate():
|
|||
})
|
||||
|
||||
|
||||
@app.route('/api/health')
|
||||
def apihealth():
|
||||
if state.health:
|
||||
return 'success'
|
||||
abort(503, 'unhealthy')
|
||||
|
||||
|
||||
@app.route('/api/reset')
|
||||
def reset():
|
||||
if 'w' in request.args and 'h' in request.args:
|
||||
|
|
|
|||
|
|
@ -27,9 +27,6 @@ class State(object):
|
|||
self._event.set()
|
||||
|
||||
def _update_health(self):
|
||||
if self._health:
|
||||
return
|
||||
|
||||
health = True
|
||||
output = gsp.check_output(['supervisorctl', 'status'])
|
||||
for line in output.strip().split('\n'):
|
||||
|
|
|
|||
Loading…
Reference in a new issue