Restructuring for new backup solution

This commit is contained in:
2025-07-16 19:09:31 +02:00
parent dea2669de2
commit 169493179e
38 changed files with 133 additions and 91 deletions

View File

@@ -1,7 +1,10 @@
# Administration
## Root Access
To access the database via the root account execute the following on the server:
```bash
docker exec -it "{{ applications['postgres'].hostname }}" psql -U postgres
# Assuming the container name is postgres
docker exec -it postgres psql -U postgres
```

View File

@@ -1,11 +1,14 @@
hostname: "svc-db-postgres"
network: "<< defaults_applications[svc-db-postgres].hostname >>"
docker:
services:
postgres:
# Postgis is necessary for mobilizon
image: postgis/postgis
image: postgis/postgis
name: postgres
# Please set an version in your inventory file!
# Rolling release isn't recommended
version: "latest"
volume: "<< defaults_applications[svc-db-postgres].hostname >>_data"
version: "latest"
backup:
datase_routine: true
volumes:
data: "postgres_data"
network: "postgres"

View File

@@ -8,7 +8,7 @@
- name: Install PostgreSQL
docker_container:
name: "{{ postgres_hostname }}"
name: "{{ postgres_name }}"
image: "{{ postgres_image }}:{{ postgres_version }}"
detach: yes
env:
@@ -31,7 +31,7 @@
when: run_once_docker_postgres is not defined
- name: Wait for Postgres inside the container
shell: "docker exec {{ postgres_hostname }} pg_isready -U postgres"
shell: "docker exec {{ postgres_name }} pg_isready -U postgres"
register: pg_ready
until: pg_ready.rc == 0
retries: 30

View File

@@ -1,6 +1,6 @@
application_id: svc-db-postgres
postgres_volume: "{{ applications | get_app_conf(application_id, 'docker.services.postgres.volume', True) }}"
postgres_hostname: "{{ applications | get_app_conf(application_id, 'hostname', True) }}"
postgres_volume: "{{ applications | get_app_conf(application_id, 'docker.volumes.data', True) }}"
postgres_name: "{{ applications | get_app_conf(application_id, 'docker.services.postgres.name', True) }}"
postgres_image: "{{ applications | get_app_conf(application_id, 'docker.services.postgres.image', True) }}"
postgres_subnet: "{{ networks.local['svc-db-postgres'].subnet }}"
postgres_network_name: "{{ applications | get_app_conf(application_id, 'network', True) }}"