Merge pull request #882 from balena-io/fix-healthcheck

Fix healthcheck and container restart
This commit is contained in:
CameronDiver 2019-01-29 16:17:27 +00:00 committed by GitHub
commit a940180bf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

View File

@ -5,6 +5,7 @@ set -o errexit
# Start Avahi to allow MDNS lookups
mkdir -p /var/run/dbus
rm -f /var/run/avahi-daemon/pid
rm -f /var/run/dbus/pid
/etc/init.d/dbus-1 start
/etc/init.d/avahi-daemon start

View File

@ -95,7 +95,6 @@ export class SupervisorAPI {
this.api.disable('x-powered-by');
this.api.use(expressLogger);
this.api.use(authenticate(this.config));
this.api.get('/v1/healthy', async (_req, res) => {
try {
@ -109,6 +108,8 @@ export class SupervisorAPI {
}
});
this.api.use(authenticate(this.config));
this.api.get('/ping', (_req, res) => res.send('OK'));
this.api.post('/v1/blink', (_req, res) => {

View File

@ -37,7 +37,18 @@ module.exports = class Supervisor extends EventEmitter
# FIXME: rearchitect proxyvisor to avoid this circular dependency
# by storing current state and having the APIBinder query and report it / provision devices
@deviceState.applications.proxyvisor.bindToAPI(@apiBinder)
@api = new SupervisorAPI({ @config, @eventTracker, routers: [ @apiBinder.router, @deviceState.router ], healthchecks: [ @apiBinder.healthcheck, @deviceState.healthcheck ] })
@api = new SupervisorAPI({
@config,
@eventTracker,
routers: [
@apiBinder.router,
@deviceState.router
],
healthchecks: [
@apiBinder.healthcheck.bind(@apiBinder),
@deviceState.healthcheck.bind(@deviceState)
]
})
init: =>
@db.init()