28 lines
759 B
Bash
28 lines
759 B
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
# One-time setup on forge-runner-01 for furtka.org.
|
||
|
|
# Idempotent — safe to re-run.
|
||
|
|
#
|
||
|
|
# Usage (on the VM, with sudo):
|
||
|
|
# sudo ops/nginx/setup-vm.sh
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
OWNER="${SUDO_USER:-daniel}"
|
||
|
|
WEBROOT="/var/www/furtka.org"
|
||
|
|
SRCROOT="/srv/furtka-site"
|
||
|
|
SITE_CONF="/etc/nginx/sites-available/furtka.org"
|
||
|
|
SITE_LINK="/etc/nginx/sites-enabled/furtka.org"
|
||
|
|
|
||
|
|
install -d -o "$OWNER" -g "$OWNER" -m 0755 "$WEBROOT"
|
||
|
|
install -d -o "$OWNER" -g "$OWNER" -m 0755 "$SRCROOT"
|
||
|
|
|
||
|
|
cp "$(dirname "$0")/furtka.org.conf" "$SITE_CONF"
|
||
|
|
ln -sfn "$SITE_CONF" "$SITE_LINK"
|
||
|
|
|
||
|
|
# Drop the Ubuntu default site so it doesn't shadow us on :80.
|
||
|
|
rm -f /etc/nginx/sites-enabled/default
|
||
|
|
|
||
|
|
nginx -t
|
||
|
|
systemctl reload nginx
|
||
|
|
|
||
|
|
echo "OK: furtka.org ready at $WEBROOT (owner $OWNER)"
|