Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147#!/usr/bin/env fish# Deploy user pages to at.aesthetic.computer PDS# This updates the Caddy config to serve custom user pages on wildcard subdomains# Usage: fish deploy-user-pages.fish
# Get the directory where this script livesset SCRIPT_DIR (dirname (status --current-filename))
set LANDING_PAGE_LOCAL "$SCRIPT_DIR/landing-page.html"set USER_PAGE_LOCAL "$SCRIPT_DIR/user-page.html"set PDS_SERVER "root@165.227.120.137"set WEB_ROOT "/pds/caddy/data/www"set CADDY_WEB_ROOT "/data/www"set SSH_KEY "$HOME/.ssh/aesthetic_pds"
echo "๐ Deploying user pages to at.aesthetic.computer"echo ""
# Check if files existif not test -f $LANDING_PAGE_LOCAL echo "โ Error: landing-page.html not found" exit 1end
if not test -f $USER_PAGE_LOCAL echo "โ Error: user-page.html not found" exit 1end
echo "๐ค Uploading pages to /tmp on PDS server..."
# Upload to /tmp directory (temporary staging)scp -i $SSH_KEY $LANDING_PAGE_LOCAL "$PDS_SERVER:/tmp/index.html"scp -i $SSH_KEY $USER_PAGE_LOCAL "$PDS_SERVER:/tmp/user.html"
if test $status -ne 0 echo "โ Failed to upload pages" exit 1end
echo "โ
Pages uploaded to /tmp"
echo "๐ฆ Copying files into Caddy container..."ssh -i $SSH_KEY $PDS_SERVER 'docker cp /tmp/index.html caddy:/data/www/index.html && docker cp /tmp/user.html caddy:/data/www/user.html'
if test $status -ne 0 echo "โ Failed to copy files into container" exit 1end
echo "โ
Files copied into container at /data/www"echo ""echo "๐ง Configuring Caddy to serve custom user pages..."
# SSH into server and update Caddyfilessh -i $SSH_KEY $PDS_SERVER ' # Backup existing Caddyfile cp /pds/caddy/etc/caddy/Caddyfile /pds/caddy/etc/caddy/Caddyfile.backup # Create new Caddyfile with custom pages cat > /pds/caddy/etc/caddy/Caddyfile << "EOF"{ email me@jas.life on_demand_tls { ask http://localhost:3000/tls-check }}
# Main domain with custom landing pageat.aesthetic.computer { tls { on_demand } # Serve custom landing page for root handle / { root * /data/www file_server } # Proxy all other requests to PDS handle { reverse_proxy http://localhost:3000 }}
# Wildcard for user handles - serve custom user page at root*.at.aesthetic.computer { tls { on_demand } root * /data/www
# Proxy media requests to aesthetic.computer to avoid CORS handle /media/* { reverse_proxy https://aesthetic.computer } # Proxy /xrpc/* to PDS for API access handle /xrpc/* { reverse_proxy http://localhost:3000 } # Proxy .well-known for ATProto handle /.well-known/* { reverse_proxy http://localhost:3000 } # Serve custom user page for root path @root path / handle @root { rewrite * /user.html file_server } # Serve all other static files handle { file_server }}EOF # Reload Caddy docker exec caddy caddy reload --config /etc/caddy/Caddyfile'
if test $status -eq 0 echo "" echo "โ
Deployment complete!" echo "" echo "๐ Landing page: https://at.aesthetic.computer" echo "๐ค User pages: https://[handle].at.aesthetic.computer" echo "๐ Health check: https://at.aesthetic.computer/xrpc/_health" echo "" echo "Example user pages:" echo " https://fifi.at.aesthetic.computer" echo " https://jeffrey.at.aesthetic.computer" echo "" echo "Note: User pages are served at subdomain root" echo " All /xrpc/* routes still go to the PDS backend for API access"else echo "" echo "โ Deployment failed" exit 1end