Skip to content

Commit f2781c8

Browse files
committed
Healthcheck
1 parent 70f047d commit f2781c8

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ RUN \
2020
addgroup --system gleam_packages && \
2121
adduser --system gleam_packages -g gleam_packages
2222
COPY --from=build /app/build/erlang-shipment /app
23+
COPY healthcheck.sh /app/healthcheck.sh
2324
VOLUME /app/data
2425
LABEL org.opencontainers.image.source=https://github.com/gleam-lang/packages
2526
LABEL org.opencontainers.image.description="Gleam Packages web application"

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ Environment=DATABASE_PATH=/storage
4747
# Provide the secrets
4848
EnvironmentFile=/srv/packages-environment
4949

50+
# Restart the service if the homepage no longer loads
51+
HealthCmd=sh -c /app/healthcheck.sh
52+
HealthInterval=30s
53+
HealthTimeout=5s
54+
HealthRetries=3
55+
HealthOnFailure=restart
56+
5057
[Install]
5158
WantedBy=multi-user.target default.target
5259
```

healthcheck.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
exec wget --spider --quiet "http://127.0.0.1:3000?search=healthcheck"

0 commit comments

Comments
 (0)