File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ x-influxdb-api-key: &influxdb-api-key .env.influxdb
1414x-influxdb-client-env :
1515 &influxdb-client-env
1616 INFLUX_BUCKET : ${INFLUX_BUCKET:-place}
17- INFLUX_HOST : ${INFLUX_HOST:-http://influxdb:9999 }
17+ INFLUX_HOST : ${INFLUX_HOST:-http://influxdb:8086 }
1818 INFLUX_ORG : ${INFLUX_ORG:-PlaceOS}
1919
2020x-mqtt-client-env :
Original file line number Diff line number Diff line change 1+ require " http/client"
12require " ./application"
23
34require " placeos-models/version"
@@ -30,6 +31,9 @@ module PlaceOS::Source::Api
3031 Promise .defer {
3132 check_resource?(" postgres" ) { pg_healthcheck }
3233 },
34+ Promise .defer {
35+ check_resource?(" influx" ) { influx_healthcheck }
36+ },
3337 ).then(& .all?).get
3438 end
3539
@@ -66,6 +70,22 @@ module PlaceOS::Source::Api
6670 end
6771 end
6872
73+ def self.influx_healthcheck : Bool
74+ influx_host = INFLUX_HOST
75+ return false if influx_host.nil?
76+
77+ begin
78+ HTTP ::Client .new(URI .parse(influx_host)) do |client |
79+ client.connect_timeout = 5 .seconds
80+ client.read_timeout = 5 .seconds
81+ response = client.get(" /health" )
82+ response.status_code == 200
83+ end
84+ rescue
85+ false
86+ end
87+ end
88+
6989 private class_getter redis : Redis do
7090 StatusEvents .new_redis
7191 end
You can’t perform that action at this time.
0 commit comments