Deploy to valhalla / deploy (push) Has been cancelled
Native OAuth/OIDC for Homarr, BookStack, Gitea, and MinIO console; forward_auth with local auth disabled for code-server, uptime, and kopia; Caddy and Authentik scripts updated to match.
49 lines
1.6 KiB
Bash
49 lines
1.6 KiB
Bash
#!/bin/sh
|
|
# One-time (or idempotent) Kopia repo + policy setup, then start server UI.
|
|
set -e
|
|
|
|
CONFIG_DIR=/app/config
|
|
export KOPIA_CONFIG_PATH="${CONFIG_DIR}/repository.config"
|
|
export KOPIA_PASSWORD="${KOPIA_REPOSITORY_PASSWORD}"
|
|
|
|
mkdir -p "${CONFIG_DIR}" /app/cache /app/logs
|
|
|
|
# Connect or create B2 repository when credentials are present.
|
|
if [ -n "${B2_KEY_ID}" ] && [ -n "${B2_APPLICATION_KEY}" ] && [ -n "${B2_BUCKET}" ]; then
|
|
if [ ! -f "${KOPIA_CONFIG_PATH}" ]; then
|
|
echo "init-kopia: creating S3 repository on bucket ${B2_BUCKET}"
|
|
kopia repository create s3 \
|
|
--bucket="${B2_BUCKET}" \
|
|
--access-key="${B2_KEY_ID}" \
|
|
--secret-access-key="${B2_APPLICATION_KEY}" \
|
|
--endpoint="${B2_ENDPOINT}" \
|
|
--password="${KOPIA_PASSWORD}"
|
|
else
|
|
echo "init-kopia: repository config exists, skipping create"
|
|
fi
|
|
|
|
while IFS= read -r path || [ -n "${path}" ]; do
|
|
case "${path}" in ''|\#*) continue ;; esac
|
|
kopia policy set "${path}" \
|
|
--keep-latest 14 \
|
|
--keep-daily 30 \
|
|
--keep-weekly 12 \
|
|
--keep-monthly 24 \
|
|
--compression=zstd \
|
|
--snapshot-time=03:00 \
|
|
--enable-actions=false \
|
|
2>/dev/null || kopia policy set "${path}" \
|
|
--keep-latest 14 \
|
|
--keep-daily 30 \
|
|
--keep-weekly 12 \
|
|
--keep-monthly 24 \
|
|
--compression=zstd \
|
|
--snapshot-time=03:00
|
|
done < /snapshot-paths.txt
|
|
else
|
|
echo "init-kopia: B2 credentials empty — start UI only; configure repo manually (see README)"
|
|
fi
|
|
|
|
# Web UI auth is handled by Caddy forward_auth — no second login prompt.
|
|
exec kopia server start --ui --insecure --address=0.0.0.0:51515 --without-password
|