Store domain names in overrides

This commit is contained in:
Manuel Thalmann 2024-11-27 03:41:26 +01:00
parent 3b489ee5fb
commit 5970d729af
7 changed files with 21 additions and 29 deletions

View file

@ -31,8 +31,6 @@ begin
set -l source "$dir/docker-compose.core.yml"
set -l core "$root/$(basename "$source")"
set -l domain (getServiceDomain $domain)
set -l base "$root/docker-compose.base.yml"
set -l baseSource "$dir/$(basename "$base")"
set -l overrides (getServiceOverrides $argv)
set -l overridesSource "$dir/$(basename "$overrides")"
set -l turnKey "$(getServiceKey "$turn")"
@ -45,7 +43,7 @@ begin
set -l nextcloudPW ($genPW 64)
initializeServiceInstallation $argv
sudo cp -r "$dir"/{cache.Dockerfile,cloud.Dockerfile,.dockerignore,fpm,nginx,php.ini} "$root"
sudo cp -r "$dir"/{cache.Dockerfile,cloud.Dockerfile,docker-compose.{base,core}.yml,.dockerignore,fpm,nginx,php.ini} "$root"
begin
printf "%s\n" \
@ -59,29 +57,21 @@ begin
begin
printf "%s\n" \
"NEXTCLOUD_ADMIN_USER=admin" \
"NEXTCLOUD_ADMIN_PASSWORD=$nextcloudPW"
"NEXTCLOUD_ADMIN_PASSWORD=$nextcloudPW" \
"NEXTCLOUD_TRUSTED_DOMAINS=$domain" \
"OVERWRITEPROTOCOL=https" \
"OVERWRITEHOST=$domain" \
"OVERWRITECLIURL=https://$domain"
end | sudo tee "$root/nextcloud.env" >/dev/null
PROTO="https" DOMAIN="$domain" begin
set -l envKey "$(getServiceKey nextcloud).environment"
yq "$envKey.NEXTCLOUD_TRUSTED_DOMAINS = env(DOMAIN)" "$source" | \
yq "$envKey.OVERWRITEPROTOCOL = env(PROTO)" | \
yq "$envKey.OVERWRITEHOST = env(DOMAIN)" | \
URL="$PROTO://$DOMAIN" yq "$envKey.OVERWRITECLIURL = env(URL)" | \
sudo tee "$core" >/dev/null
DOMAIN=(getServiceDomain $officeDomain) yq "$officeEnv.server_name = env(DOMAIN)" "$baseSource" | \
URL="https://$(string escape --style regex "$DOMAIN"):443" yq "$officeEnv.aliasgroup1 = env(URL)" | \
sudo tee "$base" >/dev/null
end
begin
set -l key "$turnKey.command"
PW="--static-auth-secret=$turnPW" \
DOMAIN="--realm=$domain" \
yq "$key |= . + [env(PW), env(DOMAIN)]" "$overridesSource" | \
DOMAIN=(getServiceDomain $officeDomain) yq "$officeEnv.server_name = env(DOMAIN)" | \
URL="https://$(string escape --style regex "$DOMAIN"):443" yq "$officeEnv.aliasgroup1 = env(URL)" | \
sudo tee "$overrides" >/dev/null
end

View file

@ -7,7 +7,6 @@ services:
- ./data/vault:/data
environment:
SMTP_HOST: bridge
SMTP_FROM: null
SMTP_FROM_VALUE: vaultwarden
SMTP_PORT: 25
SMTP_ACCEPT_INVALID_CERTS: "true"

View file

@ -1,6 +1,8 @@
services:
vaultwarden:
environment:
DOMAIN: null
SMTP_FROM: null
DATABASE_URL: mysql://vaultwarden:pw@db/vault
ports:
- 127.0.0.1:1337:80

View file

@ -12,12 +12,11 @@ begin
set -l dbKey "$envKey.DATABASE_URL"
set -l dbUrl (yq "$dbKey" "$source" | sed "s/^\(.*:\/\/.*:\).*\(@.*\/.*\)\$/\1$pw\2/")
initializeServiceInstallation $argv
cp "$dir/docker-compose.base.yml" (getServiceRoot $argv)
URL="https://$domain.$(getMachineFQDN)" yq "$envKey.DOMAIN = env(URL)" "$file" | \
ADDRESS="noreply@$(getMachineFQDN)" yq "$envKey.SMTP_FROM = env(ADDRESS)" | \
sudo tee "$(getServiceRoot $argv)/$(basename "$file")" >/dev/null
URL=$dbUrl yq "$dbKey = env(URL)" "$source" | \
URL="https://$domain.$(getMachineFQDN)" yq "$envKey.DOMAIN = env(URL)" "$source" | \
ADDRESS="no-reply@$(getMachineFQDN)" yq "$envKey.SMTP_FROM = env(ADDRESS)" | \
URL=$dbUrl yq "$dbKey = env(URL)" | \
PW=$pw yq ".services.db.environment.MARIADB_PASSWORD = env(PW)" | \
sudo tee (getServiceOverrides $argv) >/dev/null

View file

@ -7,7 +7,6 @@ services:
user: 1337:1337
environment:
WRITABLE_PATH: /data
ROOT_URL: https://example.com
MONGO_URL: mongodb://db:27017/wekan
MONGO_OPLOG_URL:
WITH_API: "true"

View file

@ -1,4 +1,6 @@
services:
wekan:
environment:
ROOT_URL: https://example.com
ports:
- 127.0.0.1:1337:8080

View file

@ -7,13 +7,14 @@ begin
function installSW -V dir -V service -V domain
set -l domain (getServiceDomain $domain)
set -l file "$dir/docker-compose.base.yml"
set -l overrides (getServiceOverrides $argv)
initializeServiceInstallation $argv
URL="https://$domain" yq "$(getServiceKey "$service").environment.DOMAIN = env(URL)" "$file" | \
sudo tee "$(getServiceRoot $argv)/$(basename "$file")" >/dev/null
sudo cp "$dir/docker-compose.base.yml" (getServiceRoot $argv)
URL="https://$domain" yq "$(getServiceKey "$service").environment.ROOT_URL = env(URL)" "$dir/$(basename "$overrides")" | \
sudo tee "$overrides" >/dev/null
sudo cp "$dir/docker-compose.overrides.yml" (getServiceRoot $argv)
installDockerService $argv
end