Store domain names in overrides

This commit is contained in:
Manuel Thalmann 2024-11-27 03:41:26 +01:00
parent 6b511b5c59
commit 225d205910
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 source "$dir/docker-compose.core.yml"
set -l core "$root/$(basename "$source")" set -l core "$root/$(basename "$source")"
set -l domain (getServiceDomain $domain) 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 overrides (getServiceOverrides $argv)
set -l overridesSource "$dir/$(basename "$overrides")" set -l overridesSource "$dir/$(basename "$overrides")"
set -l turnKey "$(getServiceKey "$turn")" set -l turnKey "$(getServiceKey "$turn")"
@ -45,7 +43,7 @@ begin
set -l nextcloudPW ($genPW 64) set -l nextcloudPW ($genPW 64)
initializeServiceInstallation $argv 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 begin
printf "%s\n" \ printf "%s\n" \
@ -59,29 +57,21 @@ begin
begin begin
printf "%s\n" \ printf "%s\n" \
"NEXTCLOUD_ADMIN_USER=admin" \ "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 end | sudo tee "$root/nextcloud.env" >/dev/null
PROTO="https" DOMAIN="$domain" begin 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" set -l key "$turnKey.command"
PW="--static-auth-secret=$turnPW" \ PW="--static-auth-secret=$turnPW" \
DOMAIN="--realm=$domain" \ DOMAIN="--realm=$domain" \
yq "$key |= . + [env(PW), env(DOMAIN)]" "$overridesSource" | \ 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 sudo tee "$overrides" >/dev/null
end end

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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