fix: Gitea Traefik routing and connection pool optimization
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
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
- 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
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
---
|
||||
# PostgreSQL Production Stack - Default Variables
|
||||
|
||||
# Stack path on target host
|
||||
postgresql_production_stack_path: "{{ stacks_base_path }}/postgresql-production"
|
||||
|
||||
# Wait configuration
|
||||
postgresql_production_wait_timeout: "{{ wait_timeout | default(60) }}"
|
||||
postgresql_production_wait_interval: 5
|
||||
|
||||
# Database configuration (from vault or defaults)
|
||||
postgresql_production_db_name: "{{ vault_db_name | default('michaelschiemer') }}"
|
||||
postgresql_production_db_user: "{{ vault_db_user | default('postgres') }}"
|
||||
postgresql_production_db_password: "{{ vault_db_password | default('') }}"
|
||||
|
||||
# Backup configuration
|
||||
postgresql_production_backup_retention_days: 7
|
||||
postgresql_production_backup_schedule: "0 2 * * *"
|
||||
|
||||
# Template used to generate the PostgreSQL .env file
|
||||
postgresql_production_env_template: "{{ role_path }}/templates/postgresql.env.j2"
|
||||
@@ -0,0 +1,69 @@
|
||||
---
|
||||
- name: Set PostgreSQL Production variables for template
|
||||
ansible.builtin.set_fact:
|
||||
postgres_db: "{{ postgresql_production_db_name }}"
|
||||
postgres_user: "{{ postgresql_production_db_user }}"
|
||||
postgres_password: "{{ postgresql_production_db_password }}"
|
||||
backup_retention_days: "{{ postgresql_production_backup_retention_days }}"
|
||||
backup_schedule: "{{ postgresql_production_backup_schedule }}"
|
||||
no_log: yes
|
||||
|
||||
- name: Validate PostgreSQL Production password is set
|
||||
ansible.builtin.fail:
|
||||
msg: |
|
||||
PostgreSQL Production password is not set!
|
||||
|
||||
Please ensure vault_db_password is defined in:
|
||||
- {{ vault_file | default('inventory/group_vars/production/vault.yml') }}
|
||||
|
||||
Or pass it via extra vars:
|
||||
-e "postgresql_production_db_password=your-password"
|
||||
when: (postgresql_production_db_password | default('') | string | trim) == ''
|
||||
|
||||
- name: Create PostgreSQL Production .env file from vault secrets
|
||||
ansible.builtin.template:
|
||||
src: postgresql.env.j2
|
||||
dest: "{{ postgresql_production_stack_path }}/.env"
|
||||
mode: '0600'
|
||||
|
||||
- name: Deploy PostgreSQL Production stack
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: "{{ postgresql_production_stack_path }}"
|
||||
state: present
|
||||
pull: always
|
||||
register: postgresql_production_compose_result
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Show PostgreSQL Production logs if deployment failed
|
||||
shell: |
|
||||
docker compose -f {{ postgresql_production_stack_path }}/docker-compose.yml logs --tail=50 postgres-production
|
||||
register: postgresql_production_logs
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
when: postgresql_production_compose_result.failed | default(false)
|
||||
|
||||
- name: Display PostgreSQL Production logs on failure
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ postgresql_production_logs.stdout_lines | default([]) }}"
|
||||
when: postgresql_production_compose_result.failed | default(false)
|
||||
|
||||
- name: Check PostgreSQL Production container status
|
||||
shell: |
|
||||
docker compose -f {{ postgresql_production_stack_path }}/docker-compose.yml ps postgres-production | grep -Eiq "Up|running|healthy"
|
||||
register: postgresql_production_state
|
||||
changed_when: false
|
||||
until: postgresql_production_state.rc == 0
|
||||
retries: "{{ ((postgresql_production_wait_timeout | int) + (postgresql_production_wait_interval | int) - 1) // (postgresql_production_wait_interval | int) }}"
|
||||
delay: "{{ postgresql_production_wait_interval | int }}"
|
||||
failed_when: postgresql_production_state.rc != 0
|
||||
when: not ansible_check_mode
|
||||
|
||||
- name: Fail if PostgreSQL Production deployment failed
|
||||
ansible.builtin.fail:
|
||||
msg: "PostgreSQL Production stack deployment failed. Check logs above for details."
|
||||
when: postgresql_production_compose_result.failed | default(false)
|
||||
|
||||
- name: Record PostgreSQL Production deployment facts
|
||||
set_fact:
|
||||
postgresql_production_stack_changed: "{{ postgresql_production_compose_result.changed | default(false) }}"
|
||||
postgresql_production_log_hint: ""
|
||||
@@ -0,0 +1,14 @@
|
||||
# PostgreSQL Stack Configuration
|
||||
# Managed by Ansible - DO NOT EDIT MANUALLY
|
||||
|
||||
# Timezone
|
||||
TZ=Europe/Berlin
|
||||
|
||||
# PostgreSQL Configuration
|
||||
POSTGRES_DB={{ postgres_db }}
|
||||
POSTGRES_USER={{ postgres_user }}
|
||||
POSTGRES_PASSWORD={{ postgres_password }}
|
||||
|
||||
# Backup Configuration
|
||||
BACKUP_RETENTION_DAYS={{ backup_retention_days }}
|
||||
BACKUP_SCHEDULE={{ backup_schedule }}
|
||||
Reference in New Issue
Block a user