diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..784a3b1 --- /dev/null +++ b/setup.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +set -euo pipefail + +REPO_DIR="discord-lnbits-bot" +SECRETS_DIR="$REPO_DIR/data/secrets" +RUNTIME_ENV="$SECRETS_DIR/runtime.env" + +# Ensure directory structure +mkdir -p "$SECRETS_DIR" + +# Generate secrets +DB_USER="postgres" +DB_PASS="$(openssl rand -hex 16)" +DB_NAME="lnbitsdb" +FLASK_SECRET="$(openssl rand -hex 32)" +DATABASE_URL="postgresql://${DB_USER}:${DB_PASS}@db:5432/${DB_NAME}" + +# Save secrets to runtime.env +cat < "$RUNTIME_ENV" +DB_USER=${DB_USER} +DB_PASS=${DB_PASS} +DB_NAME=${DB_NAME} +DATABASE_URL=${DATABASE_URL} +FLASK_SECRET=${FLASK_SECRET} +EOF + +echo "✅ Secrets generated at $RUNTIME_ENV" + +# Build and launch Docker services +cd "$REPO_DIR" +docker-compose up -d --build + +# Show values once +echo +echo "🚀 Discord LNbits Bot is now running!" +echo "====================================" +echo "🔐 Database Credentials:" +echo " DB_USER: $DB_USER" +echo " DB_PASS: $DB_PASS" +echo " DB_NAME: $DB_NAME" +echo +echo "🔑 Flask Session Secret:" +echo " $FLASK_SECRET" +echo +echo "📂 These values are stored in: $RUNTIME_ENV" +echo "🌐 Open the web UI at: http://localhost:3000"