Skip to content

Commit

Permalink
OPSEXP-2253 Add healthchecks and conditional service startup based on…
Browse files Browse the repository at this point in the history
… service health in docker compose (#1232)

Co-authored-by: Giovanni Toraldo <[email protected]>
  • Loading branch information
pmacius and gionn authored Oct 25, 2024
1 parent ea127d9 commit 78132d9
Show file tree
Hide file tree
Showing 9 changed files with 638 additions and 57 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/docker-compose-community.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ jobs:
name: Docker Compose community
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: >-
Alfresco/alfresco-build-tools/.github/actions/dbp-charts/verify-compose@v7.0.0
Alfresco/alfresco-build-tools/.github/actions/dbp-charts/verify-compose@v8.1.0
with:
compose_file_path: docker-compose/community-compose.yaml
postman_path: test/postman/docker-compose
postman_json: acs-test-docker-compose-collection.json
5 changes: 4 additions & 1 deletion .github/workflows/docker-compose-enterprise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,14 @@ jobs:
&& github.event.pull_request.head.user.login == 'Alfresco'
)
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Verify docker-compose
uses: >-
Alfresco/alfresco-build-tools/.github/actions/dbp-charts/verify-compose@v7.0.0
Alfresco/alfresco-build-tools/.github/actions/dbp-charts/verify-compose@v8.1.0
timeout-minutes: 10
with:
postman_path: test/postman/docker-compose
postman_json: acs-test-docker-compose-collection.json
compose_file_path: docker-compose/${{ matrix.compose_file }}
quay_username: ${{ secrets.QUAY_USERNAME }}
quay_password: ${{ secrets.QUAY_PASSWORD }}
93 changes: 86 additions & 7 deletions docker-compose/7.1.N-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,17 @@ services:
-XX:MinRAMPercentage=50
-XX:MaxRAMPercentage=80
-XX:MaxRAM=1900m
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/probes/-ready-"]
interval: 30s
timeout: 3s
retries: 5
start_period: 1m
labels:
- "traefik.enable=true"
- "traefik.http.routers.alfresco.rule=PathPrefix(`/`)"
- "traefik.http.services.alfresco.loadbalancer.server.port=8080"
- "traefik.http.routers.solrapideny.rule=PathRegexp(`^/alfresco/(wc)?s(ervice)?/api/solr/`)"
- "traefik.http.routers.solrapideny.rule=PathRegexp(`^/alfresco/(wc)?s(ervice)?/api/solr/.*$`)"
- "traefik.http.middlewares.acsfakeauth.basicauth.users=fake:"
- "traefik.http.routers.solrapideny.middlewares=acsfakeauth@docker"
- "traefik.http.routers.alfrescomicrometer.rule=PathRegexp(`^/alfresco/(wc)?s(ervice)?/prometheus`)"
Expand All @@ -80,8 +86,17 @@ services:
http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file
ports:
- "8095:8095"
links:
- activemq
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8095/actuator/health"]
interval: 10s
timeout: 2s
retries: 3
start_period: 20s
depends_on:
activemq:
condition: service_healthy
shared-file-store:
condition: service_healthy
transform-core-aio:
image: alfresco/alfresco-transform-core-aio:3.1.2
mem_limit: 1536m
Expand All @@ -95,8 +110,17 @@ services:
http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file
ports:
- "8090:8090"
links:
- activemq
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8090/ready"]
interval: 20s
timeout: 2s
retries: 3
start_period: 10s
depends_on:
activemq:
condition: service_healthy
shared-file-store:
condition: service_healthy
shared-file-store:
image: quay.io/alfresco/alfresco-shared-file-store:2.1.2
mem_limit: 512m
Expand All @@ -109,6 +133,12 @@ services:
scheduler.cleanup.interval: 86400000
ports:
- "8099:8099"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8099/ready"]
interval: 20s
timeout: 2s
retries: 3
start_period: 10s
volumes:
- shared-file-store-volume:/tmp/Alfresco/sfs
share:
Expand All @@ -127,11 +157,20 @@ services:
-Dalfresco.port=8080
-Dalfresco.context=alfresco
-Dalfresco.protocol=http
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/share"]
interval: 20s
timeout: 2s
retries: 3
start_period: 15s
depends_on:
alfresco:
condition: service_healthy
labels:
- "traefik.enable=true"
- "traefik.http.routers.share.rule=PathPrefix(`/share`)"
- "traefik.http.services.share.loadbalancer.server.port=8080"
- "traefik.http.routers.proxiedsolrapideny.rule=PathRegexp(`^/share/proxy/alfresco(-(noauth|feed|api))?/api/solr/.*$`)"
- "traefik.http.routers.proxiedsolrapideny.rule=PathRegexp(`^/share/proxy/alfresco(-(noauth|feed|api))?/api/solr/`)"
- "traefik.http.middlewares.sharefakeauth.basicauth.users=fake:"
- "traefik.http.routers.proxiedsolrapideny.middlewares=sharefakeauth@docker"
postgres:
Expand All @@ -144,6 +183,12 @@ services:
command: postgres -c max_connections=300 -c log_min_messages=LOG
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -d $$POSTGRES_DB -U $$POSTGRES_USER"]
interval: 10s
timeout: 3s
retries: 3
start_period: 5s
solr6:
image: quay.io/alfresco/search-services:2.0.2.2
mem_limit: 2g
Expand All @@ -168,21 +213,36 @@ services:
- "5672:5672" # AMQP
- "61616:61616" # OpenWire
- "61613:61613" # STOMP
healthcheck:
test: ["CMD", "/opt/activemq/bin/activemq", "query", "--objname", "type=Broker,brokerName=*,service=Health", "|", "grep", "Good"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
digital-workspace:
image: quay.io/alfresco/alfresco-digital-workspace:4.4.1
mem_limit: 128m
environment:
APP_CONFIG_PROVIDER: "ECM"
APP_CONFIG_AUTH_TYPE: "BASIC"
BASE_PATH: ./
APP_CONFIG_PLUGIN_PROCESS_SERVICE: "false"
APP_CONFIG_PLUGIN_MICROSOFT_ONLINE: "false"
APP_BASE_SHARE_URL: "http://localhost:8080/workspace/#/preview/s"
labels:
- "traefik.enable=true"
- "traefik.http.routers.adw.rule=PathPrefix(`/workspace`)"
- "traefik.http.middlewares.adwroot.stripprefix.prefixes=/workspace"
- "traefik.http.middlewares.adwforceslash.redirectregex.regex=^(.*/workspace)$$"
- "traefik.http.middlewares.adwforceslash.redirectregex.replacement=$${1}/"
- "traefik.http.middlewares.adwroot.stripprefix.prefixes=/workspace"
- "traefik.http.middlewares.adwchain.chain.middlewares=adwforceslash,adwroot"
- "traefik.http.routers.adw.middlewares=adwchain@docker"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
interval: 10s
timeout: 1s
retries: 3
start_period: 1s
proxy:
image: traefik:3.1
mem_limit: 128m
Expand All @@ -193,9 +253,17 @@ services:
- "--entryPoints.traefik.address=:8888"
- "--accesslog=true"
- "--providers.docker.exposedByDefault=false"
- "--ping.entrypoint=web"
- "--ping=true"
ports:
- "8080:8080"
- "8888:8888"
healthcheck:
test: ["CMD", "traefik", "healthcheck", "--ping"]
interval: 20s
timeout: 10s
retries: 3
start_period: 10s
security_opt:
- label=disable # Required for accessing the Docker socket on Selinux enabled systems
volumes:
Expand All @@ -218,6 +286,17 @@ services:
-XX:MaxRAM=1g
ports:
- "9090:9090"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9090/alfresco/healthcheck"]
interval: 30s
timeout: 2s
retries: 3
start_period: 20s
depends_on:
postgres:
condition: service_healthy
alfresco:
condition: service_healthy
labels:
- "traefik.enable=true"
- "traefik.http.routers.syncservice.rule=PathPrefix(`/syncservice`)"
Expand Down
96 changes: 90 additions & 6 deletions docker-compose/7.2.N-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,17 @@ services:
-XX:MinRAMPercentage=50
-XX:MaxRAMPercentage=80
-XX:MaxRAM=1900m
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/probes/-ready-"]
interval: 30s
timeout: 3s
retries: 5
start_period: 1m
labels:
- "traefik.enable=true"
- "traefik.http.routers.alfresco.rule=PathPrefix(`/`)"
- "traefik.http.services.alfresco.loadbalancer.server.port=8080"
- "traefik.http.routers.solrapideny.rule=PathRegexp(`^/alfresco/(wc)?s(ervice)?/api/solr/`)"
- "traefik.http.routers.solrapideny.rule=PathRegexp(`^/alfresco/(wc)?s(ervice)?/api/solr/.*$`)"
- "traefik.http.middlewares.acsfakeauth.basicauth.users=fake:"
- "traefik.http.routers.solrapideny.middlewares=acsfakeauth@docker"
- "traefik.http.routers.alfrescomicrometer.rule=PathRegexp(`^/alfresco/(wc)?s(ervice)?/prometheus`)"
Expand All @@ -81,8 +87,17 @@ services:
http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file
ports:
- "8095:8095"
links:
- activemq
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8095/actuator/health"]
interval: 10s
timeout: 2s
retries: 3
start_period: 20s
depends_on:
activemq:
condition: service_healthy
shared-file-store:
condition: service_healthy
transform-core-aio:
image: alfresco/alfresco-transform-core-aio:3.1.2
mem_limit: 1536m
Expand All @@ -96,8 +111,17 @@ services:
http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file
ports:
- "8090:8090"
links:
- activemq
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8090/ready"]
interval: 20s
timeout: 2s
retries: 3
start_period: 10s
depends_on:
activemq:
condition: service_healthy
shared-file-store:
condition: service_healthy
shared-file-store:
image: quay.io/alfresco/alfresco-shared-file-store:2.1.2
mem_limit: 512m
Expand All @@ -110,6 +134,12 @@ services:
scheduler.cleanup.interval: 86400000
ports:
- "8099:8099"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8099/ready"]
interval: 20s
timeout: 2s
retries: 3
start_period: 10s
volumes:
- shared-file-store-volume:/tmp/Alfresco/sfs
share:
Expand All @@ -128,6 +158,15 @@ services:
-Dalfresco.port=8080
-Dalfresco.context=alfresco
-Dalfresco.protocol=http
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/share"]
interval: 20s
timeout: 2s
retries: 3
start_period: 15s
depends_on:
alfresco:
condition: service_healthy
labels:
- "traefik.enable=true"
- "traefik.http.routers.share.rule=PathPrefix(`/share`)"
Expand All @@ -145,6 +184,12 @@ services:
command: postgres -c max_connections=300 -c log_min_messages=LOG
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -d $$POSTGRES_DB -U $$POSTGRES_USER"]
interval: 10s
timeout: 3s
retries: 3
start_period: 5s
solr6:
image: quay.io/alfresco/search-services:2.0.12
mem_limit: 2g
Expand Down Expand Up @@ -172,17 +217,31 @@ services:
- "5672:5672" # AMQP
- "61616:61616" # OpenWire
- "61613:61613" # STOMP
healthcheck:
test: ["CMD", "/opt/activemq/bin/activemq", "query", "--objname", "type=Broker,brokerName=*,service=Health", "|", "grep", "Good"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
digital-workspace:
image: quay.io/alfresco/alfresco-digital-workspace:4.4.1
mem_limit: 128m
environment:
APP_CONFIG_PROVIDER: "ECM"
APP_CONFIG_AUTH_TYPE: "BASIC"
BASE_PATH: ./
APP_CONFIG_PLUGIN_PROCESS_SERVICE: "false"
APP_CONFIG_PLUGIN_MICROSOFT_ONLINE: "false"
APP_BASE_SHARE_URL: "http://localhost:8080/workspace/#/preview/s"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
interval: 10s
timeout: 1s
retries: 3
start_period: 1s
labels:
- "traefik.enable=true"
- "traefik.http.routers.adw.rule=PathPrefix(`/workspace`)"
- "traefik.http.middlewares.adfroot.stripprefix.prefixes=/workspace"
- "traefik.http.middlewares.adwforceslash.redirectregex.regex=^(.*/workspace)$$"
- "traefik.http.middlewares.adwforceslash.redirectregex.replacement=$${1}/"
- "traefik.http.middlewares.adwroot.stripprefix.prefixes=/workspace"
Expand All @@ -195,6 +254,12 @@ services:
APP_CONFIG_PROVIDER: "ECM"
APP_CONFIG_AUTH_TYPE: "BASIC"
BASE_PATH: ./
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
interval: 10s
timeout: 1s
retries: 3
start_period: 1s
labels:
- "traefik.enable=true"
- "traefik.http.routers.acc.rule=PathPrefix(`/control-center`) || PathPrefix(`/admin`)"
Expand All @@ -213,9 +278,17 @@ services:
- "--entryPoints.traefik.address=:8888"
- "--accesslog=true"
- "--providers.docker.exposedByDefault=false"
- "--ping.entrypoint=web"
- "--ping=true"
ports:
- "8080:8080"
- "8888:8888"
healthcheck:
test: ["CMD", "traefik", "healthcheck", "--ping"]
interval: 20s
timeout: 10s
retries: 3
start_period: 10s
security_opt:
- label=disable # Required for accessing the Docker socket on Selinux enabled systems
volumes:
Expand All @@ -238,6 +311,17 @@ services:
-XX:MaxRAM=1g
ports:
- "9090:9090"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9090/alfresco/healthcheck"]
interval: 30s
timeout: 2s
retries: 3
start_period: 20s
depends_on:
postgres:
condition: service_healthy
alfresco:
condition: service_healthy
labels:
- "traefik.enable=true"
- "traefik.http.routers.syncservice.rule=PathPrefix(`/syncservice`)"
Expand Down
Loading

0 comments on commit 78132d9

Please sign in to comment.