Skip to content

Commit ab7ac63

Browse files
committed
Add healthcheck endpoint
1 parent 6707c49 commit ab7ac63

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,17 @@ Fetch list of nearby Wi-Fi networks for passing to the connect endpoint.
113113
// links by calling the list_access_points endpoint again. Useful for
114114
// enabling or disabling a refresh button on an interface.
115115
}
116+
````
117+
118+
### http://your-device:9090/v1/healthcheck
119+
Check whether the API is available. Accessing this path will not record anything in the console.
120+
121+
#### GET
122+
123+
#### Response status 200
124+
Requests are returned immediately and then the process is executed. Otherwise users would be disconnected before they were able to receive the returned response.
125+
````
126+
{
127+
"message": "ok"
128+
}
116129
````

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ services:
1111
build:
1212
context: .
1313
dockerfile: Dockerfile.template
14-
restart: always
1514
network_mode: "host"
15+
restart: always
1616
labels:
1717
io.balena.features.dbus: '1'
1818
cap_add:

src/resources/system_routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# Function for disabling logging on '/'
99
def log_request(self, *args, **kwargs):
10-
if self.path == '/':
10+
if self.path == '/healthcheck':
1111
return
1212

1313
parent_log_request(self, *args, **kwargs)

src/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def handle_sigterm(*args):
5858
# Configure endpoints #
5959

6060
# Health check
61-
api.add_resource(system_health_check, '/')
61+
api.add_resource(system_health_check, '/healthcheck')
6262

6363
# Wi-Fi
6464
api.add_resource(wifi_connect, '/v1/connect')

0 commit comments

Comments
 (0)