Add a function for initializing the service installation

This commit is contained in:
Manuel Thalmann 2024-11-07 02:39:37 +01:00
parent 5bf52a7816
commit aed297859e
3 changed files with 8 additions and 0 deletions

View file

@ -8,6 +8,7 @@ begin
set -l pw (nix-shell -p keepassxc --run "keepassxc-cli generate --length 32") set -l pw (nix-shell -p keepassxc --run "keepassxc-cli generate --length 32")
set -l userKey ".services.anki.environment.SYNC_USER1" set -l userKey ".services.anki.environment.SYNC_USER1"
set -l user (yq --raw-output "$userKey" "$source" | sed "s/:.*\$/:$pw/") set -l user (yq --raw-output "$userKey" "$source" | sed "s/:.*\$/:$pw/")
initializeServiceInstallation $argv
sudo cp "$dir/docker-compose.yml" (getServiceRoot $argv) sudo cp "$dir/docker-compose.yml" (getServiceRoot $argv)
USER=$user yq "$userKey = env.USER" "$source" | \ USER=$user yq "$userKey = env.USER" "$source" | \

View file

@ -28,6 +28,12 @@ begin
echo ".services.$name.ports[0]" echo ".services.$name.ports[0]"
end 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 function installDockerService -V dir -V nginxRoot -V portPattern
set -l services (getServiceConfigs $argv | string split0) set -l services (getServiceConfigs $argv | string split0)
sudo cp (getServiceNginxConfigSource $argv) (__getServiceNginxConfig $argv) sudo cp (getServiceNginxConfigSource $argv) (__getServiceNginxConfig $argv)

View file

@ -8,6 +8,7 @@ begin
set -l pw (nix-shell -p keepassxc --run "keepassxc-cli generate --length 32") set -l pw (nix-shell -p keepassxc --run "keepassxc-cli generate --length 32")
set -l dbKey ".services.vaultwarden.environment.DATABASE_URL" set -l dbKey ".services.vaultwarden.environment.DATABASE_URL"
set -l dbUrl (yq --raw-output "$dbKey" "$source" | sed "s/^\(.*:\/\/.*:\).*\(@.*\/.*\)\$/\1$pw\2/") set -l dbUrl (yq --raw-output "$dbKey" "$source" | sed "s/^\(.*:\/\/.*:\).*\(@.*\/.*\)\$/\1$pw\2/")
initializeServiceInstallation $argv
sudo cp "$dir/docker-compose.yml" (getServiceRoot $argv) sudo cp "$dir/docker-compose.yml" (getServiceRoot $argv)
URL=$dbUrl yq "$dbKey = env.URL" "$source" | \ URL=$dbUrl yq "$dbKey = env.URL" "$source" | \