deploy.sh: use 18080/18443 for vhost ports instead of 80/443

- Avoid conflict with nginx/apache on common ports
- init_db.py now generates frps.ini at init time
- deploy.sh verifies frps.ini exists before starting frps
This commit is contained in:
Your Name
2026-08-10 18:21:58 +08:00
parent 13b38ec60b
commit 84d3ad7c75
2 changed files with 17 additions and 9 deletions
+6 -3
View File
@@ -1,11 +1,14 @@
#!/usr/bin/env python3
"""Initialize the frps-manager database."""
"""Initialize the frps-manager database and generate frps.ini."""
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from app import app, db, seed_admin
from app import app, db, seed_admin, write_frps_config
with app.app_context():
db.create_all()
seed_admin()
print("Database initialized successfully")
# Generate frps.ini so frps.service can start on a fresh machine
content = write_frps_config()
print("Database initialized successfully")
print("frps.ini generated at runtime/conf/frps.ini")
+11 -6
View File
@@ -103,10 +103,15 @@ if [ ! -d venv ]; then
fi
fi
# --- db init ----------------------------------------------------------------
# --- db init + frps.ini generation -------------------------------------------
log "Initializing database"
if [ "$DRY_RUN" = 0 ]; then
venv/bin/python init_db.py
mkdir -p runtime/conf runtime/logs instance
"$PROJECT_DIR/venv/bin/python" init_db.py
# Verify frps.ini was generated
if [ ! -f "$FRPS_INI" ]; then
die "frps.ini was not generated at $FRPS_INI — check init_db.py output"
fi
fi
# --- generate systemd units -------------------------------------------------
@@ -144,8 +149,8 @@ Environment=FRPS_DASHBOARD_URL=http://127.0.0.1:7500
Environment=FRPS_DASHBOARD_USER=admin
Environment=FRPS_DASHBOARD_PASS=admin123
Environment=FRPS_BIND_PORT=7000
Environment=FRPS_VHOST_HTTP_PORT=80
Environment=FRPS_VHOST_HTTPS_PORT=443
Environment=FRPS_VHOST_HTTP_PORT=18080
Environment=FRPS_VHOST_HTTPS_PORT=18443
ExecStart=$GUNICORN wsgi:app --bind 0.0.0.0:$PORT --workers 2 --timeout 30
Restart=on-failure
RestartSec=5
@@ -220,8 +225,8 @@ cat <<EOF
frps bind: 0.0.0.0:7000
frps dashboard: 127.0.0.1:7500 (admin / admin123)
frps vhost_http: 0.0.0.0:80 (set FRPS_VHOST_HTTP_PORT in service to override)
frps vhost_https: 0.0.0.0:443
frps vhost_http: 0.0.0.0:18080
frps vhost_https: 0.0.0.0:18443
Systemd units (auto-generated with correct paths):
/etc/systemd/system/frps.service