Restructure service overrides
This commit is contained in:
parent
ac306226fc
commit
f05d134c66
13 changed files with 16 additions and 71 deletions
|
@ -2,8 +2,5 @@ services:
|
||||||
anki:
|
anki:
|
||||||
image: yangchuansheng/anki-sync-server
|
image: yangchuansheng/anki-sync-server
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
extends:
|
|
||||||
file: docker-compose.secrets.yml
|
|
||||||
service: anki
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./data:/ankisyncdir
|
- ./data:/ankisyncdir
|
|
@ -10,7 +10,7 @@ begin
|
||||||
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
|
initializeServiceInstallation $argv
|
||||||
sudo cp "$dir/docker-compose.yml" (getServiceRoot $argv)
|
sudo cp "$dir/docker-compose.base.yml" (getServiceRoot $argv)
|
||||||
|
|
||||||
USER=$user yq "$userKey = env.USER" "$source" | \
|
USER=$user yq "$userKey = env.USER" "$source" | \
|
||||||
sudo tee (getServiceSecretsConfig $argv) >/dev/null
|
sudo tee (getServiceSecretsConfig $argv) >/dev/null
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
include:
|
||||||
|
- path:
|
||||||
|
- docker-compose.base.yml
|
||||||
|
- docker-compose.secrets.yml
|
|
@ -3,18 +3,12 @@ services:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ci.Dockerfile
|
dockerfile: ci.Dockerfile
|
||||||
extends:
|
|
||||||
file: docker-compose.secrets.yml
|
|
||||||
service: template
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
env_file:
|
||||||
- server.common.env
|
- server.common.env
|
||||||
docker-template:
|
docker-template:
|
||||||
image: drone/drone-runner-docker
|
image: drone/drone-runner-docker
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
extends:
|
|
||||||
file: docker-compose.secrets.yml
|
|
||||||
service: template
|
|
||||||
depends_on: []
|
depends_on: []
|
||||||
env_file:
|
env_file:
|
||||||
- runner.common.env
|
- runner.common.env
|
||||||
|
@ -25,9 +19,6 @@ services:
|
||||||
ssh-template:
|
ssh-template:
|
||||||
image: drone/drone-runner-ssh
|
image: drone/drone-runner-ssh
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
extends:
|
|
||||||
file: docker-compose.secrets.yml
|
|
||||||
service: template
|
|
||||||
depends_on: []
|
depends_on: []
|
||||||
env_file:
|
env_file:
|
||||||
- runner.common.env
|
- runner.common.env
|
||||||
|
|
|
@ -10,7 +10,7 @@ begin
|
||||||
|
|
||||||
function installSW -V dir -V environments -V source
|
function installSW -V dir -V environments -V source
|
||||||
set -l root (getServiceRoot $argv)
|
set -l root (getServiceRoot $argv)
|
||||||
set -l config "$root/docker-compose.yml"
|
set -l config "$root/docker-compose.base.yml"
|
||||||
set -l secrets (getServiceSecretsConfig $argv)
|
set -l secrets (getServiceSecretsConfig $argv)
|
||||||
set -l ciTemplate (yq (getServiceKey ci-template) "$source")
|
set -l ciTemplate (yq (getServiceKey ci-template) "$source")
|
||||||
set -l dockerTemplate (yq (getServiceKey docker-template) "$source")
|
set -l dockerTemplate (yq (getServiceKey docker-template) "$source")
|
||||||
|
@ -91,24 +91,6 @@ begin
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l services (yq --raw-output0 ".services | keys[]" "$config" | string split0)
|
|
||||||
|
|
||||||
for service in $services
|
|
||||||
set -l file (mktemp)
|
|
||||||
set -l key "$(getServiceKey "$service").extends"
|
|
||||||
|
|
||||||
cat "$config" | if string match "*-ci" "$service" >/dev/null
|
|
||||||
SERVICE="$service" yq "$key.service |= env.SERVICE" "$config"
|
|
||||||
else
|
|
||||||
yq "del($key)" "$config"
|
|
||||||
end | \
|
|
||||||
yq -y "." | \
|
|
||||||
tee "$file" >/dev/null
|
|
||||||
|
|
||||||
sudo cp "$file" "$config"
|
|
||||||
rm "$file"
|
|
||||||
end
|
|
||||||
|
|
||||||
installDockerService $argv
|
installDockerService $argv
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,6 @@ services:
|
||||||
forgejo:
|
forgejo:
|
||||||
image: codeberg.org/forgejo/forgejo:7
|
image: codeberg.org/forgejo/forgejo:7
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
extends:
|
|
||||||
file: docker-compose.secrets.yml
|
|
||||||
service: forgejo
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
environment:
|
environment:
|
||||||
|
@ -31,9 +28,6 @@ services:
|
||||||
db:
|
db:
|
||||||
image: mariadb
|
image: mariadb
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
extends:
|
|
||||||
file: docker-compose.secrets.yml
|
|
||||||
service: db
|
|
||||||
environment:
|
environment:
|
||||||
MARIADB_RANDOM_ROOT_PASSWORD: "yes"
|
MARIADB_RANDOM_ROOT_PASSWORD: "yes"
|
||||||
MARIADB_AUTO_UPGRADE: "yes"
|
MARIADB_AUTO_UPGRADE: "yes"
|
|
@ -18,7 +18,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 port (getRandomPort)
|
set -l port (getRandomPort)
|
||||||
initializeServiceInstallation $argv
|
initializeServiceInstallation $argv
|
||||||
sudo cp "$dir/docker-compose.yml" "$root"
|
sudo cp "$dir/docker-compose.base.yml" "$root"
|
||||||
|
|
||||||
installDockerService $argv
|
installDockerService $argv
|
||||||
set port (yq (getSSHPortKey) "$source" --raw-output | mutatePort "$port")
|
set port (yq (getSSHPortKey) "$source" --raw-output | mutatePort "$port")
|
||||||
|
@ -47,7 +47,7 @@ begin
|
||||||
set -l root (getServiceRoot $argv)
|
set -l root (getServiceRoot $argv)
|
||||||
set -l dir "$root/data"
|
set -l dir "$root/data"
|
||||||
set -l bin "/usr/local/bin/forgejo"
|
set -l bin "/usr/local/bin/forgejo"
|
||||||
set -l config "$root/docker-compose.yml"
|
set -l config "$root/docker-compose.base.yml"
|
||||||
set -l secrets (getServiceSecretsConfig $argv)
|
set -l secrets (getServiceSecretsConfig $argv)
|
||||||
set -l envKey "$(getServiceKey "$service").environment"
|
set -l envKey "$(getServiceKey "$service").environment"
|
||||||
configureDockerService $argv
|
configureDockerService $argv
|
||||||
|
@ -93,7 +93,7 @@ begin
|
||||||
end
|
end
|
||||||
|
|
||||||
function getBackupArgs -V root
|
function getBackupArgs -V root
|
||||||
printf "%s\n" --hidden --no-ignore . --exclude "docker-compose.yml" "$root"
|
printf "%s\n" --hidden --no-ignore . --exclude "docker-compose.yml" --exclude "docker-compose.base.yml" "$root"
|
||||||
end
|
end
|
||||||
|
|
||||||
runInstaller --force $argv
|
runInstaller --force $argv
|
||||||
|
|
|
@ -2,9 +2,6 @@ services:
|
||||||
jellyfin:
|
jellyfin:
|
||||||
image: jellyfin/jellyfin
|
image: jellyfin/jellyfin
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
extends:
|
|
||||||
file: docker-compose.secrets.yml
|
|
||||||
service: jellyfin
|
|
||||||
user: 1337:1337
|
user: 1337:1337
|
||||||
hostname: Jellyfin
|
hostname: Jellyfin
|
||||||
environment: {}
|
environment: {}
|
||||||
|
@ -15,9 +12,6 @@ services:
|
||||||
radarr:
|
radarr:
|
||||||
image: linuxserver/radarr
|
image: linuxserver/radarr
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
extends:
|
|
||||||
file: docker-compose.secrets.yml
|
|
||||||
service: radarr
|
|
||||||
environment:
|
environment:
|
||||||
PUID: 1337
|
PUID: 1337
|
||||||
PGID: 1337
|
PGID: 1337
|
||||||
|
@ -29,9 +23,6 @@ services:
|
||||||
sonarr:
|
sonarr:
|
||||||
image: linuxserver/sonarr
|
image: linuxserver/sonarr
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
extends:
|
|
||||||
file: docker-compose.secrets.yml
|
|
||||||
service: sonarr
|
|
||||||
environment:
|
environment:
|
||||||
PUID: 1337
|
PUID: 1337
|
||||||
PGID: 1337
|
PGID: 1337
|
||||||
|
@ -43,9 +34,6 @@ services:
|
||||||
lidarr:
|
lidarr:
|
||||||
image: linuxserver/lidarr
|
image: linuxserver/lidarr
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
extends:
|
|
||||||
file: docker-compose.secrets.yml
|
|
||||||
service: lidarr
|
|
||||||
environment:
|
environment:
|
||||||
PUID: 1337
|
PUID: 1337
|
||||||
PGID: 1337
|
PGID: 1337
|
||||||
|
@ -57,9 +45,6 @@ services:
|
||||||
prowlarr:
|
prowlarr:
|
||||||
image: linuxserver/prowlarr
|
image: linuxserver/prowlarr
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
extends:
|
|
||||||
file: docker-compose.secrets.yml
|
|
||||||
service: prowlarr
|
|
||||||
environment:
|
environment:
|
||||||
PUID: 1337
|
PUID: 1337
|
||||||
PGID: 1337
|
PGID: 1337
|
||||||
|
@ -85,9 +70,6 @@ services:
|
||||||
flood:
|
flood:
|
||||||
image: jesec/flood
|
image: jesec/flood
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
extends:
|
|
||||||
file: docker-compose.secrets.yml
|
|
||||||
service: flood
|
|
||||||
user: 1337:1337
|
user: 1337:1337
|
||||||
command: --baseuri /flood
|
command: --baseuri /flood
|
||||||
--rundir /flood
|
--rundir /flood
|
|
@ -16,7 +16,7 @@ begin
|
||||||
set -l port (getRandomPort)
|
set -l port (getRandomPort)
|
||||||
set -l servarrKeys
|
set -l servarrKeys
|
||||||
initializeServiceInstallation $argv
|
initializeServiceInstallation $argv
|
||||||
sudo cp "$dir/docker-compose.yml" "$root"
|
sudo cp "$dir/docker-compose.base.yml" "$root"
|
||||||
sudo cp "$dir/.dockerignore" "$root"
|
sudo cp "$dir/.dockerignore" "$root"
|
||||||
sudo cp "$dir/pvpn-cli.py" "$root"
|
sudo cp "$dir/pvpn-cli.py" "$root"
|
||||||
sudo cp "$dir/rtorrent.Dockerfile" "$root"
|
sudo cp "$dir/rtorrent.Dockerfile" "$root"
|
||||||
|
@ -32,7 +32,7 @@ begin
|
||||||
set -l file (mktemp)
|
set -l file (mktemp)
|
||||||
set -l root (getServiceRoot $argv)
|
set -l root (getServiceRoot $argv)
|
||||||
set -l bin "/usr/local/bin/forgejo"
|
set -l bin "/usr/local/bin/forgejo"
|
||||||
set -l config "$root/docker-compose.yml"
|
set -l config "$root/docker-compose.base.yml"
|
||||||
set -l secrets (getServiceSecretsConfig $argv)
|
set -l secrets (getServiceSecretsConfig $argv)
|
||||||
set -l envKey "$(getServiceKey "$service").environment"
|
set -l envKey "$(getServiceKey "$service").environment"
|
||||||
configureDockerService $argv
|
configureDockerService $argv
|
||||||
|
@ -139,7 +139,7 @@ begin
|
||||||
end
|
end
|
||||||
|
|
||||||
function getBackupArgs -V root
|
function getBackupArgs -V root
|
||||||
printf "%s\n" --hidden --no-ignore . --exclude "docker-compose.yml" "$root"
|
printf "%s\n" --hidden --no-ignore . --exclude "docker-compose.yml" --exclude "docker-compose.base.yml" "$root"
|
||||||
end
|
end
|
||||||
|
|
||||||
runInstaller --force $argv
|
runInstaller --force $argv
|
||||||
|
|
|
@ -111,10 +111,11 @@ begin
|
||||||
function getExtraLocationSettings -a domain service location
|
function getExtraLocationSettings -a domain service location
|
||||||
end
|
end
|
||||||
|
|
||||||
function initializeServiceInstallation -V nginxRoot
|
function initializeServiceInstallation -V dir -V nginxRoot
|
||||||
sudo mkdir -p (getServiceRoot $argv)
|
sudo mkdir -p (getServiceRoot $argv)
|
||||||
sudo mkdir -p "$nginxRoot"
|
sudo mkdir -p "$nginxRoot"
|
||||||
sudo mkdir -p (dirname (getServiceSecretsConfig $argv))
|
sudo mkdir -p (dirname (getServiceSecretsConfig $argv))
|
||||||
|
sudo cp "$dir/docker-compose.yml" "$root"
|
||||||
end
|
end
|
||||||
|
|
||||||
function installDockerService -V dir -V nginxRoot
|
function installDockerService -V dir -V nginxRoot
|
||||||
|
@ -171,6 +172,6 @@ begin
|
||||||
end
|
end
|
||||||
|
|
||||||
function getBackupArgs
|
function getBackupArgs
|
||||||
printf "%s\n" --hidden --no-ignore . --exclude "docker-compose.yml" (getServiceRoot $argv)
|
printf "%s\n" --hidden --no-ignore . --exclude "docker-compose"{,.base}".yml" (getServiceRoot $argv)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,9 +2,6 @@ services:
|
||||||
vaultwarden:
|
vaultwarden:
|
||||||
image: vaultwarden/server
|
image: vaultwarden/server
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
extends:
|
|
||||||
file: docker-compose.secrets.yml
|
|
||||||
service: vaultwarden
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./data:/data
|
- ./data:/data
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
@ -20,9 +17,6 @@ services:
|
||||||
db:
|
db:
|
||||||
image: mariadb
|
image: mariadb
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
extends:
|
|
||||||
file: docker-compose.secrets.yml
|
|
||||||
service: db
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./db:/var/lib/mysql
|
- ./db:/var/lib/mysql
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
|
@ -6,7 +6,7 @@ begin
|
||||||
source "$dir/../service.fish"
|
source "$dir/../service.fish"
|
||||||
|
|
||||||
function installSW -V dir -V domain -V source
|
function installSW -V dir -V domain -V source
|
||||||
set -l file "$dir/docker-compose.yml"
|
set -l file "$dir/docker-compose.base.yml"
|
||||||
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 envKey ".services.vaultwarden.environment"
|
set -l envKey ".services.vaultwarden.environment"
|
||||||
set -l dbKey "$envKey.DATABASE_URL"
|
set -l dbKey "$envKey.DATABASE_URL"
|
||||||
|
|
Loading…
Reference in a new issue