Some checks failed
🚀 Build & Deploy Image / Determine Build Necessity (push) Successful in 31s
Security Vulnerability Scan / Check for Dependency Changes (push) Successful in 27s
🚀 Build & Deploy Image / Build Runtime Base Image (push) Successful in 13s
🚀 Build & Deploy Image / Run Tests & Quality Checks (push) Has been skipped
Security Vulnerability Scan / Composer Security Audit (push) Has been skipped
🚀 Build & Deploy Image / Build Docker Image (push) Successful in 11s
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Failing after 1m12s
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been skipped
- fix-gitea-timeouts.yml: Add when conditions to wait_for and uri tasks - Wait for Traefik only if traefik_restart.changed - Wait for Gitea via Traefik only if traefik_restart or gitea_restart changed - fix-gitea-complete.yml: Same fixes as fix-gitea-timeouts.yml - Wait for Traefik only if traefik_restart.changed - Wait for Gitea and service discovery checks only if restart occurred - fix-gitea-traefik-connection.yml: Fix wait and test tasks - Register traefik_restart to track if restart happened - Wait for Traefik only if traefik_restart.changed - Test Gitea via Traefik only if traefik_restart.changed - Update message to reflect actual restart status - update-gitea-traefik-service.yml: Fix pause block - Register traefik_restart to track if restart happened - Wait for Traefik only if traefik_restart.changed This prevents unnecessary blocking when traefik_auto_restart=false and ensures wait/healthcheck tasks only run when a restart actually occurred.
160 lines
6.3 KiB
YAML
160 lines
6.3 KiB
YAML
---
|
||
# Fix Gitea Timeouts
|
||
# Startet Gitea und Traefik neu, um Timeout-Probleme zu beheben
|
||
- name: Fix Gitea Timeouts
|
||
hosts: production
|
||
gather_facts: yes
|
||
become: no
|
||
|
||
tasks:
|
||
- name: Check Gitea container status before restart
|
||
ansible.builtin.shell: |
|
||
cd /home/deploy/deployment/stacks/gitea
|
||
docker compose ps gitea
|
||
register: gitea_status_before
|
||
changed_when: false
|
||
|
||
- name: Display Gitea status before restart
|
||
ansible.builtin.debug:
|
||
msg: |
|
||
================================================================================
|
||
Gitea Status (Before Restart):
|
||
================================================================================
|
||
{{ gitea_status_before.stdout }}
|
||
================================================================================
|
||
|
||
- name: Check Traefik container status before restart
|
||
ansible.builtin.shell: |
|
||
cd /home/deploy/deployment/stacks/traefik
|
||
docker compose ps traefik
|
||
register: traefik_status_before
|
||
changed_when: false
|
||
|
||
- name: Display Traefik status before restart
|
||
ansible.builtin.debug:
|
||
msg: |
|
||
================================================================================
|
||
Traefik Status (Before Restart):
|
||
================================================================================
|
||
{{ traefik_status_before.stdout }}
|
||
================================================================================
|
||
|
||
- name: Restart Gitea container
|
||
ansible.builtin.shell: |
|
||
cd /home/deploy/deployment/stacks/gitea
|
||
docker compose restart gitea
|
||
register: gitea_restart
|
||
changed_when: gitea_restart.rc == 0
|
||
|
||
- name: Wait for Gitea to be ready
|
||
ansible.builtin.uri:
|
||
url: "https://git.michaelschiemer.de/api/healthz"
|
||
method: GET
|
||
status_code: [200]
|
||
validate_certs: false
|
||
timeout: 10
|
||
register: gitea_health_after_restart
|
||
until: gitea_health_after_restart.status == 200
|
||
retries: 30
|
||
delay: 2
|
||
changed_when: false
|
||
failed_when: false
|
||
|
||
- name: Display Gitea health after restart
|
||
ansible.builtin.debug:
|
||
msg: |
|
||
================================================================================
|
||
Gitea Health After Restart:
|
||
================================================================================
|
||
{% if gitea_health_after_restart.status == 200 %}
|
||
✅ Gitea is healthy after restart
|
||
{% else %}
|
||
⚠️ Gitea health check failed after restart (Status: {{ gitea_health_after_restart.status | default('TIMEOUT') }})
|
||
{% endif %}
|
||
================================================================================
|
||
|
||
- name: Restart Traefik to refresh service discovery
|
||
ansible.builtin.shell: |
|
||
cd /home/deploy/deployment/stacks/traefik
|
||
docker compose restart traefik
|
||
register: traefik_restart
|
||
changed_when: traefik_restart.rc == 0
|
||
when: traefik_auto_restart | default(false) | bool
|
||
|
||
- name: Wait for Traefik to be ready
|
||
ansible.builtin.wait_for:
|
||
timeout: 30
|
||
delay: 2
|
||
changed_when: false
|
||
when: traefik_restart.changed | default(false) | bool
|
||
|
||
- name: Wait for Gitea to be reachable via Traefik
|
||
ansible.builtin.uri:
|
||
url: "https://git.michaelschiemer.de/api/healthz"
|
||
method: GET
|
||
status_code: [200]
|
||
validate_certs: false
|
||
timeout: 10
|
||
register: gitea_health_via_traefik
|
||
until: gitea_health_via_traefik.status == 200
|
||
retries: 30
|
||
delay: 2
|
||
changed_when: false
|
||
failed_when: false
|
||
when: (traefik_restart.changed | default(false) | bool) or (gitea_restart.changed | default(false) | bool)
|
||
|
||
- name: Check final Gitea container status
|
||
ansible.builtin.shell: |
|
||
cd /home/deploy/deployment/stacks/gitea
|
||
docker compose ps gitea
|
||
register: gitea_status_after
|
||
changed_when: false
|
||
|
||
- name: Check final Traefik container status
|
||
ansible.builtin.shell: |
|
||
cd /home/deploy/deployment/stacks/traefik
|
||
docker compose ps traefik
|
||
register: traefik_status_after
|
||
changed_when: false
|
||
|
||
- name: Test Gitea access via Traefik
|
||
ansible.builtin.uri:
|
||
url: "https://git.michaelschiemer.de/api/healthz"
|
||
method: GET
|
||
status_code: [200]
|
||
validate_certs: false
|
||
timeout: 10
|
||
register: final_gitea_test
|
||
changed_when: false
|
||
failed_when: false
|
||
|
||
- name: Summary
|
||
ansible.builtin.debug:
|
||
msg: |
|
||
================================================================================
|
||
ZUSAMMENFASSUNG - Gitea Timeout Fix:
|
||
================================================================================
|
||
|
||
Gitea Restart: {% if gitea_restart.changed %}✅ Durchgeführt{% else %}ℹ️ Nicht nötig{% endif %}
|
||
Traefik Restart: {% if traefik_restart.changed %}✅ Durchgeführt{% else %}ℹ️ Nicht nötig{% endif %}
|
||
|
||
Final Status:
|
||
- Gitea: {{ gitea_status_after.stdout | regex_replace('.*(Up|Down|Restarting).*', '\\1') | default('UNKNOWN') }}
|
||
- Traefik: {{ traefik_status_after.stdout | regex_replace('.*(Up|Down|Restarting).*', '\\1') | default('UNKNOWN') }}
|
||
- Gitea via Traefik: {% if final_gitea_test.status == 200 %}✅ Erreichbar{% else %}❌ Nicht erreichbar (Status: {{ final_gitea_test.status | default('TIMEOUT') }}){% endif %}
|
||
|
||
{% if final_gitea_test.status == 200 %}
|
||
✅ Gitea ist jetzt über Traefik erreichbar!
|
||
URL: https://git.michaelschiemer.de
|
||
{% else %}
|
||
⚠️ Gitea ist noch nicht über Traefik erreichbar
|
||
|
||
Nächste Schritte:
|
||
1. Prüfe Gitea-Logs: cd /home/deploy/deployment/stacks/gitea && docker compose logs gitea --tail=50
|
||
2. Prüfe Traefik-Logs: cd /home/deploy/deployment/stacks/traefik && docker compose logs traefik --tail=50
|
||
3. Prüfe Netzwerk: docker network inspect traefik-public | grep -A 5 gitea
|
||
4. Führe diagnose-gitea-timeouts.yml aus für detaillierte Diagnose
|
||
{% endif %}
|
||
|
||
================================================================================
|