From c75beda743dfd6af63f512e928d0889d9ead3973 Mon Sep 17 00:00:00 2001 From: Ken Date: Sat, 9 May 2026 04:41:03 +0000 Subject: =?UTF-8?q?Initial=20commit=20=E2=80=94=20Albumen=20photo=20album?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- setup.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 setup.sh (limited to 'setup.sh') 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 + +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" -- cgit v1.2.3