66 lines
1.8 KiB
Bash
Executable File
66 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
NC_URL="${NC_URL:-https://cloud.bstein.dev}"
|
|
ADMIN_USER="${ADMIN_USER:?}"
|
|
ADMIN_PASS="${ADMIN_PASS:?}"
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
apt-get update -qq
|
|
apt-get install -y -qq curl jq >/dev/null
|
|
|
|
run_occ() {
|
|
runuser -u www-data -- php occ "$@"
|
|
}
|
|
|
|
log() { echo "[$(date -Is)] $*"; }
|
|
|
|
log "Applying Atlas theming"
|
|
run_occ theming:config name "Atlas Cloud"
|
|
run_occ theming:config slogan "Unified access to Atlas services"
|
|
run_occ theming:config url "https://cloud.bstein.dev"
|
|
run_occ theming:config color "#0f172a"
|
|
run_occ theming:config disable-user-theming yes
|
|
|
|
log "Setting default quota to 200 GB"
|
|
run_occ config:app:set files default_quota --value "200 GB"
|
|
|
|
API_BASE="${NC_URL}/ocs/v2.php/apps/external/api/v1"
|
|
AUTH=(-u "${ADMIN_USER}:${ADMIN_PASS}" -H "OCS-APIRequest: true")
|
|
|
|
log "Removing existing external links"
|
|
existing=$(curl -sf "${AUTH[@]}" "${API_BASE}?format=json" | jq -r '.ocs.data[].id // empty')
|
|
for id in ${existing}; do
|
|
curl -sf "${AUTH[@]}" -X DELETE "${API_BASE}/sites/${id}?format=json" >/dev/null || true
|
|
done
|
|
|
|
SITES=(
|
|
"Vaultwarden|https://vault.bstein.dev"
|
|
"Jellyfin|https://stream.bstein.dev"
|
|
"Gitea|https://scm.bstein.dev"
|
|
"Jenkins|https://ci.bstein.dev"
|
|
"Zot|https://registry.bstein.dev"
|
|
"Vault|https://secret.bstein.dev"
|
|
"Jitsi|https://meet.bstein.dev"
|
|
"Grafana|https://metrics.bstein.dev"
|
|
"Chat LLM|https://chat.ai.bstein.dev"
|
|
"Vision|https://draw.ai.bstein.dev"
|
|
"STT/TTS|https://talk.ai.bstein.dev"
|
|
)
|
|
|
|
log "Seeding external links"
|
|
for entry in "${SITES[@]}"; do
|
|
IFS="|" read -r name url <<<"${entry}"
|
|
curl -sf "${AUTH[@]}" -X POST "${API_BASE}/sites?format=json" \
|
|
-d "name=${name}" \
|
|
-d "url=${url}" \
|
|
-d "lang=" \
|
|
-d "type=link" \
|
|
-d "device=" \
|
|
-d "icon=" \
|
|
-d "groups[]=" \
|
|
-d "redirect=1" >/dev/null
|
|
done
|
|
|
|
log "Maintenance run completed"
|