Removed nginx setup
This commit is contained in:
@@ -26,24 +26,14 @@ if [ "$EUID" -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get domain name
|
||||
read -p "Enter your domain name (e.g., faction.yourdomain.com): " DOMAIN
|
||||
if [ -z "$DOMAIN" ]; then
|
||||
echo "Domain name is required!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get email for Let's Encrypt
|
||||
read -p "Enter your email for SSL certificate (Let's Encrypt): " EMAIL
|
||||
if [ -z "$EMAIL" ]; then
|
||||
echo "Email is required for SSL certificate!"
|
||||
exit 1
|
||||
fi
|
||||
# Get port to run on (default 8000)
|
||||
read -p "Enter port to run application on (default: 8000): " APP_PORT
|
||||
APP_PORT=${APP_PORT:-8000}
|
||||
|
||||
echo ""
|
||||
echo "Installing required packages..."
|
||||
apt update
|
||||
apt install -y python3 python3-pip python3-venv nginx certbot python3-certbot-nginx git
|
||||
apt install -y python3 python3-pip python3-venv git
|
||||
|
||||
echo ""
|
||||
echo "Creating application user..."
|
||||
@@ -120,47 +110,10 @@ fi
|
||||
chown factionwar:factionwar .env
|
||||
chmod 600 .env
|
||||
|
||||
echo ""
|
||||
echo "Setting up Nginx configuration..."
|
||||
# Create a basic HTTP-only config first (Certbot will add SSL)
|
||||
cat > /etc/nginx/sites-available/faction-war << EOF
|
||||
# Basic HTTP configuration - Certbot will add SSL
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name $DOMAIN;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
ln -sf /etc/nginx/sites-available/faction-war /etc/nginx/sites-enabled/faction-war
|
||||
|
||||
# Remove default nginx site if it exists
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
|
||||
echo ""
|
||||
echo "Testing Nginx configuration..."
|
||||
nginx -t
|
||||
|
||||
echo ""
|
||||
echo "Reloading Nginx..."
|
||||
systemctl reload nginx
|
||||
|
||||
echo ""
|
||||
echo "Getting SSL certificate from Let's Encrypt..."
|
||||
echo "Certbot will automatically configure SSL in the Nginx config"
|
||||
certbot --nginx -d $DOMAIN --non-interactive --agree-tos --email $EMAIL --redirect
|
||||
|
||||
echo ""
|
||||
echo "Setting up systemd service..."
|
||||
cp faction-war.service /etc/systemd/system/faction-war.service
|
||||
# Update the service file with the configured port
|
||||
sed "s|ExecStart=.*|ExecStart=/opt/faction-war/app/venv/bin/python main.py --port $APP_PORT|g" faction-war.service > /etc/systemd/system/faction-war.service
|
||||
systemctl daemon-reload
|
||||
systemctl enable faction-war
|
||||
systemctl start faction-war
|
||||
@@ -169,8 +122,7 @@ echo ""
|
||||
echo "Configuring firewall..."
|
||||
ufw --force enable
|
||||
ufw allow ssh
|
||||
ufw allow 80/tcp
|
||||
ufw allow 443/tcp
|
||||
ufw allow $APP_PORT/tcp
|
||||
|
||||
echo ""
|
||||
echo "Setting up backup cron job..."
|
||||
@@ -196,7 +148,7 @@ echo "========================================"
|
||||
echo "Setup Complete!"
|
||||
echo "========================================"
|
||||
echo ""
|
||||
echo "Your application should now be running at: https://$DOMAIN"
|
||||
echo "Your application should now be running on port $APP_PORT"
|
||||
echo ""
|
||||
echo "User Account Information:"
|
||||
echo " - Service user: factionwar (no password by default)"
|
||||
@@ -208,9 +160,12 @@ echo "Important next steps:"
|
||||
echo "1. Configure /opt/faction-war/app/.env with your secrets (if not done already)"
|
||||
echo " - Edit with: sudo -u factionwar nano /opt/faction-war/app/.env"
|
||||
echo " - Then restart: sudo systemctl restart faction-war"
|
||||
echo "2. Visit https://$DOMAIN and log in with your AUTH_PASSWORD"
|
||||
echo "3. Configure your API keys in the Settings page (or use .env)"
|
||||
echo "4. Test the application functionality"
|
||||
echo "2. Access the application:"
|
||||
echo " - Local: http://localhost:$APP_PORT"
|
||||
echo " - Remote: http://YOUR_SERVER_IP:$APP_PORT"
|
||||
echo "3. Configure your reverse proxy (nginx, caddy, etc.) to handle HTTPS"
|
||||
echo "4. Configure your API keys in the Settings page (or use .env)"
|
||||
echo "5. Test the application functionality"
|
||||
echo ""
|
||||
echo "Useful commands:"
|
||||
echo " - Check status: sudo systemctl status faction-war"
|
||||
@@ -220,6 +175,7 @@ echo " - Update code: cd /opt/faction-war/app && sudo -u factionwar git pull &&
|
||||
echo " - Edit config: sudo -u factionwar nano /opt/faction-war/app/.env"
|
||||
echo ""
|
||||
echo "Security reminders:"
|
||||
echo " - Configure HTTPS on your reverse proxy"
|
||||
echo " - Keep your .env file secure (chmod 600)"
|
||||
echo " - Regularly update: apt update && apt upgrade"
|
||||
echo " - Monitor logs for suspicious activity"
|
||||
|
||||
Reference in New Issue
Block a user