Changeset bb42dfb in Klonkt
- Timestamp:
- 06/23/2026 05:35:46 PM (3 months ago)
- Branches:
- main
- Children:
- 834bcc3
- Parents:
- bbbfa3c
- Files:
-
- 2 edited
-
.env.example (modified) (2 diffs)
-
scripts/install.sh (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
.env.example
rbbbfa3c rbb42dfb 5 5 MEDIA_PATH=./storage/media 6 6 7 # Canoni eke publieke URL van deze site (scheme + host, geen pad/slash). Gebruikt8 # voor links in e-mails (wachtwoord-reset) i.p.v. request-headers — voorkomt9 # host-header -spoofing. Niet gezet? Dan valt het terug op de request-host (dev).7 # Canonical public URL of this site (scheme + host, no path/slash). Used for 8 # links in emails (password reset) instead of request headers — prevents 9 # host-header spoofing. Not set? Then it falls back to the request host (dev). 10 10 PUBLIC_BASE_URL=https://example.com 11 11 12 # ── Beheerder ───────────────────────────────────────────────────────13 # De beheerder logt in met gebruikersnaam + wachtwoord. Bij de eerste keer14 # opstarten maak je via /auth/register je beheerdersaccount aan; daarna is15 # registratie gesloten. Wachtwoord vergeten? -> "Wachtwoord vergeten" (mail,16 # zie SMTP hieronder) of altijd: `npm run reset-admin` op de server.12 # ── Administrator ─────────────────────────────────────────────────── 13 # The admin logs in with username + password. On first start you create your 14 # admin account via /auth/register; after that, registration is closed. 15 # Forgot your password? -> "Forgot password" (email, see SMTP below) or always: 16 # `npm run reset-admin` on the server. 17 17 18 # ── Google login voor LUISTERAARS (optioneel) ─────────────────────── 19 # Wil je dat luisteraars met Google kunnen inloggen om te reageren? Maak dan 20 # een EIGEN Google OAuth-client aan (Google Cloud Console -> Credentials -> 21 # OAuth client ID -> "Web application") en vul hieronder in. Eigen client = 22 # eigen Google Cloud project; deze site hangt nergens centraal aan vast. 23 # Niet ingesteld? Dan is er simpelweg geen Google-knop. Google-login geeft 24 # NOOIT beheerrechten (alleen reageren). 25 # GOOGLE_REDIRECT_URI = <jouw domein>/auth/google/callback (exact in de client zetten) 18 # ── Google login for LISTENERS (optional) ─────────────────────────── 19 # Want listeners to sign in with Google to comment? Create your OWN Google OAuth 20 # client (Google Cloud Console -> Credentials -> OAuth client ID -> "Web 21 # application") and fill it in below. Your own client = your own Google Cloud 22 # project; this site isn't centrally tied to anything. Not set? Then there's 23 # simply no Google button. Google login NEVER grants admin rights (commenting only). 24 # GOOGLE_REDIRECT_URI = <your domain>/auth/google/callback (set it exactly in the client) 26 25 GOOGLE_CLIENT_ID= 27 26 GOOGLE_CLIENT_SECRET= 28 27 GOOGLE_REDIRECT_URI=https://example.com/auth/google/callback 29 28 30 # ── E -mail (optioneel) — voor "wachtwoord vergeten" reset-links─────31 # N iet ingesteld? Dan werkt reset alleen via `npm run reset-admin` op de server.29 # ── Email (optional) — for "forgot password" reset links ──────────── 30 # Not set? Then reset only works via `npm run reset-admin` on the server. 32 31 SMTP_HOST= 33 32 SMTP_PORT=587 … … 36 35 SMTP_FROM= 37 36 38 # ── Lite -modus (optioneel)─────────────────────────────────────────39 # Zet op "off" om de hele audio-feature uit te schakelen (geen eigen muziek-40 # hosting/speler, geen ffmpeg nodig). Klonkt draait dan als lichte blog/foto/41 # EPK-site, ook op een omgeving zonder ffmpeg. Hub en Cirkels blijven werken.42 # Extern e embeds (YouTube/SoundCloud/Spotify) blijven ook werken.37 # ── Lite mode (optional) ──────────────────────────────────────────── 38 # Set to "off" to disable the whole audio feature (no built-in music hosting/ 39 # player, no ffmpeg needed). Klonkt then runs as a lightweight blog/photo/EPK 40 # site, even on an environment without ffmpeg. Hub and Circles keep working. 41 # External embeds (YouTube/SoundCloud/Spotify) keep working too. 43 42 KLONKT_AUDIO=on -
scripts/install.sh
rbbbfa3c rbb42dfb 1 1 #!/usr/bin/env bash 2 2 # 3 # Klonkt — installer voor eenDebian/Ubuntu VPS.4 # Install eert Node 20, Caddy (automatische HTTPS) en Klonkt als systemd-service.5 # 6 # Veilig op een server die AL iets draait: upgradet je systeem-Node niet,7 # kiest automatisch een vrije poort, en slaat Caddy over als er al een8 # webserver/reverse-proxy op poort 80/443 luistert (dan krijg je instructies9 # o m Klonkt achter je eigen proxy te zetten).10 # 11 # Gebruik (als root), niet-interactief:3 # Klonkt — installer for a Debian/Ubuntu VPS. 4 # Installs Node 20, Caddy (automatic HTTPS) and Klonkt as a systemd service. 5 # 6 # Safe on a server that ALREADY runs things: it won't upgrade your system Node, 7 # auto-picks a free port, and skips Caddy if a webserver/reverse-proxy is already 8 # listening on port 80/443 (you then get instructions to put Klonkt behind your 9 # own proxy). 10 # 11 # Usage (as root), non-interactive: 12 12 # curl -fsSL https://raw.githubusercontent.com/roboburr/klonkt/main/scripts/install.sh \ 13 # | sudo bash -s -- --domain klonkt. voorbeeld.nl14 # O f interactief vanaf een gedownload bestand:13 # | sudo bash -s -- --domain klonkt.example.com 14 # Or interactively from a downloaded file: 15 15 # sudo bash install.sh 16 16 # 17 # Opnieuw draaien op dezelfde server = bijwerken (git pull + herstart).18 # Volledig geïsoleerd alternatief: Docker (zie docker-compose.yml in de repo).17 # Re-running on the same server = update (git pull + restart). 18 # Fully isolated alternative: Docker (see docker-compose.yml in the repo). 19 19 # 20 20 set -euo pipefail 21 21 22 # ── Instellingen (override via env-variabele of vlag)──────────────────────23 KLONKT_REPO="${KLONKT_REPO:-https://github.com/roboburr/klonkt.git}" # TODO: echte GitHub-URL22 # ── Settings (override via env var or flag) ──────────────────────────────── 23 KLONKT_REPO="${KLONKT_REPO:-https://github.com/roboburr/klonkt.git}" 24 24 KLONKT_BRANCH="${KLONKT_BRANCH:-main}" 25 25 KLONKT_DIR="${KLONKT_DIR:-/opt/klonkt}" … … 29 29 KLONKT_LANG="${KLONKT_DEFAULT_LANG:-}" 30 30 NODE_MAJOR="${NODE_MAJOR:-20}" 31 NO_CADDY="${KLONKT_NO_CADDY:-}" # zet op 1 om Caddy NOOIT te installeren (eigen proxy)32 NODE_FORCE="${NODE_FORCE:-}" # zet op 1 om systeem-Node tóch te (her)installeren31 NO_CADDY="${KLONKT_NO_CADDY:-}" # set to 1 to NEVER install Caddy (own proxy) 32 NODE_FORCE="${NODE_FORCE:-}" # set to 1 to (re)install system Node anyway 33 33 PORT_EXPLICIT=0 34 34 … … 44 44 --force-node) NODE_FORCE=1; shift;; 45 45 -h|--help) grep '^#' "$0" | sed 's/^# \{0,1\}//'; exit 0;; 46 *) echo " Onbekende optie: $1" >&2; exit 1;;46 *) echo "Unknown option: $1" >&2; exit 1;; 47 47 esac 48 48 done … … 55 55 port_busy() { ss -ltnH 2>/dev/null | awk '{print $4}' | grep -qE "[:.]${1}$"; } 56 56 57 [ "$(id -u)" = 0 ] || die " Draai dit als root (sudo bash install.sh)."58 command -v apt-get >/dev/null || die " Alleen Debian/Ubuntu (apt). Gebruik op andere systemen de Docker-route."57 [ "$(id -u)" = 0 ] || die "Run this as root (sudo bash install.sh)." 58 command -v apt-get >/dev/null || die "Debian/Ubuntu only (apt). On other systems use the Docker route." 59 59 60 60 if [ -z "$KLONKT_DOMAIN" ]; then 61 read -rp "Dom ein voor Klonkt (bv. klonkt.voorbeeld.nl): " KLONKT_DOMAIN </dev/tty || true62 fi 63 [ -n "$KLONKT_DOMAIN" ] || die " Geen domein opgegeven (--domain ofKLONKT_DOMAIN)."61 read -rp "Domain for Klonkt (e.g. klonkt.example.com): " KLONKT_DOMAIN </dev/tty || true 62 fi 63 [ -n "$KLONKT_DOMAIN" ] || die "No domain given (--domain or KLONKT_DOMAIN)." 64 64 case "$KLONKT_REPO" in 65 *OWNER/*) die " Zet eerst de echte repo-URL: --repo https://github.com/<jij>/klonkt.git (ofKLONKT_REPO=...).";;65 *OWNER/*) die "Set the real repo URL first: --repo https://github.com/<you>/klonkt.git (or KLONKT_REPO=...).";; 66 66 esac 67 67 68 68 export DEBIAN_FRONTEND=noninteractive 69 69 70 # ── Preflight: kijk wat er al draait, pas je aan i.p.v. clobberen ──────────71 log "Preflight (w at draait er al?)…"70 # ── Preflight: see what's already running, adapt instead of clobbering ────── 71 log "Preflight (what's already running?)…" 72 72 apt-get update -y >/dev/null 73 73 apt-get install -y iproute2 >/dev/null 2>&1 || true 74 74 75 # Po ort: bezet? Bij --port → fout. Anders automatisch een vrije kiezen.75 # Port: busy? With --port → error. Otherwise auto-pick a free one. 76 76 if port_busy "$KLONKT_PORT"; then 77 77 if [ "$PORT_EXPLICIT" = 1 ]; then 78 die "Po ort ${KLONKT_PORT} is al in gebruik. Kies een vrije poort met--port."78 die "Port ${KLONKT_PORT} is already in use. Pick a free port with --port." 79 79 fi 80 80 picked="" … … 82 82 port_busy "$p" || { picked="$p"; break; } 83 83 done 84 [ -n "$picked" ] || die " Geen vrije poort gevonden rond ${KLONKT_PORT}. Geef er een met--port."85 warn "po ort ${KLONKT_PORT} bezet → Klonkt gebruikt${picked}"84 [ -n "$picked" ] || die "No free port found near ${KLONKT_PORT}. Provide one with --port." 85 warn "port ${KLONKT_PORT} busy → Klonkt uses ${picked}" 86 86 KLONKT_PORT="$picked" 87 87 else 88 ok "po ort ${KLONKT_PORT} vrij"89 fi 90 91 # Webserver o p 80/443 die niet Caddy is? → Caddy overslaan, eigen-proxy-modus.88 ok "port ${KLONKT_PORT} free" 89 fi 90 91 # Webserver on 80/443 that isn't Caddy? → skip Caddy, own-proxy mode. 92 92 FOREIGN_PROXY=0 93 93 if [ -z "$NO_CADDY" ] && command -v ss >/dev/null 2>&1; then 94 94 if ss -ltnpH 2>/dev/null | grep -E '[:.](80|443) ' | grep -viq 'caddy'; then 95 95 NO_CADDY=1; FOREIGN_PROXY=1 96 warn " er luistert al iets op poort 80/443 (geen Caddy) → ik installeer Caddy NIET en geef je proxy-instructies"97 fi 98 fi 99 100 # ── Node: bestaande versie respecteren, niet stilletjes upgraden──────────96 warn "something is already listening on port 80/443 (not Caddy) → NOT installing Caddy; you'll get proxy instructions" 97 fi 98 fi 99 100 # ── Node: respect an existing version, don't silently upgrade ────────────── 101 101 log "Node ${NODE_MAJOR}.x…" 102 102 if command -v node >/dev/null 2>&1 && [ -z "$NODE_FORCE" ]; then 103 103 CUR="$(node -v | sed 's/v//;s/\..*//')" 104 104 if [ "$CUR" -lt "$NODE_MAJOR" ]; then 105 die " Er staat al Node $(node -v) op deze server; Klonkt heeft ≥${NODE_MAJOR} nodig.106 I k upgrade je systeem-Node NIET automatisch — dat kan andere apps breken.107 Opti es: (a) gebruik de Docker-route (eigen Node, raakt niets aan), of108 (b) upgrade Node zelf, of (c) forceer met NODE_FORCE=1 (eigen risico)."109 fi 110 ok " bestaande node $(node -v) wordt gebruikt"105 die "Node $(node -v) is already installed on this server; Klonkt needs ≥${NODE_MAJOR}. 106 I will NOT auto-upgrade your system Node — that could break other apps. 107 Options: (a) use the Docker route (own Node, touches nothing), or 108 (b) upgrade Node yourself, or (c) force with NODE_FORCE=1 (at your own risk)." 109 fi 110 ok "using existing node $(node -v)" 111 111 else 112 112 curl -fsSL "https://deb.nodesource.com/setup_${NODE_MAJOR}.x" | bash - 113 113 apt-get install -y nodejs 114 ok "node $(node -v) geïnstalleerd"115 fi 116 117 log "O verige pakketten…"114 ok "node $(node -v) installed" 115 fi 116 117 log "Other packages…" 118 118 apt-get install -y curl ca-certificates git gnupg openssl build-essential python3 119 apt-get install -y webp >/dev/null 2>&1 || true # cwebp = afbeelding→WebP (optioneel)120 ok "bas is-pakketten"119 apt-get install -y webp >/dev/null 2>&1 || true # cwebp = image→WebP (optional) 120 ok "base packages" 121 121 122 122 if [ -z "$NO_CADDY" ]; then … … 128 128 apt-get install -y caddy 129 129 fi 130 ok "caddy aanwezig"131 fi 132 133 log "Service -gebruiker '${KLONKT_USER}'…"130 ok "caddy present" 131 fi 132 133 log "Service user '${KLONKT_USER}'…" 134 134 id -u "$KLONKT_USER" >/dev/null 2>&1 || useradd --system --home-dir "$KLONKT_DIR" --shell /usr/sbin/nologin "$KLONKT_USER" 135 ok " gebruiker"136 137 log " Klonkt-broncode ophalen…"135 ok "user" 136 137 log "Fetching Klonkt source…" 138 138 if [ -d "$KLONKT_DIR/.git" ]; then 139 139 git -C "$KLONKT_DIR" remote set-url origin "$KLONKT_REPO" … … 141 141 git -C "$KLONKT_DIR" reset --hard "origin/$KLONKT_BRANCH" 142 142 else 143 [ -e "$KLONKT_DIR" ] && [ -n "$(ls -A "$KLONKT_DIR" 2>/dev/null)" ] && die "$KLONKT_DIR bestaat al en is geen git-checkout. Kies --dir, of ruim 'm op."143 [ -e "$KLONKT_DIR" ] && [ -n "$(ls -A "$KLONKT_DIR" 2>/dev/null)" ] && die "$KLONKT_DIR already exists and is not a git checkout. Pick --dir, or clean it up." 144 144 mkdir -p "$KLONKT_DIR" 145 145 git clone --depth 1 --branch "$KLONKT_BRANCH" "$KLONKT_REPO" "$KLONKT_DIR" … … 149 149 ok "code in $KLONKT_DIR" 150 150 151 log " Dependencies installeren(npm ci)…"151 log "Installing dependencies (npm ci)…" 152 152 as_klonkt bash -c "cd '$KLONKT_DIR' && npm ci --omit=dev" 153 153 ok "node_modules" … … 168 168 } > "$ENV" 169 169 chown "$KLONKT_USER:$KLONKT_USER" "$ENV"; chmod 600 "$ENV" 170 ok "n ieuwe .env (willekeurigeSESSION_SECRET)"171 else 172 # poort in bestaande .env synchroniseren met de gekozen poort170 ok "new .env (random SESSION_SECRET)" 171 else 172 # sync the port in an existing .env with the chosen port 173 173 if grep -q '^PORT=' "$ENV"; then sed -i "s/^PORT=.*/PORT=${KLONKT_PORT}/" "$ENV"; fi 174 ok " bestaande .env behouden (poort gesynchroniseerd)"175 fi 176 177 log "systemd -service…"174 ok "kept existing .env (port synced)" 175 fi 176 177 log "systemd service…" 178 178 NODE_BIN="$(command -v node)" 179 179 cat > /etc/systemd/system/klonkt.service <<EOF … … 200 200 systemctl daemon-reload 201 201 systemctl enable --now klonkt 202 ok "klonkt.service draait op127.0.0.1:${KLONKT_PORT}"202 ok "klonkt.service running on 127.0.0.1:${KLONKT_PORT}" 203 203 204 204 if [ -z "$NO_CADDY" ]; then 205 log "Caddy -config voor ${KLONKT_DOMAIN}…"205 log "Caddy config for ${KLONKT_DOMAIN}…" 206 206 CADDY=/etc/caddy/Caddyfile 207 207 SITE_BLOCK="${KLONKT_DOMAIN} { … … 216 216 printf '\n%s\n' "$SITE_BLOCK" >> "$CADDY" 217 217 fi 218 caddy validate --config "$CADDY" --adapter caddyfile >/dev/null 2>&1 || die "Caddy -config ongeldig — controleer$CADDY"218 caddy validate --config "$CADDY" --adapter caddyfile >/dev/null 2>&1 || die "Caddy config invalid — check $CADDY" 219 219 systemctl reload caddy 2>/dev/null || systemctl restart caddy 220 ok "caddy serv eert${KLONKT_DOMAIN}"221 fi 222 223 log "Update -commando'klonkt-update'…"220 ok "caddy serving ${KLONKT_DOMAIN}" 221 fi 222 223 log "Update command 'klonkt-update'…" 224 224 cat > /usr/local/bin/klonkt-update <<EOF 225 225 #!/usr/bin/env bash … … 234 234 fi 235 235 systemctl restart klonkt 236 echo "Klonkt bijgewerkt (\$A) + herstart."236 echo "Klonkt updated (\$A) + restarted." 237 237 EOF 238 238 chmod +x /usr/local/bin/klonkt-update … … 241 241 echo 242 242 echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" 243 echo " Klonkt draait! 🎉"243 echo " Klonkt is running! 🎉" 244 244 echo 245 245 if [ -n "$NO_CADDY" ]; then 246 echo " Klonkt l uistert op: http://127.0.0.1:${KLONKT_PORT}"246 echo " Klonkt listens on: http://127.0.0.1:${KLONKT_PORT}" 247 247 if [ "$FOREIGN_PROXY" = 1 ]; then 248 echo " Er draait al een webserver op 80/443 — zet Klonkt erachter."249 fi 250 echo " Voorbeeldnginx:"248 echo " A webserver is already running on 80/443 — put Klonkt behind it." 249 fi 250 echo " Example nginx:" 251 251 echo " location / { proxy_pass http://127.0.0.1:${KLONKT_PORT}; proxy_set_header Host \$host;" 252 252 echo " proxy_set_header X-Forwarded-Proto \$scheme; }" 253 echo " VoorbeeldCaddy:"253 echo " Example Caddy:" 254 254 echo " ${KLONKT_DOMAIN} { reverse_proxy 127.0.0.1:${KLONKT_PORT} }" 255 255 else 256 echo " • Open je site:https://${KLONKT_DOMAIN}"257 fi 258 echo " • Eerste keer: ga naar /auth/register en maak je beheerdersaccount aan."259 echo 260 echo " Beheer: systemctl status klonkt · journalctl -u klonkt -f · klonkt-update"261 echo " Wachtwoord kwijt: cd ${KLONKT_DIR} && runuser -u ${KLONKT_USER} -- env HOME=${KLONKT_DIR} npm run reset-admin"262 echo 263 echo " DNS: zorg dat A + AAAA van ${KLONKT_DOMAIN} naar deze server wijzen."256 echo " • Open your site: https://${KLONKT_DOMAIN}" 257 fi 258 echo " • First run: go to /auth/register and create your admin account." 259 echo 260 echo " Manage: systemctl status klonkt · journalctl -u klonkt -f · klonkt-update" 261 echo " Lost password: cd ${KLONKT_DIR} && runuser -u ${KLONKT_USER} -- env HOME=${KLONKT_DIR} npm run reset-admin" 262 echo 263 echo " DNS: make sure A + AAAA of ${KLONKT_DOMAIN} point to this server." 264 264 echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)