Files
michaelschiemer/deployment/ansible/playbooks/restart-gitea-complete.yml
Michael Schiemer 36ef2a1e2c
Some checks failed
🚀 Build & Deploy Image / Determine Build Necessity (push) Failing after 10m14s
🚀 Build & Deploy Image / Build Runtime Base Image (push) Has been skipped
🚀 Build & Deploy Image / Build Docker Image (push) Has been skipped
🚀 Build & Deploy Image / Run Tests & Quality Checks (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been skipped
Security Vulnerability Scan / Check for Dependency Changes (push) Failing after 11m25s
Security Vulnerability Scan / Composer Security Audit (push) Has been cancelled
fix: Gitea Traefik routing and connection pool optimization
- Remove middleware reference from Gitea Traefik labels (caused routing issues)
- Optimize Gitea connection pool settings (MAX_IDLE_CONNS=30, authentication_timeout=180s)
- Add explicit service reference in Traefik labels
- Fix intermittent 504 timeouts by improving PostgreSQL connection handling

Fixes Gitea unreachability via git.michaelschiemer.de
2025-11-09 14:46:15 +01:00

96 lines
3.2 KiB
YAML

---
# Restart Gitea Complete - Stoppt und startet Gitea neu um alle Konfigurationsänderungen zu übernehmen
- name: Restart Gitea Complete
hosts: production
gather_facts: no
become: no
vars:
gitea_stack_path: "{{ stacks_base_path }}/gitea"
gitea_url: "https://{{ gitea_domain }}"
tasks:
- name: Check current Gitea environment variables
ansible.builtin.shell: |
cd {{ gitea_stack_path }}
docker compose exec -T gitea env | grep -E 'GITEA__database__' | sort || echo "Could not read environment variables"
register: gitea_env_before
changed_when: false
failed_when: false
- name: Display current environment variables
ansible.builtin.debug:
msg: |
Current Gitea Database Environment Variables:
{{ gitea_env_before.stdout }}
- name: Stop Gitea container completely
ansible.builtin.shell: |
cd {{ gitea_stack_path }}
docker compose stop gitea
register: gitea_stop
changed_when: gitea_stop.rc == 0
- name: Wait for Gitea to stop
ansible.builtin.pause:
seconds: 5
- name: Start Gitea container
ansible.builtin.shell: |
cd {{ gitea_stack_path }}
docker compose up -d gitea
register: gitea_start
changed_when: gitea_start.rc == 0
- name: Wait for Gitea to be ready
ansible.builtin.wait_for:
timeout: 60
delay: 5
- name: Check Gitea health after restart
ansible.builtin.uri:
url: "{{ gitea_url }}/api/healthz"
method: GET
validate_certs: false
timeout: 10
register: gitea_health_after
changed_when: false
failed_when: false
retries: 5
delay: 5
- name: Check environment variables after restart
ansible.builtin.shell: |
cd {{ gitea_stack_path }}
docker compose exec -T gitea env | grep -E 'GITEA__database__' | sort || echo "Could not read environment variables"
register: gitea_env_after
changed_when: false
failed_when: false
- name: Display restart results
ansible.builtin.debug:
msg: |
================================================================================
GITEA COMPLETE RESTART - RESULTS
================================================================================
Gitea Health After Restart:
- Status: {{ gitea_health_after.status | default('TIMEOUT') }}
{% if gitea_health_after.status | default(0) == 200 %}
✅ Gitea is healthy after restart
{% else %}
❌ Gitea health check failed (Status: {{ gitea_health_after.status | default('TIMEOUT') }})
{% endif %}
Environment Variables After Restart:
{{ gitea_env_after.stdout }}
{% if 'MAX_OPEN_CONNS' in gitea_env_after.stdout %}
✅ Connection pool settings are present
{% else %}
⚠️ Connection pool settings NOT found in environment variables
→ Check docker-compose.yml configuration
{% endif %}
================================================================================