Skip to content

Commit e6f13b1

Browse files
authored
♻️🎨Dockerfile: fix start period/start interval healthchecks (#7557)
1 parent e0f204c commit e6f13b1

File tree

33 files changed

+138
-72
lines changed

33 files changed

+138
-72
lines changed

scripts/docker/healthcheck_curl_host.py

100644100755
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
COPY --chown=scu:scu docker/healthcheck.py docker/healthcheck.py
77
HEALTHCHECK --interval=30s \
88
--timeout=30s \
9-
--start-period=1s \
9+
--start-period=20s \
10+
--start-interval=1s \
1011
--retries=3 \
1112
CMD python3 docker/healthcheck.py http://localhost:8080/v0/
1213
```

services/agent/Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,13 @@ COPY --chown=scu:scu services/agent/docker services/agent/docker
148148
RUN chmod +x services/agent/docker/*.sh
149149

150150

151-
HEALTHCHECK --interval=30s \
152-
--timeout=20s \
153-
--start-period=30s \
154-
--retries=3 \
151+
# https://docs.docker.com/reference/dockerfile/#healthcheck
152+
HEALTHCHECK \
153+
--interval=10s \
154+
--timeout=5s \
155+
--start-period=20s \
156+
--start-interval=1s \
157+
--retries=5 \
155158
CMD ["python3", "services/agent/docker/healthcheck.py", "http://localhost:8000/health"]
156159

157160
EXPOSE 8000

services/agent/docker/healthcheck.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
COPY --chown=scu:scu docker/healthcheck.py docker/healthcheck.py
77
HEALTHCHECK --interval=30s \
88
--timeout=30s \
9-
--start-period=1s \
9+
--start-period=20s \
10+
--start-interval=1s \
1011
--retries=3 \
1112
CMD python3 docker/healthcheck.py http://localhost:8000/
1213
```
@@ -15,6 +16,7 @@
1516
1. why not to use curl instead of a python script?
1617
- SEE https://blog.sixeyed.com/docker-healthchecks-why-not-to-use-curl-or-iwr/
1718
"""
19+
1820
import os
1921
import sys
2022
from urllib.request import urlopen

services/api-server/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ RUN chmod +x services/api-server/docker/*.sh
143143

144144
HEALTHCHECK --interval=10s \
145145
--timeout=5s \
146-
--start-period=5s \
146+
--start-period=20s \
147+
--start-interval=1s \
147148
--retries=5 \
148149
CMD ["python3", "services/api-server/docker/healthcheck.py", "http://localhost:8000/"]
149150

services/api-server/docker/healthcheck.py

100644100755
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
COPY --chown=scu:scu docker/healthcheck.py docker/healthcheck.py
77
HEALTHCHECK --interval=30s \
88
--timeout=30s \
9-
--start-period=1s \
9+
--start-period=20s \
10+
--start-interval=1s \
1011
--retries=3 \
11-
CMD python3 docker/healthcheck.py http://localhost:8000/
12+
CMD python3 docker/healthcheck.py http://localhost:8080/v0/
1213
```
1314
1415
Q&A:

services/autoscaling/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,12 @@ COPY --chown=scu:scu services/autoscaling/docker services/autoscaling/docker
156156
RUN chmod +x services/autoscaling/docker/*.sh
157157

158158

159-
HEALTHCHECK --interval=10s \
159+
# https://docs.docker.com/reference/dockerfile/#healthcheck
160+
HEALTHCHECK \
161+
--interval=10s \
160162
--timeout=5s \
161-
--start-period=5s \
163+
--start-period=20s \
164+
--start-interval=1s \
162165
--retries=5 \
163166
CMD ["python3", "services/autoscaling/docker/healthcheck.py", "http://localhost:8000/"]
164167

services/autoscaling/docker/healthcheck.py

100644100755
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
COPY --chown=scu:scu docker/healthcheck.py docker/healthcheck.py
77
HEALTHCHECK --interval=30s \
88
--timeout=30s \
9-
--start-period=1s \
9+
--start-period=20s \
10+
--start-interval=1s \
1011
--retries=3 \
11-
CMD python3 docker/healthcheck.py http://localhost:8000/
12+
CMD python3 docker/healthcheck.py http://localhost:8080/v0/
1213
```
1314
1415
Q&A:

services/catalog/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,12 @@ COPY --chown=scu:scu --from=prod-only-deps ${VIRTUAL_ENV} ${VIRTUAL_ENV}
140140
COPY --chown=scu:scu services/catalog/docker services/catalog/docker
141141
RUN chmod +x services/catalog/docker/*.sh
142142

143-
HEALTHCHECK --interval=10s \
143+
# https://docs.docker.com/reference/dockerfile/#healthcheck
144+
HEALTHCHECK \
145+
--interval=10s \
144146
--timeout=5s \
145-
--start-period=5s \
147+
--start-period=20s \
148+
--start-interval=1s \
146149
--retries=5 \
147150
CMD ["python3", "services/catalog/docker/healthcheck.py", "http://localhost:8000/"]
148151

services/catalog/docker/healthcheck.py

100644100755
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
COPY --chown=scu:scu docker/healthcheck.py docker/healthcheck.py
77
HEALTHCHECK --interval=30s \
88
--timeout=30s \
9-
--start-period=1s \
9+
--start-period=20s \
10+
--start-interval=1s \
1011
--retries=3 \
11-
CMD python3 docker/healthcheck.py http://localhost:8000/
12+
CMD python3 docker/healthcheck.py http://localhost:8080/v0/
1213
```
1314
1415
Q&A:

services/clusters-keeper/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,12 @@ COPY --chown=scu:scu services/clusters-keeper/docker services/clusters-keeper/do
159159
RUN chmod +x services/clusters-keeper/docker/*.sh
160160

161161

162-
HEALTHCHECK --interval=10s \
162+
# https://docs.docker.com/reference/dockerfile/#healthcheck
163+
HEALTHCHECK \
164+
--interval=10s \
163165
--timeout=5s \
164-
--start-period=5s \
166+
--start-period=20s \
167+
--start-interval=1s \
165168
--retries=5 \
166169
CMD ["python3", "services/clusters-keeper/docker/healthcheck.py", "http://localhost:8000/"]
167170

0 commit comments

Comments
 (0)