mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-03-23 04:25:24 +00:00
Switch to monitoring if the host is reachable via tcp, rather than a using a full http request.
This commit is contained in:
parent
a97cd40b44
commit
c29e0720c6
@ -17,7 +17,7 @@
|
||||
"knex": "~0.7.3",
|
||||
"lodash": "^3.0.0",
|
||||
"mixpanel": "0.0.20",
|
||||
"network-checker": "~0.0.2",
|
||||
"network-checker": "~0.0.3",
|
||||
"ngrok": "~0.1.97",
|
||||
"pinejs-client": "^1.2.0",
|
||||
"pubnub": "~3.6.4",
|
||||
|
@ -24,8 +24,6 @@ module.exports = config =
|
||||
appUpdatePollInterval: checkInt(process.env.APPLICATION_UPDATE_POLL_INTERVAL) ? 60000
|
||||
successMessage: 'SUPERVISOR OK'
|
||||
|
||||
config.heartbeatEndpoint = config.apiEndpoint + '/ping'
|
||||
|
||||
config.supervisorContainer =
|
||||
Volumes:
|
||||
'/boot/config.json': {}
|
||||
|
@ -5,6 +5,7 @@ config = require './config'
|
||||
mixpanel = require 'mixpanel'
|
||||
networkCheck = require 'network-checker'
|
||||
blink = require('blinking')(config.ledFile)
|
||||
url = require 'url'
|
||||
|
||||
utils = exports
|
||||
|
||||
@ -64,9 +65,12 @@ networkPattern =
|
||||
pause: 1000
|
||||
|
||||
exports.blink = blink
|
||||
|
||||
exports.connectivityCheck = _.once ->
|
||||
networkCheck.monitorURL
|
||||
url: config.heartbeatEndpoint
|
||||
parsedUrl = url.parse(config.apiEndpoint)
|
||||
networkCheck.monitorHost
|
||||
host: parsedUrl.hostname
|
||||
port: parsedUrl.port ? (if parsedUrl.protocol is 'https:' then 443 else 80)
|
||||
interval: 10 * 1000
|
||||
(connected) ->
|
||||
if connected
|
||||
|
Loading…
x
Reference in New Issue
Block a user