Add a script for installing gotify

This commit is contained in:
Manuel Thalmann 2025-02-19 18:54:13 +01:00
parent 5c191a3a43
commit 2cb0f752d9
3 changed files with 18 additions and 7 deletions

View file

@ -2,6 +2,8 @@ services:
gotify:
image: gotify/server
restart: unless-stopped
volumes:
- ./data/gotify:/app/data
environment:
GOTIFY_DATABASE_DIALECT: mysql
db:

View file

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

View file

@ -4,17 +4,18 @@ begin
set -l source "$dir/docker-compose.overrides.yml"
source "$dir/../service.fish"
function installSW -V dir -V domain -V source
function installSW -V dir -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/")
set -l db (yq "$dbKey" "$source" | sed "s/^\(.*:\).*\(@.*\)\$/\1$dbPw\2/")
echo "db: $db"
initializeServiceInstallation $argv
sudo cp "$dir/docker-compose.base.yml" (getServiceRoot $argv)
URL=$dbUrl yq "$dbKey = env(URL)" |
DB=$db yq "$dbKey = env(DB)" "$source" |
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
@ -26,8 +27,8 @@ begin
configureDockerService $argv
end
function getServiceServers -V domain
printf "%s\0" "$domain" ""
function getServiceServers
printf "%s\0" "push" ""
end
function getServiceLocations
@ -35,5 +36,13 @@ begin
printf "%s\0" "$_flag_name" /
end
function getExtraLocationSettings
printf "%s\n" \
'# Websocket' \
"proxy_http_version 1.1;" \
'proxy_set_header Upgrade $http_upgrade;' \
'proxy_set_header Connection "upgrade";'
end
runInstaller --force $argv
end