From 1db7785dc4c70374bb3ae3c0a68b4fd59548ad4b Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Wed, 2 Nov 2022 20:24:38 +0100 Subject: [PATCH] Move database mounts to use _data --- .../user/container-database-postgres.service.j2 | 17 ++++++++++++++++- .../service-user/01-user.d/data/database.yml | 16 ++++++++++++++++ .../service-user/01-user.d/data/lrproxy.yml | 2 +- .../service-user/01-user.d/data/rproxy.yml | 2 +- 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/playbooks/filesystem/yggdrasil/var/lib/yggdrasil/home/pod-database/.config/systemd/user/container-database-postgres.service.j2 b/playbooks/filesystem/yggdrasil/var/lib/yggdrasil/home/pod-database/.config/systemd/user/container-database-postgres.service.j2 index a104e36..4f0259c 100644 --- a/playbooks/filesystem/yggdrasil/var/lib/yggdrasil/home/pod-database/.config/systemd/user/container-database-postgres.service.j2 +++ b/playbooks/filesystem/yggdrasil/var/lib/yggdrasil/home/pod-database/.config/systemd/user/container-database-postgres.service.j2 @@ -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 diff --git a/playbooks/tasks/services/b-user/service-user/01-user.d/data/database.yml b/playbooks/tasks/services/b-user/service-user/01-user.d/data/database.yml index a132226..25cc8d8 100644 --- a/playbooks/tasks/services/b-user/service-user/01-user.d/data/database.yml +++ b/playbooks/tasks/services/b-user/service-user/01-user.d/data/database.yml @@ -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 diff --git a/playbooks/tasks/services/b-user/service-user/01-user.d/data/lrproxy.yml b/playbooks/tasks/services/b-user/service-user/01-user.d/data/lrproxy.yml index e440369..e081d39 100644 --- a/playbooks/tasks/services/b-user/service-user/01-user.d/data/lrproxy.yml +++ b/playbooks/tasks/services/b-user/service-user/01-user.d/data/lrproxy.yml @@ -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 diff --git a/playbooks/tasks/services/b-user/service-user/01-user.d/data/rproxy.yml b/playbooks/tasks/services/b-user/service-user/01-user.d/data/rproxy.yml index e440369..e081d39 100644 --- a/playbooks/tasks/services/b-user/service-user/01-user.d/data/rproxy.yml +++ b/playbooks/tasks/services/b-user/service-user/01-user.d/data/rproxy.yml @@ -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