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