refactor: align deployment with proxmox template

This commit is contained in:
2025-12-27 15:52:31 +11:00
parent 908a00b38c
commit bd40b7cd8c
6 changed files with 266 additions and 21 deletions

View File

@@ -8,15 +8,25 @@ fi
echo "Configuring Nginx Reverse Proxy..."
APP_NAME="advanced-raid-calculator"
PORT=4001
# Create Nginx config for the app
cat > /etc/nginx/sites-available/app <<EOF
cat > /etc/nginx/sites-available/$APP_NAME <<EOF
server {
listen 80;
listen [::]:80;
server_name _;
root /var/www/$APP_NAME;
index index.html;
location / {
proxy_pass http://localhost:3000;
try_files \$uri \$uri/ =404;
}
location /api {
proxy_pass http://localhost:$PORT;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection 'upgrade';
@@ -30,14 +40,15 @@ EOF
rm -f /etc/nginx/sites-enabled/default
rm -f /etc/nginx/sites-enabled/tkl-default
rm -f /etc/nginx/sites-enabled/node
rm -f /etc/nginx/sites-enabled/app
# Enable the new app configuration
ln -sf /etc/nginx/sites-available/app /etc/nginx/sites-enabled/app
ln -sf /etc/nginx/sites-available/$APP_NAME /etc/nginx/sites-enabled/$APP_NAME
# Restart Nginx to apply changes
if systemctl is-active --quiet nginx; then
systemctl restart nginx
echo "Nginx restarted successfully."
systemctl reload nginx
echo "Nginx reloaded successfully."
else
echo "Nginx is not running. Starting it..."
systemctl start nginx