This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
The following commit(s) were added to refs/heads/master by this push:
new 1f290c62b add docker/compose health checks and use --wait to check them
1f290c62b is described below
commit 1f290c62bb176009dc2a048f1071e73560cb294f
Author: Dave Brondsema <[email protected]>
AuthorDate: Thu Jun 25 11:34:46 2026 -0400
add docker/compose health checks and use --wait to check them
---
Allura/docs/getting_started/installation.rst | 4 ++--
Dockerfile | 3 +++
docker-compose-prod.yml | 13 ++++++++++++-
docker-compose.yml | 14 ++++++++++++++
scm_config/git-http/Dockerfile | 5 ++++-
scripts/jenkins-run.sh | 2 +-
6 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/Allura/docs/getting_started/installation.rst
b/Allura/docs/getting_started/installation.rst
index b6823ccfc..d6c3daf37 100644
--- a/Allura/docs/getting_started/installation.rst
+++ b/Allura/docs/getting_started/installation.rst
@@ -95,7 +95,7 @@ Start containers in the background:
.. code-block:: bash
- docker compose up -d
+ docker compose up -d --wait
You're up and running! Visit localhost:8080 (or whatever IP address you're
running Docker on). Then
see our :ref:`post-setup-instructions` and read more below about the Docker
environment for Allura.
@@ -159,7 +159,7 @@ Restarting all containers:
.. code-block:: bash
- docker compose up -d
+ docker compose up -d --wait
View logs from all services:
diff --git a/Dockerfile b/Dockerfile
index 35c713009..e0b3d1feb 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -76,3 +76,6 @@ ENV USER root
WORKDIR /allura
ENV PYTHONUNBUFFERED 1
CMD gunicorn --paste Allura/docker-dev.ini -b :8088 --reload
+
+HEALTHCHECK --start-interval=1s --start-period=30s --timeout=5s \
+ CMD curl -f http://localhost:8088/ || exit 1
diff --git a/docker-compose-prod.yml b/docker-compose-prod.yml
index e4aab2443..6c2a4cf0c 100644
--- a/docker-compose-prod.yml
+++ b/docker-compose-prod.yml
@@ -35,7 +35,6 @@
# * git-http container serves git and also proxies back to the "web" container
##
-version: "2.1"
services:
web:
build: .
@@ -60,6 +59,8 @@ services:
working_dir: /allura/Allura
environment: *env
command: paster taskd /allura-data/production.ini
+ healthcheck:
+ test: ["CMD", "pgrep", "-f", "taskd"]
volumes: *volumes
links:
- mongo
@@ -84,6 +85,10 @@ services:
volumes:
- ./solr_config/allura:/opt/solr/server/solr/allura
-
${LOCAL_SHARED_DATA_ROOT:-./allura-data}/solr:/opt/solr/server/solr/allura/data
+ healthcheck:
+ test: ["CMD", "wget", "-q", "-O", "/dev/null",
"http://localhost:8983/solr/allura/admin/ping"]
+ start_interval: 1s
+ start_period: 30s
restart: always
mongo:
@@ -93,6 +98,10 @@ services:
volumes:
- ${LOCAL_SHARED_DATA_ROOT:-./allura-data}/mongo:/data/db
command: mongod --storageEngine wiredTiger
+ healthcheck:
+ test: ["CMD", "mongo", "--eval", "db.adminCommand('ping')"]
+ start_interval: 1s
+ start_period: 30s
restart: always
inmail:
@@ -101,6 +110,8 @@ services:
environment: *env
volumes: *volumes
command: paster smtp_server /allura-data/production.ini
+ healthcheck:
+ test: ["CMD", "python", "-c", "import socket;
socket.create_connection(('localhost', 8825), 5).close()"]
ports:
- "127.0.0.1:8825:8825"
links:
diff --git a/docker-compose.yml b/docker-compose.yml
index a6c663959..089345ce0 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -42,6 +42,8 @@ services:
- mongo
- solr
- outmail
+ healthcheck:
+ test: ["CMD", "pgrep", "-f", "taskd"]
solr:
image: solr:6-alpine # alpine is a very small distro base
@@ -50,6 +52,10 @@ services:
volumes:
- ./solr_config/allura:/opt/solr/server/solr/allura
-
${LOCAL_SHARED_DATA_ROOT:-./allura-data}/solr:/opt/solr/server/solr/allura/data
+ healthcheck:
+ test: ["CMD", "wget", "-q", "-O", "/dev/null",
"http://localhost:8983/solr/allura/admin/ping"]
+ start_interval: 1s
+ start_period: 30s
mongo:
image: mongo:4.2
@@ -58,6 +64,10 @@ services:
volumes:
- ${LOCAL_SHARED_DATA_ROOT:-./allura-data}/mongo:/data/db
command: mongod --storageEngine wiredTiger
+ healthcheck:
+ test: ["CMD", "mongo", "--eval", "db.adminCommand('ping')"]
+ start_interval: 1s
+ start_period: 30s
outmail:
image: allura-web
@@ -67,6 +77,8 @@ services:
command: python -u -m aiosmtpd -n -c
alluratest.smtp_debug.BetterDebuggingServer -l 0.0.0.0:8826
expose:
- "8826"
+ healthcheck:
+ test: ["CMD", "python", "-c", "import socket;
socket.create_connection(('localhost', 8826), 5).close()"]
inmail:
image: allura-web
@@ -78,6 +90,8 @@ services:
- "8825:8825"
links:
- mongo
+ healthcheck:
+ test: ["CMD", "python", "-c", "import socket;
socket.create_connection(('localhost', 8825), 5).close()"]
http:
build: scm_config/git-http/
diff --git a/scm_config/git-http/Dockerfile b/scm_config/git-http/Dockerfile
index 7fbfbafbd..edcf29a31 100644
--- a/scm_config/git-http/Dockerfile
+++ b/scm_config/git-http/Dockerfile
@@ -57,4 +57,7 @@ ADD git-http-backend-wrapper.sh /usr/lib/git-core
RUN adduser www-data sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >
/etc/sudoers.d/sudo_group_passwordless
-CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]
\ No newline at end of file
+CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]
+
+HEALTHCHECK --start-interval=1s --start-period=30s --timeout=5s \
+ CMD curl -f http://localhost/ || exit 1
diff --git a/scripts/jenkins-run.sh b/scripts/jenkins-run.sh
index 2a22f7e65..03b937997 100755
--- a/scripts/jenkins-run.sh
+++ b/scripts/jenkins-run.sh
@@ -63,7 +63,7 @@ echo
echo
"============================================================================="
echo "Starting up docker containers"
echo
"============================================================================="
-docker compose up -d web
+docker compose up -d web --wait || { docker compose logs -n 80 web; exit 1; }
echo
echo
"============================================================================="