Move database mounts to use _data

This commit is contained in:
Wojciech Kozlowski 2022-11-02 20:24:38 +01:00
parent 581475c1fa
commit 1db7785dc4
4 changed files with 34 additions and 3 deletions

View File

@ -12,7 +12,22 @@ Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=on-failure
TimeoutStopSec=70
ExecStartPre=/bin/rm -f %t/container-database-postgres.pid %t/container-database-postgres.ctr-id
ExecStart=/usr/bin/podman run --conmon-pidfile %t/container-database-postgres.pid --cidfile %t/container-database-postgres.ctr-id --cgroups=no-conmon --pod-id-file %t/pod-database.pod-id --replace --label "io.containers.autoupdate=image" -dt -v /var/lib/yggdrasil/valkyrie-resolv.conf:/etc/resolv.conf:ro -v ./.config/pod-database/database.password:/run/secrets/database.password:ro -e POSTGRES_PASSWORD_FILE=/run/secrets/database.password -v /var/lib/yggdrasil/data/pod-database/wal:/var/lib/postgresql-wal -e POSTGRES_INITDB_WALDIR=/var/lib/postgresql-wal/waldir -v /var/lib/yggdrasil/data/pod-database/data:/var/lib/postgresql/data -e PGDATA=/var/lib/postgresql/data/pgdata --name=pod-database-postgres docker.io/library/postgres:15.0
ExecStart=/usr/bin/podman run \
--conmon-pidfile %t/container-database-postgres.pid \
--cidfile %t/container-database-postgres.ctr-id \
--cgroups=no-conmon \
--pod-id-file %t/pod-database.pod-id \
--replace \
--label "io.containers.autoupdate=image" \
-dt \
-v /var/lib/yggdrasil/valkyrie-resolv.conf:/etc/resolv.conf:ro \
-v ./.config/pod-database/database.password:/run/secrets/database.password:ro \
-e POSTGRES_PASSWORD_FILE=/run/secrets/database.password \
-v /var/lib/yggdrasil/data/pod-database/wal/_data:/var/lib/postgresql-wal \
-e POSTGRES_INITDB_WALDIR=/var/lib/postgresql-wal \
-v /var/lib/yggdrasil/data/pod-database/data/_data:/var/lib/postgresql/data \
--name=pod-database-postgres \
docker.io/library/postgres:15.0
ExecStop=/usr/bin/podman stop --ignore --cidfile %t/container-database-postgres.ctr-id -t 10
ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-database-postgres.ctr-id
PIDFile=%t/container-database-postgres.pid

View File

@ -14,6 +14,14 @@
group: "{{ service_user_name }}"
mode: 0755
- name: Create wal mount directory for user {{ service_user_name }}
file:
path: "/var/lib/{{ ansible_hostname }}/data/{{ service_user_name }}/wal/_data"
state: directory
owner: "{{ service_user_name }}"
group: "{{ service_user_name }}"
mode: 0755
- name: Create data directory for user {{ service_user_name }}
file:
path: "/var/lib/{{ ansible_hostname }}/data/{{ service_user_name }}/data"
@ -21,3 +29,11 @@
owner: "{{ service_user_name }}"
group: "{{ service_user_name }}"
mode: 0755
- name: Create data mount directory for user {{ service_user_name }}
file:
path: "/var/lib/{{ ansible_hostname }}/data/{{ service_user_name }}/data/_data"
state: directory
owner: "{{ service_user_name }}"
group: "{{ service_user_name }}"
mode: 0755

View File

@ -14,7 +14,7 @@
group: "{{ service_user_name }}"
mode: 0755
- name: Create etc-letsencrypt/_data directory for user {{ service_user_name }}
- name: Create etc-letsencrypt mount directory for user {{ service_user_name }}
file:
path: "/var/lib/{{ ansible_hostname }}/data/{{ service_user_name }}/etc-letsencrypt/_data"
state: directory

View File

@ -14,7 +14,7 @@
group: "{{ service_user_name }}"
mode: 0755
- name: Create etc-letsencrypt/_data directory for user {{ service_user_name }}
- name: Create etc-letsencrypt mount directory for user {{ service_user_name }}
file:
path: "/var/lib/{{ ansible_hostname }}/data/{{ service_user_name }}/etc-letsencrypt/_data"
state: directory