diff --git a/docker/synapse/compose.yaml b/docker/synapse/compose.yaml index f7ee150..ce4cb3a 100644 --- a/docker/synapse/compose.yaml +++ b/docker/synapse/compose.yaml @@ -19,6 +19,12 @@ services: options: max-size: "50m" max-file: "3" + healthcheck: + test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB || exit 1"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 10s synapse-foxgirls: image: matrixdotorg/synapse:latest diff --git a/gitea/compose.yaml b/gitea/compose.yaml index ca80afb..8c2520f 100644 --- a/gitea/compose.yaml +++ b/gitea/compose.yaml @@ -29,6 +29,7 @@ services: networks: - reverse_proxy_default + - postgre-general logging: driver: "json-file" @@ -39,6 +40,15 @@ services: ports: - "2001:22" + healthcheck: + test: ["CMD-SHELL", "wget -qO- http://localhost:3000/api/healthz || exit 1"] + interval: 30s + timeout: 5s + retries: 3 + start_period: 10s + networks: reverse_proxy_default: + external: true + postgre-general: external: true \ No newline at end of file diff --git a/homepage/compose.yaml b/homepage/compose.yaml index 3e1c6c1..fc91dbd 100644 --- a/homepage/compose.yaml +++ b/homepage/compose.yaml @@ -13,6 +13,12 @@ services: options: max-size: "50m" max-file: "3" + healthcheck: + test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5000/', timeout=5)"] + interval: 30s + timeout: 5s + retries: 3 + start_period: 10s networks: reverse_proxy_default: external: true \ No newline at end of file diff --git a/nextcloud/compose.yaml b/nextcloud/compose.yaml index 8f851dd..0cb4bcd 100644 --- a/nextcloud/compose.yaml +++ b/nextcloud/compose.yaml @@ -2,6 +2,7 @@ services: nextcloud-app: build: . + image: local-nextcloud container_name: nextcloud_app restart: unless-stopped volumes: @@ -31,6 +32,12 @@ services: - postgre-general - nextcloud-network - reverse_proxy_default + healthcheck: + test: ["CMD-SHELL", "curl -f http://localhost:80/status.php | grep -q '\"installed\":true' || exit 1"] + interval: 30s + timeout: 5s + retries: 3 + start_period: 10s nextcloud-redis: image: redis:alpine # Essential for file locking, uses almost no RAM (~20MB) @@ -39,9 +46,16 @@ services: command: redis-server --requirepass ${REDIS_PASS} networks: - nextcloud-network + healthcheck: + test: ["CMD-SHELL", "redis-cli -a ${REDIS_PASS} ping | grep PONG || exit 1"] + interval: 30s + timeout: 5s + retries: 3 + start_period: 5s nextcloud-cron: - image: nextcloud:latest + build: . + image: local-nextcloud container_name: nextcloud_cron restart: unless-stopped volumes: @@ -52,6 +66,17 @@ services: networks: - nextcloud-network - postgre-general + healthcheck: + test: ["CMD-SHELL", "LC_ALL=C; [ $$(($$(date +%s) - $$(runuser -u www-data -- php /var/www/html/occ config:app:get core lastcron))) -le 900 ] || exit 1"] + interval: 5m + timeout: 15s + retries: 3 + start_period: 2m + + + + + networks: diff --git a/palworld/compose.yaml b/palworld/compose.yaml index 7db837a..b5dee1a 100644 --- a/palworld/compose.yaml +++ b/palworld/compose.yaml @@ -48,8 +48,27 @@ services: environment: - CONTAINER_NAME=palworld-server - DOCKER_HOST=tcp://admin-backend:2375 - - PASSWORD=saf3fluffypvvd - - USERNAME=admin + - PASSWORD=${PANEL_PASS} + - USERNAME=${PANEL_USER} + healthcheck: + test: + - "CMD" + - "python3" + - "-c" + - | + import urllib.request, sys + try: + urllib.request.urlopen('http://localhost:5000/', timeout=5) + except urllib.error.HTTPError as e: + if e.code in [401, 403]: + sys.exit(0) + sys.exit(1) + except Exception: + sys.exit(1) + interval: 30s + timeout: 5s + retries: 3 + start_period: 10s admin-backend: image: tecnativa/docker-socket-proxy @@ -63,6 +82,11 @@ services: - CONTAINERS=1 volumes: - /var/run/docker.sock:/var/run/docker.sock:ro + healthcheck: + test: ["CMD-SHELL", "nc -z localhost 2375 || exit 1"] + interval: 10s + timeout: 3s + retries: 3 networks: palworld-admin: internal: true diff --git a/reverse_proxy/compose.yaml b/reverse_proxy/compose.yaml index 8e83889..e5afc8c 100644 --- a/reverse_proxy/compose.yaml +++ b/reverse_proxy/compose.yaml @@ -17,3 +17,8 @@ services: options: max-size: "50m" max-file: "3" + healthcheck: + test: ["CMD", "/usr/bin/check-health"] + interval: 10s + timeout: 3s + retries: 3 diff --git a/start_everything.sh b/start_everything.sh old mode 100644 new mode 100755 index 935eca2..079c603 --- a/start_everything.sh +++ b/start_everything.sh @@ -7,11 +7,13 @@ docker compose -f ~/reverse_proxy/compose.yaml --project-directory ~/reverse_pro docker compose -f ~/uptime-kuma/compose.yaml --project-directory ~/uptime-kuma/ up -d #create palworl server, don't start it -docker compose -f ~/palworld/compose.yaml --project-directory ~/palworld up --no-start +docker compose -f ~/palworld/compose.yaml --project-directory ~/palworld create +docker compose -f ~/palworld/compose.yaml --project-directory ~/palworld start admin-panel admin-backend + #create matrix server and database #todo: split synapse and postgre at some point -docker compose -f~/docker/synapse/compose.yaml --project-directory ~/docker/synapse up -d +docker compose -f ~/docker/synapse/compose.yaml --project-directory ~/docker/synapse up -d #start jellyfin if [[ ! -d ~/jellyfin/jellyfin-media-remote/foxgirls-jelly ]] ; then