#!/bin/bash # dokku-setup.sh.sample - Set up Dokku app for firehose # # USAGE: # 1. Copy to dokku-setup.sh: cp dokku-setup.sh.sample dokku-setup.sh # 2. Fill in any empty strings below # 3. Run on Dokku server: ./dokku-setup.sh # # Do NOT commit dokku-setup.sh (contains secrets) set -e APP="firehose" # <-- change to your desired Dokku app name / hostname PHX_HOST="$APP" # <-- change to your full domain, e.g., firehose.example.com # Auto-generate secrets SECRET_KEY_BASE=$(openssl rand -base64 64 | tr -d '\n') echo "==> Creating Dokku app: $APP" dokku apps:create "$APP" || echo "App may already exist" echo "==> Creating PostgreSQL database" dokku postgres:create "${APP}-db" || echo "Database may already exist" dokku postgres:link "${APP}-db" "$APP" || echo "Database may already be linked" echo "==> Setting environment variables" dokku config:set --no-restart "$APP" \ SECRET_KEY_BASE="$SECRET_KEY_BASE" \ PHX_HOST="$PHX_HOST" \ PORT="4000" # Optional: set custom domain (uncomment and edit) # dokku domains:set "$APP" "$PHX_HOST" # Optional: set up SSL with Let's Encrypt (uncomment) # dokku letsencrypt:enable "$APP" echo "" echo "==> Setup complete!" echo "" echo "Next steps:" echo " 1. From your local machine, add the git remote:" echo " git remote add dokku dokku@YOUR_SERVER:$APP" echo "" echo " 2. Push to deploy:" echo " git push dokku main" echo "" echo " 3. Run migrations (first deploy):" echo " dokku run $APP /app/bin/migrate"