update for pc server
This commit is contained in:
@@ -119,9 +119,22 @@ Ensure your Nginx is configured to serve the app.
|
|||||||
|
|
||||||
## Troubleshooting
|
## 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?**
|
- **Backend not starting?**
|
||||||
Check logs: `docker-compose logs -f backend`
|
Check logs: `sudo docker-compose logs -f backend`
|
||||||
|
|
||||||
- **Frontend 404s?**
|
- **Frontend 404s?**
|
||||||
Ensure `try_files $uri $uri/ /index.html;` is present in Nginx config.
|
Ensure `try_files $uri $uri/ /index.html;` is present in Nginx config.
|
||||||
- **WebSocket connection failed?**
|
|
||||||
Ensure the `/ws/` location block has the `Upgrade` headers.
|
|
||||||
|
|||||||
@@ -3,8 +3,21 @@
|
|||||||
# Deployment Script for ASF TestArena
|
# Deployment Script for ASF TestArena
|
||||||
# Usage: ./deploy.sh
|
# Usage: ./deploy.sh
|
||||||
|
|
||||||
|
set -e # Exit on error
|
||||||
|
|
||||||
echo "Starting deployment..."
|
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
|
# 1. Pull latest changes
|
||||||
echo "Pulling latest changes from git..."
|
echo "Pulling latest changes from git..."
|
||||||
git pull
|
git pull
|
||||||
@@ -26,12 +39,24 @@ if [ ! -d "/var/www/testarena" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy files
|
# Copy files
|
||||||
|
if [ -d "frontend/dist" ]; then
|
||||||
sudo cp -r frontend/dist/* /var/www/testarena/
|
sudo cp -r frontend/dist/* /var/www/testarena/
|
||||||
|
else
|
||||||
|
echo "Error: frontend/dist directory not found. Build failed?"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# 4. Restart Backend
|
# 4. Restart Backend
|
||||||
echo "Restarting backend services..."
|
echo "Restarting backend services..."
|
||||||
|
# Use sudo for docker-compose if needed
|
||||||
|
if groups | grep -q '\bdocker\b'; then
|
||||||
docker-compose down
|
docker-compose down
|
||||||
docker-compose up -d --build
|
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)
|
# 5. Reload Nginx (Optional, if config changed)
|
||||||
echo "Reloading Nginx..."
|
echo "Reloading Nginx..."
|
||||||
|
|||||||
Reference in New Issue
Block a user