Update VPS setup scripts to use IP address directly

This commit is contained in:
boilerrat 2025-03-16 14:21:02 -04:00
parent 255988d3dc
commit 9cc2fecdf6
3 changed files with 20 additions and 8 deletions

View File

@ -3,8 +3,9 @@
# This script deploys the website to the VPS # This script deploys the website to the VPS
# Set variables # Set variables
SERVER_IP="66.179.188.130"
REMOTE_USER="root" REMOTE_USER="root"
REMOTE_HOST="boilerhaus.org" REMOTE_HOST=$SERVER_IP
REMOTE_DIR="/var/www/boilerhaus.org" REMOTE_DIR="/var/www/boilerhaus.org"
LOCAL_DIR="." LOCAL_DIR="."

View File

@ -2,7 +2,10 @@
# This script sets up the VPS with the correct Nginx configuration and deploys the website # This script sets up the VPS with the correct Nginx configuration and deploys the website
echo "=== Setting up VPS for boilerhaus.org ===" # Set variables
SERVER_IP="66.179.188.130"
echo "=== Setting up VPS for boilerhaus.org (IP: $SERVER_IP) ==="
echo "" echo ""
# Step 1: Update Nginx configuration # Step 1: Update Nginx configuration

View File

@ -2,9 +2,13 @@
# This script updates the Nginx configuration for boilerhaus.org and its subdomains # This script updates the Nginx configuration for boilerhaus.org and its subdomains
# Set variables
SERVER_IP="66.179.188.130"
SERVER_USER="root" # Using root as requested
# Create backup of existing configuration # Create backup of existing configuration
echo "Creating backup of existing Nginx configuration..." echo "Creating backup of existing Nginx configuration..."
ssh root@boilerhaus.org "cp /etc/nginx/sites-available/boilerhaus.org.conf /etc/nginx/sites-available/boilerhaus.org.conf.bak" ssh $SERVER_USER@$SERVER_IP "mkdir -p /etc/nginx/sites-available && cp -f /etc/nginx/sites-available/boilerhaus.org.conf /etc/nginx/sites-available/boilerhaus.org.conf.bak 2>/dev/null || true"
# Create updated configuration file # Create updated configuration file
cat > boilerhaus.org.conf.new << 'EOL' cat > boilerhaus.org.conf.new << 'EOL'
@ -87,25 +91,29 @@ EOL
# Upload the new configuration # Upload the new configuration
echo "Uploading new configuration..." echo "Uploading new configuration..."
scp boilerhaus.org.conf.new root@boilerhaus.org:/etc/nginx/sites-available/boilerhaus.org.conf scp boilerhaus.org.conf.new $SERVER_USER@$SERVER_IP:/etc/nginx/sites-available/boilerhaus.org.conf
# Test Nginx configuration # Test Nginx configuration
echo "Testing Nginx configuration..." echo "Testing Nginx configuration..."
ssh root@boilerhaus.org "nginx -t" ssh $SERVER_USER@$SERVER_IP "nginx -t"
# If the test is successful, reload Nginx # If the test is successful, reload Nginx
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Reloading Nginx..." echo "Reloading Nginx..."
ssh root@boilerhaus.org "systemctl reload nginx" ssh $SERVER_USER@$SERVER_IP "systemctl reload nginx"
echo "Configuration updated successfully!" echo "Configuration updated successfully!"
else else
echo "Nginx configuration test failed. Restoring backup..." echo "Nginx configuration test failed. Restoring backup..."
ssh root@boilerhaus.org "cp /etc/nginx/sites-available/boilerhaus.org.conf.bak /etc/nginx/sites-available/boilerhaus.org.conf" ssh $SERVER_USER@$SERVER_IP "cp -f /etc/nginx/sites-available/boilerhaus.org.conf.bak /etc/nginx/sites-available/boilerhaus.org.conf 2>/dev/null || true"
echo "Backup restored. Please check the configuration and try again." echo "Backup restored. Please check the configuration and try again."
fi fi
# Make sure the site is enabled
echo "Ensuring site is enabled..."
ssh $SERVER_USER@$SERVER_IP "ln -sf /etc/nginx/sites-available/boilerhaus.org.conf /etc/nginx/sites-enabled/boilerhaus.org.conf"
# Run Certbot to ensure SSL certificates are set up for all domains # Run Certbot to ensure SSL certificates are set up for all domains
echo "Running Certbot to ensure SSL certificates are set up..." echo "Running Certbot to ensure SSL certificates are set up..."
ssh root@boilerhaus.org "certbot --nginx -d boilerhaus.org -d www.boilerhaus.org -d cloud.boilerhaus.org -d git.boilerhaus.org -d bw.boilerhaus.org --non-interactive --agree-tos --email admin@boilerhaus.org" ssh $SERVER_USER@$SERVER_IP "certbot --nginx -d boilerhaus.org -d www.boilerhaus.org -d cloud.boilerhaus.org -d git.boilerhaus.org -d bw.boilerhaus.org --non-interactive --agree-tos --email admin@boilerhaus.org"
echo "Done!" echo "Done!"