Add separate production, testserver, and demo deployments
CI / test (push) Failing after 10s

This commit is contained in:
2026-09-14 19:58:31 +02:00
parent b87aa0aa17
commit d06ff4a94a
37 changed files with 1293 additions and 121 deletions
+13
View File
@@ -0,0 +1,13 @@
[Unit]
Description=Reset Gardomatic demo data
After=postgresql.service
ConditionPathExists=/etc/gardomatic/demo-password
[Service]
Type=oneshot
User=gardomatic
Group=gardomatic
EnvironmentFile=/etc/gardomatic/gardomatic.env
WorkingDirectory=/var/lib/gardomatic
StandardInput=file:/etc/gardomatic/demo-password
ExecStart=/usr/local/bin/gardomatic-cli --yes demo reset --email ${GARDOMATIC_DEMO_ACCOUNT_EMAIL} --password-stdin
+10
View File
@@ -0,0 +1,10 @@
[Unit]
Description=Reset Gardomatic demo data every night
[Timer]
OnCalendar=*-*-* 04:00:00 Europe/Berlin
Persistent=true
Unit=gardomatic-demo-reset.service
[Install]
WantedBy=timers.target
+23 -3
View File
@@ -1,7 +1,7 @@
#!/bin/bash
set -Eeuo pipefail
# Installs artifacts uploaded by `make production/deploy`. Run as root or as an
# Installs artifacts uploaded by a Make deployment target. Run as root or as an
# administrator with passwordless sudo.
if [[ $(id -u) -ne 0 ]]; then
exec sudo -n "$0" "$@"
@@ -18,6 +18,8 @@ required_files=(
cli
api.service
web.service
demo-reset.service
demo-reset.timer
create-admin.sh
)
for file in "${required_files[@]}"; do
@@ -31,11 +33,11 @@ done
exit 1
}
[[ -f "$ENV_FILE" ]] || {
printf 'Missing runtime configuration: %s; run production/provision first.\n' "$ENV_FILE" >&2
printf 'Missing runtime configuration: %s; provision this deployment target first.\n' "$ENV_FILE" >&2
exit 1
}
id gardomatic >/dev/null 2>&1 || {
printf 'Missing service user gardomatic; run production/provision first.\n' >&2
printf 'Missing service user gardomatic; provision this deployment target first.\n' >&2
exit 1
}
@@ -49,6 +51,8 @@ rsync --archive --delete "$SCRIPT_DIR/migrations/" "$APPLICATION_DIR/migrations/
install -m 0644 -o root -g root "$SCRIPT_DIR/api.service" /etc/systemd/system/api.service
install -m 0644 -o root -g root "$SCRIPT_DIR/web.service" /etc/systemd/system/web.service
install -m 0644 -o root -g root "$SCRIPT_DIR/demo-reset.service" /etc/systemd/system/gardomatic-demo-reset.service
install -m 0644 -o root -g root "$SCRIPT_DIR/demo-reset.timer" /etc/systemd/system/gardomatic-demo-reset.timer
install -m 0755 -o root -g root "$SCRIPT_DIR/create-admin.sh" /usr/local/sbin/gardomatic-create-admin
# provision-server.sh writes a file compatible with systemd and Bash. Loading it
@@ -61,6 +65,22 @@ migrate -path "$APPLICATION_DIR/migrations" -database "$GARDOMATIC_DB_DSN" up
systemctl daemon-reload
systemctl enable api web
if [[ "${GARDOMATIC_DEMO_RESET_ENABLED:-false}" == true ]]; then
[[ -n "${GARDOMATIC_DEMO_ACCOUNT_EMAIL:-}" ]] || {
printf 'Demo reset is enabled, but GARDOMATIC_DEMO_ACCOUNT_EMAIL is empty.\n' >&2
exit 1
}
[[ -f /etc/gardomatic/demo-password ]] || {
printf 'Demo reset is enabled, but /etc/gardomatic/demo-password is missing.\n' >&2
exit 1
}
chown root:gardomatic /etc/gardomatic/demo-password
chmod 0640 /etc/gardomatic/demo-password
systemctl enable --now gardomatic-demo-reset.timer
systemctl start gardomatic-demo-reset.service
else
systemctl disable --now gardomatic-demo-reset.timer >/dev/null 2>&1 || true
fi
systemctl restart api web
printf 'Gardomatic deployment complete.\n'