diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 60ed241..a246c01 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -134,17 +134,17 @@ jobs: run: | DEPLOY_COLOR=$(ssh -i ~/.ssh/deploy_key root@"${{ steps.vps.outputs.ip }}" \ "cat /opt/rustyip/.active_color") - for i in $(seq 1 15); do + for i in $(seq 1 30); do status=$(ssh -i ~/.ssh/deploy_key root@"${{ steps.vps.outputs.ip }}" \ "docker inspect --format='{{ '{{' }}.State.Health.Status{{ '}}' }}' rustyip-app-${DEPLOY_COLOR}" 2>/dev/null) if [ "$status" = "healthy" ]; then echo "Deployment verified: app-${DEPLOY_COLOR} is healthy" exit 0 fi - echo "Waiting for health check... (attempt $i/15)" + echo "Waiting for health check... (attempt $i/30)" sleep 4 done - echo "Health check failed after 60 seconds" + echo "Health check failed after 120 seconds" exit 1 # ---- Cleanup ---- diff --git a/deploy/ansible/roles/app/tasks/main.yml b/deploy/ansible/roles/app/tasks/main.yml index 8b84f2f..4294e74 100644 --- a/deploy/ansible/roles/app/tasks/main.yml +++ b/deploy/ansible/roles/app/tasks/main.yml @@ -110,7 +110,7 @@ - name: Wait for target container health check (first deploy) ansible.builtin.shell: | - for i in $(seq 1 30); do + for i in $(seq 1 60); do status=$(docker inspect --format='{% raw %}{{.State.Health.Status}}{% endraw %}' "rustyip-app-{{ deploy_target }}" 2>/dev/null) if [ "$status" = "healthy" ]; then echo "healthy" @@ -152,7 +152,7 @@ - name: Wait for standby container health check ansible.builtin.shell: | - for i in $(seq 1 30); do + for i in $(seq 1 60); do status=$(docker inspect --format='{% raw %}{{.State.Health.Status}}{% endraw %}' "rustyip-app-{{ deploy_target }}" 2>/dev/null) if [ "$status" = "healthy" ]; then echo "healthy" diff --git a/deploy/ansible/roles/app/templates/docker-compose.yml.j2 b/deploy/ansible/roles/app/templates/docker-compose.yml.j2 index 186aa35..ca8b997 100644 --- a/deploy/ansible/roles/app/templates/docker-compose.yml.j2 +++ b/deploy/ansible/roles/app/templates/docker-compose.yml.j2 @@ -29,7 +29,7 @@ services: interval: 5s timeout: 3s retries: 3 - start_period: 15s + start_period: 5s restart: unless-stopped ulimits: nofile: @@ -49,7 +49,7 @@ services: interval: 5s timeout: 3s retries: 3 - start_period: 15s + start_period: 5s restart: unless-stopped ulimits: nofile: