From 74fc2c854bf0a18f5192b5280c40f6fc57cecd1e Mon Sep 17 00:00:00 2001 From: Joe Matthew Date: Mon, 12 Aug 2024 17:21:49 +0200 Subject: [PATCH] fix: use swarm deploy restart --- docker-compose.yml | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8cbae0d..84a6ca4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,12 @@ networks: services: app: - restart: always + deploy: + restart_policy: + condition: on-failure + delay: 5s + max_attempts: 3 + window: 120s image: ${DOCKER_REGISTRY-pantosio}/service-node-app:${DOCKER_TAG-local} build: context: . @@ -41,7 +46,12 @@ services: - broker - db worker: - restart: always + deploy: + restart_policy: + condition: on-failure + delay: 5s + max_attempts: 3 + window: 120s image: ${DOCKER_REGISTRY-pantosio}/service-node-worker:${DOCKER_TAG-local} build: context: . @@ -76,7 +86,12 @@ services: - app db: image: postgres:latest - restart: on-failure + deploy: + restart_policy: + condition: on-failure + delay: 5s + max_attempts: 3 + window: 120s healthcheck: test: [ "CMD", "pg_isready", "-U", "postgres" ] interval: 10s @@ -96,7 +111,12 @@ services: read_only: true broker: image: rabbitmq:latest - restart: on-failure + deploy: + restart_policy: + condition: on-failure + delay: 5s + max_attempts: 3 + window: 120s hostname: pantos-service-node networks: pantos-service-node: