diff --git a/entry.sh b/entry.sh index b051a72b..4ba9baa8 100755 --- a/entry.sh +++ b/entry.sh @@ -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 diff --git a/src/supervisor-api.ts b/src/supervisor-api.ts index 5f2f1cf5..76f8d2f8 100644 --- a/src/supervisor-api.ts +++ b/src/supervisor-api.ts @@ -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) => { diff --git a/src/supervisor.coffee b/src/supervisor.coffee index 544e24d3..4efde59b 100644 --- a/src/supervisor.coffee +++ b/src/supervisor.coffee @@ -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()