update for pc server

This commit is contained in:
2025-11-24 20:53:48 +01:00
parent 9bfaa5e59b
commit 78f3381ec1
2 changed files with 44 additions and 6 deletions

View File

@@ -119,9 +119,22 @@ Ensure your Nginx is configured to serve the app.
## Troubleshooting
- **npm: command not found**:
You need to install Node.js and npm on your server.
```bash
sudo apt update
sudo apt install nodejs npm
```
- **Permission denied (Docker)**:
The script tries to handle this by using `sudo`. If running manually, use `sudo docker-compose ...` or add your user to the docker group:
```bash
sudo usermod -aG docker $USER
newgrp docker
```
- **Backend not starting?**
Check logs: `docker-compose logs -f backend`
Check logs: `sudo docker-compose logs -f backend`
- **Frontend 404s?**
Ensure `try_files $uri $uri/ /index.html;` is present in Nginx config.
- **WebSocket connection failed?**
Ensure the `/ws/` location block has the `Upgrade` headers.

View File

@@ -3,8 +3,21 @@
# Deployment Script for ASF TestArena
# Usage: ./deploy.sh
set -e # Exit on error
echo "Starting deployment..."
# Check for required commands
if ! command -v npm &> /dev/null; then
echo "Error: npm is not installed. Please install Node.js and npm."
exit 1
fi
if ! command -v docker-compose &> /dev/null; then
echo "Error: docker-compose is not installed."
exit 1
fi
# 1. Pull latest changes
echo "Pulling latest changes from git..."
git pull
@@ -26,12 +39,24 @@ if [ ! -d "/var/www/testarena" ]; then
fi
# Copy files
if [ -d "frontend/dist" ]; then
sudo cp -r frontend/dist/* /var/www/testarena/
else
echo "Error: frontend/dist directory not found. Build failed?"
exit 1
fi
# 4. Restart Backend
echo "Restarting backend services..."
# Use sudo for docker-compose if needed
if groups | grep -q '\bdocker\b'; then
docker-compose down
docker-compose up -d --build
else
echo "User not in docker group, using sudo..."
sudo docker-compose down
sudo docker-compose up -d --build
fi
# 5. Reload Nginx (Optional, if config changed)
echo "Reloading Nginx..."