Add external volume to pod-cloud
This commit is contained in:
parent
ee61a4a3cb
commit
ce0cbe27af
@ -258,7 +258,8 @@ class DatasetRepoManager(RepoManager):
|
||||
|
||||
def __get_volume_datasets(self, root_dataset):
|
||||
zfs_list = subprocess.getoutput(
|
||||
f"zfs list -H -r {root_dataset} -o name,mountpoint"
|
||||
f"zfs list -H -r {root_dataset} "
|
||||
"-o name,mountpoint,eu.wojciechkozlowski:offsite-snapshot"
|
||||
)
|
||||
zfs_list_lines = zfs_list.split('\n')
|
||||
zfs_list_lines_items = map(lambda l: l.split(), zfs_list_lines)
|
||||
@ -269,7 +270,8 @@ class DatasetRepoManager(RepoManager):
|
||||
dataset,
|
||||
mountpoint,
|
||||
)
|
||||
for dataset, mountpoint in zfs_list_lines_items if os.path.ismount(mountpoint)
|
||||
for dataset, mountpoint, offsite_snapshot in zfs_list_lines_items
|
||||
if os.path.ismount(mountpoint) and (offsite_snapshot.lower() != "false")
|
||||
]
|
||||
|
||||
def restore(self):
|
||||
|
@ -39,6 +39,7 @@
|
||||
loop:
|
||||
- "pod-cloud.service"
|
||||
- "container-cloud-nginx.service"
|
||||
- "container-cloud-chown.service"
|
||||
- "container-cloud-nextcloud.service"
|
||||
- "container-cloud-cron.service"
|
||||
register: services_deploy_cloud_systemd_files
|
||||
|
@ -0,0 +1,28 @@
|
||||
[Unit]
|
||||
Description=Podman container-cloud-chown.service
|
||||
Documentation=man:podman-generate-systemd(1)
|
||||
After=pod-cloud.service
|
||||
Before=container-cloud-nextcloud.service container-cloud-cron.service
|
||||
OnFailure=status-mail@%n.service
|
||||
|
||||
[Service]
|
||||
Environment=PODMAN_SYSTEMD_UNIT=%n
|
||||
TimeoutStopSec=70
|
||||
ExecStartPre=/bin/rm -f %t/container-cloud-chown.pid %t/container-cloud-chown.ctr-id
|
||||
ExecStart=/usr/bin/podman run \
|
||||
--conmon-pidfile %t/container-cloud-chown.pid \
|
||||
--cidfile %t/container-cloud-chown.ctr-id \
|
||||
--cgroups=no-conmon \
|
||||
--pod-id-file %t/pod-cloud.pod-id \
|
||||
--replace \
|
||||
-v {{ services_data_directory }}/pod-cloud/external/_data:/media/external \
|
||||
--user=0 \
|
||||
--entrypoint="/bin/bash" \
|
||||
--name=pod-cloud-chown \
|
||||
docker.io/library/nextcloud:{{ services_deploy_versions.cloud.nextcloud }} \
|
||||
-c "chown -R www-data:www-data /media/external"
|
||||
ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/container-cloud-chown.ctr-id
|
||||
Type=oneshot
|
||||
|
||||
[Install]
|
||||
WantedBy=container-cloud-nextcloud.service container-cloud-cron.service
|
@ -4,7 +4,8 @@ Documentation=man:podman-generate-systemd(1)
|
||||
Wants=network.target
|
||||
After=network-online.target
|
||||
BindsTo=pod-cloud.service
|
||||
After=pod-cloud.service
|
||||
Requires=container-cloud-chown.service
|
||||
After=pod-cloud.service container-cloud-chown.service
|
||||
OnFailure=status-mail@%n.service
|
||||
|
||||
[Service]
|
||||
@ -24,6 +25,7 @@ ExecStart=/usr/bin/podman run \
|
||||
-v {{ services_root_directory }}/{{ services_resolv_host }}-resolv.conf:/etc/resolv.conf:ro \
|
||||
-v {{ services_data_directory }}/pod-cloud/nextcloud/_data:/var/www/html \
|
||||
-v {{ services_data_directory }}/pod-cloud/data/_data:/var/www/html/data \
|
||||
-v {{ services_data_directory }}/pod-cloud/external/_data:/media/external \
|
||||
--name=pod-cloud-cron \
|
||||
docker.io/library/nextcloud:{{ services_deploy_versions.cloud.nextcloud }} \
|
||||
/cron.sh
|
||||
|
@ -4,7 +4,8 @@ Documentation=man:podman-generate-systemd(1)
|
||||
Wants=network.target
|
||||
After=network-online.target
|
||||
BindsTo=pod-cloud.service
|
||||
After=pod-cloud.service
|
||||
Requires=container-cloud-chown.service
|
||||
After=pod-cloud.service container-cloud-chown.service
|
||||
OnFailure=status-mail@%n.service
|
||||
|
||||
[Service]
|
||||
@ -24,6 +25,7 @@ ExecStart=/usr/bin/podman run \
|
||||
-v {{ services_root_directory }}/{{ services_resolv_host }}-resolv.conf:/etc/resolv.conf:ro \
|
||||
-v {{ services_data_directory }}/pod-cloud/nextcloud/_data:/var/www/html \
|
||||
-v {{ services_data_directory }}/pod-cloud/data/_data:/var/www/html/data \
|
||||
-v {{ services_data_directory }}/pod-cloud/external/_data:/media/external \
|
||||
-v ./.config/pod-cloud/database.name:/run/secrets/database.name:ro \
|
||||
-v ./.config/pod-cloud/database.user:/run/secrets/database.user:ro \
|
||||
-v ./.config/pod-cloud/database.password:/run/secrets/database.password:ro \
|
||||
|
@ -16,6 +16,9 @@ services_volumes:
|
||||
cloud:
|
||||
nextcloud:
|
||||
data:
|
||||
external:
|
||||
extra_zfs_properties:
|
||||
"eu.wojciechkozlowski:offsite-snapshot=false"
|
||||
git:
|
||||
data:
|
||||
notes:
|
||||
|
Loading…
Reference in New Issue
Block a user