-
Notifications
You must be signed in to change notification settings - Fork 27
Implement health check for the index application #254
Copy link
Copy link
Closed
Labels
Continuous IntegrationWorkflows and AutomationWorkflows and Automation
Description
In the composer.yaml file, we have the definition for the backend service. The healthcheck still needs to be implemented.
# todo: implement healthcheck
#healthcheck:
# test:
# [
# "CMD-SHELL",
# "cargo run healthcheck"
# ]
# interval: 10s
# retries: 5
# start_period: 10s
# timeout: 3sFor that reason, workflows take longer than they should. In the script to run E2E tests, we wait 20 seconds instead of waiting only until the container is healthy.
wait_for_container_to_be_healthy torrust-mysql-1 10 3
# todo: implement healthchecks for tracker and backend and wait until they are healthy
#wait_for_container torrust-tracker-1 10 3
#wait_for_container torrust-idx-back-1 10 3
sleep 20sProposal 1
Add a new endpoint tho the API: GET /status that should return a 200 code is the app is ready to process requests. It could contains a json body with more verbose report like:
{
"status": "Ok",
"database": "Ok",
"tracker": "Ok"
}When something is wrong could return something like:
{
"status": "Error",
"error": "Cannot connect to database",
}We can define this later. For now we just check that return a 200 code.
The healthcheck could be something like
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3030/health"]
interval: 30s
timeout: 10s
retries: 3Links
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Continuous IntegrationWorkflows and AutomationWorkflows and Automation
Type
Projects
Status
No status