Add script for installing Gotify

This commit is contained in:
Manuel Thalmann 2025-02-18 22:05:20 +01:00
parent 8cb2f86571
commit 5c191a3a43
3 changed files with 64 additions and 0 deletions

View file

@ -0,0 +1,13 @@
services:
gotify:
image: gotify/server
restart: unless-stopped
environment:
GOTIFY_DATABASE_DIALECT: mysql
db:
image: mariadb
restart: unless-stopped
volumes:
- ./data/db:/var/lib/mysql
environment:
MARIADB_RANDOM_ROOT_PASSWORD: "yes"

View file

@ -0,0 +1,12 @@
services:
vaultwarden:
environment:
GOTIFY_DEFAULTUSER_PASS: null
DATABASE_URL: gotify:pw@tcp(db:3306)/Gotify?charset=utf8&parseTime=true&loc=Local
ports:
- 127.0.0.1:1337:80
db:
environment:
MARIADB_USER: gotify
MARIADB_PASSWORD: pw
MARIADB_DATABASE: Gotify

View file

@ -0,0 +1,39 @@
#!/bin/env fish
begin
set -l dir (status dirname)
set -l source "$dir/docker-compose.overrides.yml"
source "$dir/../service.fish"
function installSW -V dir -V domain -V source
set -l file "$dir/docker-compose.base.yml"
set -l pw (nix-shell -p keepassxc --run "keepassxc-cli generate --length 32")
set -l dbPw (nix-shell -p keepassxc --run "keepassxc-cli generate --length 32")
set -l envKey ".services.gotify.environment"
set -l dbKey "$envKey.GOTIFY_DATABASE_CONNECTION"
set -l dbUrl (yq "$dbKey" "$source" | sed "s/^\(.*:).*@/\1$dbPw/")
initializeServiceInstallation $argv
sudo cp "$dir/docker-compose.base.yml" (getServiceRoot $argv)
URL=$dbUrl yq "$dbKey = env(URL)" |
PW=$pw yq "$envKey.GOTIFY_DEFAULTUSER_PASS = env(PW)" |
PW=$dbPw yq ".services.db.environment.MARIADB_PASSWORD = env(PW)" |
sudo tee (getServiceOverrides $argv) >/dev/null
installDockerService $argv
end
function configureSW -V dir
configureDockerService $argv
end
function getServiceServers -V domain
printf "%s\0" "$domain" ""
end
function getServiceLocations
argparse -i "name=" -- $argv
printf "%s\0" "$_flag_name" /
end
runInstaller --force $argv
end