From aed297859ea85f902e72d08f92931c4b0af46ad0 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 7 Nov 2024 02:39:37 +0100 Subject: [PATCH] Add a function for initializing the service installation --- scripts/Common/Software/docker/services/anki-sync/main.fish | 1 + scripts/Common/Software/docker/services/service.fish | 6 ++++++ .../Common/Software/docker/services/vaultwarden/main.fish | 1 + 3 files changed, 8 insertions(+) diff --git a/scripts/Common/Software/docker/services/anki-sync/main.fish b/scripts/Common/Software/docker/services/anki-sync/main.fish index 100e69e4..c6545f9a 100644 --- a/scripts/Common/Software/docker/services/anki-sync/main.fish +++ b/scripts/Common/Software/docker/services/anki-sync/main.fish @@ -8,6 +8,7 @@ begin set -l pw (nix-shell -p keepassxc --run "keepassxc-cli generate --length 32") set -l userKey ".services.anki.environment.SYNC_USER1" set -l user (yq --raw-output "$userKey" "$source" | sed "s/:.*\$/:$pw/") + initializeServiceInstallation $argv sudo cp "$dir/docker-compose.yml" (getServiceRoot $argv) USER=$user yq "$userKey = env.USER" "$source" | \ diff --git a/scripts/Common/Software/docker/services/service.fish b/scripts/Common/Software/docker/services/service.fish index 9ba0aa68..aec1e1b2 100644 --- a/scripts/Common/Software/docker/services/service.fish +++ b/scripts/Common/Software/docker/services/service.fish @@ -28,6 +28,12 @@ begin echo ".services.$name.ports[0]" end + function initializeServiceInstallation -V nginxRoot + mkdir -p (getServiceRoot $argv) + mkdir -p "$nginxRoot" + mkdir -p (dirname (getServiceSecretsConfig $argv)) + end + function installDockerService -V dir -V nginxRoot -V portPattern set -l services (getServiceConfigs $argv | string split0) sudo cp (getServiceNginxConfigSource $argv) (__getServiceNginxConfig $argv) diff --git a/scripts/Common/Software/docker/services/vaultwarden/main.fish b/scripts/Common/Software/docker/services/vaultwarden/main.fish index 9d53bff7..1591cf40 100644 --- a/scripts/Common/Software/docker/services/vaultwarden/main.fish +++ b/scripts/Common/Software/docker/services/vaultwarden/main.fish @@ -8,6 +8,7 @@ begin set -l pw (nix-shell -p keepassxc --run "keepassxc-cli generate --length 32") set -l dbKey ".services.vaultwarden.environment.DATABASE_URL" set -l dbUrl (yq --raw-output "$dbKey" "$source" | sed "s/^\(.*:\/\/.*:\).*\(@.*\/.*\)\$/\1$pw\2/") + initializeServiceInstallation $argv sudo cp "$dir/docker-compose.yml" (getServiceRoot $argv) URL=$dbUrl yq "$dbKey = env.URL" "$source" | \