summaryrefslogtreecommitdiffstats
path: root/setup.sh
diff options
context:
space:
mode:
authorKen <ken@jots.org>2026-05-09 04:41:03 +0000
committerKen <ken@jots.org>2026-05-09 04:41:03 +0000
commitc75beda743dfd6af63f512e928d0889d9ead3973 (patch)
treebed91fd4f9d36a905be0b1ef990457a1e37e567b /setup.sh
Initial commit — Albumen photo album
Ruby/Sinatra self-hosted photo album with directory hierarchy, per-photo captions and visibility, lightbox, slideshow, admin UI, and Let's Encrypt HTTPS via Apache reverse proxy on prouter. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'setup.sh')
-rw-r--r--setup.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/setup.sh b/setup.sh
new file mode 100644
index 0000000..5c83d11
--- /dev/null
+++ b/setup.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+# Run on the server as root after rsyncing the app files.
+set -euo pipefail
+
+APP_DIR=/opt/albumen
+MEDIA_DIR=/var/albumen
+
+echo "==> Creating directories"
+mkdir -p "$APP_DIR"/{cache/thumbs,tmp,log,public/img}
+mkdir -p "$MEDIA_DIR"
+
+echo "==> Creating service user"
+id albumen &>/dev/null || useradd -r -s /usr/sbin/nologin -d "$APP_DIR" albumen
+
+echo "==> Installing gems"
+cd "$APP_DIR"
+bundle install --without development test
+
+echo "==> Generating audio placeholder SVG"
+cat > "$APP_DIR/public/img/audio.svg" <<'SVG'
+<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300" viewBox="0 0 300 300">
+ <rect width="300" height="300" fill="#1c1c1c"/>
+ <text x="150" y="175" font-size="120" text-anchor="middle" fill="#555">♪</text>
+</svg>
+SVG
+
+echo "==> Setting permissions"
+chown -R albumen:albumen "$APP_DIR" "$MEDIA_DIR"
+chmod +x "$APP_DIR/scripts/"*.rb
+
+echo "==> Setting up nginx"
+cp "$APP_DIR/config/nginx-albumen.conf" /etc/nginx/sites-available/albumen
+ln -sf /etc/nginx/sites-available/albumen /etc/nginx/sites-enabled/albumen
+rm -f /etc/nginx/sites-enabled/default
+nginx -t
+systemctl enable nginx
+systemctl restart nginx
+
+echo "==> Setting up systemd service"
+cp "$APP_DIR/config/albumen.service" /etc/systemd/system/
+systemctl daemon-reload
+systemctl enable albumen
+
+echo ""
+echo "==> Setup complete!"
+echo ""
+echo "Next steps:"
+echo " 1. Set admin password: ruby $APP_DIR/scripts/set_password.rb"
+echo " 2. Start the service: systemctl start albumen"
+echo " 3. Check logs: journalctl -u albumen -f"
+echo " 4. Drop photos into: $MEDIA_DIR"
+echo " 5. Run update script: ruby $APP_DIR/scripts/update.rb"