compose: added health checks, restart policy and improved depends_on

This commit is contained in:
Gerrit Gogel 2024-02-14 11:13:21 +01:00
parent 892ac6f7bf
commit 723cc36980
2 changed files with 54 additions and 26 deletions

View file

@ -10,12 +10,17 @@ services:
- TIME_ZONE=Europe/Berlin - TIME_ZONE=Europe/Berlin
- HTTPS=false - HTTPS=false
- SEAFILE_URL=localhost - SEAFILE_URL=localhost
depends_on:
- db
- memcached
- seafile-caddy
networks: networks:
- seafile-net - seafile-net
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "8082"]
interval: 10s
timeout: 10s
retries: 3
restart: unless-stopped
seahub: seahub:
build: ../seahub/. build: ../seahub/.
@ -26,22 +31,23 @@ services:
environment: environment:
- SEAFILE_ADMIN_EMAIL=me@example.com - SEAFILE_ADMIN_EMAIL=me@example.com
- SEAFILE_ADMIN_PASSWORD=asecret - SEAFILE_ADMIN_PASSWORD=asecret
depends_on:
- seafile-server
- seafile-caddy
- seahub-media
networks: networks:
- seafile-net - seafile-net
depends_on:
db:
condition: service_healthy
seafile-server:
condition: service_healthy
restart: unless-stopped
seahub-media: seahub-media:
build: ../seahub-media/. build: ../seahub-media/.
volumes: volumes:
- seahub-avatars:/usr/share/caddy/media/avatars - seahub-avatars:/usr/share/caddy/media/avatars
- seahub-custom:/usr/share/caddy/media/custom - seahub-custom:/usr/share/caddy/media/custom
depends_on:
- seafile-caddy
networks: networks:
- seafile-net - seafile-net
restart: unless-stopped
db: db:
image: mariadb:10.11.7 image: mariadb:10.11.7
@ -53,20 +59,28 @@ services:
- seafile-mariadb:/var/lib/mysql - seafile-mariadb:/var/lib/mysql
networks: networks:
- seafile-net - seafile-net
healthcheck:
test: ["CMD", "healthcheck.sh", "--su-mysql", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 10s
retries: 3
restart: unless-stopped
memcached: memcached:
image: memcached:1.6.23 image: memcached:1.6.23
entrypoint: memcached -m 1024 entrypoint: memcached -m 1024
networks: networks:
- seafile-net - seafile-net
restart: unless-stopped
seafile-caddy: seafile-caddy:
build: ../seafile-caddy/. build: ../seafile-caddy/.
ports: ports:
- "80:80" - "8080:80"
networks: networks:
- seafile-net - seafile-net
- default - default
restart: unless-stopped
networks: networks:
seafile-net: seafile-net:

View file

@ -3,45 +3,51 @@ services:
seafile-server: seafile-server:
image: ggogel/seafile-server:11.0.4 image: ggogel/seafile-server:11.0.4
volumes: volumes:
- seafile-data:/shared - seafile-data:/shared
environment: environment:
- DB_HOST=db - DB_HOST=db
- DB_ROOT_PASSWD=db_dev - DB_ROOT_PASSWD=db_dev
- TIME_ZONE=Europe/Berlin - TIME_ZONE=Europe/Berlin
- HTTPS=true - HTTPS=true
- SEAFILE_URL=seafile.mydomain.com # Mandatory on first deployment! - SEAFILE_URL=seafile.mydomain.com # Mandatory on first deployment!
depends_on:
- db
- memcached
- seafile-caddy
networks: networks:
- seafile-net - seafile-net
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "8082"]
interval: 10s
timeout: 10s
retries: 3
restart: unless-stopped
seahub: seahub:
image: ggogel/seahub:11.0.4 image: ggogel/seahub:11.0.4
volumes: volumes:
- seafile-data:/shared - seafile-data:/shared
- seahub-avatars:/shared/seafile/seahub-data/avatars - seahub-avatars:/shared/seafile/seahub-data/avatars
- seahub-custom:/shared/seafile/seahub-data/custom - seahub-custom:/shared/seafile/seahub-data/custom
environment: environment:
- SEAFILE_ADMIN_EMAIL=me@example.com - SEAFILE_ADMIN_EMAIL=me@example.com
- SEAFILE_ADMIN_PASSWORD=asecret - SEAFILE_ADMIN_PASSWORD=asecret
depends_on:
- seafile-server
- seafile-caddy
- seahub-media
networks: networks:
- seafile-net - seafile-net
depends_on:
db:
condition: service_healthy
seafile-server:
condition: service_healthy
restart: unless-stopped
seahub-media: seahub-media:
image: ggogel/seahub-media:11.0.4 image: ggogel/seahub-media:11.0.4
volumes: volumes:
- seahub-avatars:/usr/share/caddy/media/avatars - seahub-avatars:/usr/share/caddy/media/avatars
- seahub-custom:/usr/share/caddy/media/custom - seahub-custom:/usr/share/caddy/media/custom
depends_on:
- seafile-caddy
networks: networks:
- seafile-net - seafile-net
restart: unless-stopped
db: db:
image: mariadb:10.11.7 image: mariadb:10.11.7
@ -53,12 +59,19 @@ services:
- seafile-mariadb:/var/lib/mysql - seafile-mariadb:/var/lib/mysql
networks: networks:
- seafile-net - seafile-net
healthcheck:
test: ["CMD", "healthcheck.sh", "--su-mysql", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 10s
retries: 3
restart: unless-stopped
memcached: memcached:
image: memcached:1.6.23 image: memcached:1.6.23
entrypoint: memcached -m 1024 entrypoint: memcached -m 1024
networks: networks:
- seafile-net - seafile-net
restart: unless-stopped
seafile-caddy: seafile-caddy:
image: ggogel/seafile-caddy:2.7.6 image: ggogel/seafile-caddy:2.7.6
@ -67,6 +80,7 @@ services:
networks: networks:
- seafile-net - seafile-net
- default - default
restart: unless-stopped
networks: networks:
seafile-net: seafile-net: