set DATABASE_URL

This commit is contained in:
Willem van den Ende 2026-03-18 13:48:12 +00:00
parent 3846cae6ca
commit 3bfca5a726

View File

@ -11,6 +11,7 @@
set -e
APP="firehose" # <-- change to your desired Dokku app name / hostname
DB_NAME="firehose_db" # <-- valid chars: [A-Za-z0-9_] only
PHX_HOST="$APP" # <-- change to your full domain, e.g., firehose.example.com
# Auto-generate secrets
@ -20,8 +21,8 @@ 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"
dokku postgres:create "${DB_NAME}" || echo "Database may already exist"
dokku postgres:link "${DB_NAME}" "$APP" || echo "Database may already be linked"
echo "==> Setting environment variables"
dokku config:set --no-restart "$APP" \
@ -29,21 +30,18 @@ dokku config:set --no-restart "$APP" \
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 "DATABASE_URL was set automatically by postgres:link."
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 " (migrations run automatically via app.json postdeploy)"
echo ""
echo " 3. Run migrations (first deploy):"
echo " dokku run $APP /app/bin/migrate"
echo " 3. Set up SSL (after first deploy):"
echo " dokku letsencrypt:enable $APP"