Skip to content

Commit 7a5d683

Browse files
committed
Add healthcheck script for ECS container health checks
This calls the Rails /up endpoint to verify the application is running. Also, use this new healthcheck script in the review app task definition
1 parent 0729bc4 commit 7a5d683

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.review_apps/ecs_task_definition.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ resource "aws_ecs_task_definition" "task" {
107107
}
108108

109109
healthCheck = {
110-
command = ["CMD-SHELL", "wget -O - 'http://localhost:3001/up' || exit 1"]
110+
command = ["CMD", "/app/bin/healthcheck"]
111111
interval = 30
112112
retries = 5
113113
startPeriod = 180

bin/healthcheck

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
# Healthcheck script for ECS container health checks.
4+
# Makes a request to the Rails health endpoint and exits with appropriate code.
5+
6+
wget --quiet --tries=1 --spider "http://localhost:${PORT:-3000}/up" || exit 1

0 commit comments

Comments
 (0)