Initial commit: Portal Auth Admin Dashboard
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
46
deploy/deploy.sh
Executable file
46
deploy/deploy.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
# Deploy Portal Auth Dashboard to root@10.110.60.210
|
||||
set -e
|
||||
TARGET="root@10.110.60.210"
|
||||
APP_DIR="/opt/portal-auth-dashboard"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||
|
||||
echo "=== Syncing files to $TARGET:$APP_DIR ==="
|
||||
ssh "$TARGET" "mkdir -p $APP_DIR"
|
||||
rsync -av \
|
||||
--exclude '.env' \
|
||||
--exclude '__pycache__' \
|
||||
--exclude '*.pyc' \
|
||||
--exclude '.git' \
|
||||
--exclude 'venv' \
|
||||
"$PROJECT_DIR/app.py" \
|
||||
"$PROJECT_DIR/config.py" \
|
||||
"$PROJECT_DIR/db.py" \
|
||||
"$PROJECT_DIR/auth_helpers.py" \
|
||||
"$PROJECT_DIR/requirements.txt" \
|
||||
"$PROJECT_DIR/templates/" \
|
||||
"$PROJECT_DIR/static/" \
|
||||
"$PROJECT_DIR/deploy/" \
|
||||
"$TARGET:$APP_DIR/"
|
||||
|
||||
echo "=== Setting up Python venv and dependencies ==="
|
||||
ssh "$TARGET" "cd $APP_DIR && python3 -m venv venv && ./venv/bin/pip install -r requirements.txt"
|
||||
|
||||
echo "=== Ensuring .env exists (skip if already configured) ==="
|
||||
ssh "$TARGET" "if [ ! -f $APP_DIR/.env ]; then cp $APP_DIR/deploy/.env.server $APP_DIR/.env 2>/dev/null || echo 'DB_AUTH_HOST=127.0.0.1
|
||||
DB_AUTH_PORT=5432
|
||||
DB_AUTH_NAME=portal_auth
|
||||
DB_AUTH_USER=portal_user
|
||||
DB_AUTH_PASSWORD=
|
||||
SECRET_KEY=change-me' > $APP_DIR/.env; fi"
|
||||
|
||||
echo "=== Installing systemd unit ==="
|
||||
ssh "$TARGET" "cp $APP_DIR/deploy/portal-auth-dashboard.service /etc/systemd/system/ && systemctl daemon-reload && systemctl enable portal-auth-dashboard && systemctl restart portal-auth-dashboard"
|
||||
|
||||
echo "=== Status ==="
|
||||
ssh "$TARGET" "systemctl status portal-auth-dashboard --no-pager"
|
||||
|
||||
echo ""
|
||||
echo "Done. Dashboard: http://10.110.60.210:5000"
|
||||
echo "Edit $APP_DIR/.env on the server to set DB_AUTH_PASSWORD and SECRET_KEY, then: systemctl restart portal-auth-dashboard"
|
||||
Reference in New Issue
Block a user