41 lines
884 B
Bash
41 lines
884 B
Bash
#!/bin/bash
|
|
|
|
# Deployment Script for ASF TestArena
|
|
# Usage: ./deploy.sh
|
|
|
|
echo "Starting deployment..."
|
|
|
|
# 1. Pull latest changes
|
|
echo "Pulling latest changes from git..."
|
|
git pull
|
|
|
|
# 2. Build Frontend
|
|
echo "Building frontend..."
|
|
cd frontend
|
|
npm install
|
|
npm run build
|
|
cd ..
|
|
|
|
# 3. Deploy Frontend
|
|
echo "Deploying frontend to /var/www/testarena..."
|
|
# Ensure directory exists
|
|
if [ ! -d "/var/www/testarena" ]; then
|
|
echo "Creating /var/www/testarena..."
|
|
sudo mkdir -p /var/www/testarena
|
|
sudo chown $USER:$USER /var/www/testarena
|
|
fi
|
|
|
|
# Copy files
|
|
sudo cp -r frontend/dist/* /var/www/testarena/
|
|
|
|
# 4. Restart Backend
|
|
echo "Restarting backend services..."
|
|
docker-compose down
|
|
docker-compose up -d --build
|
|
|
|
# 5. Reload Nginx (Optional, if config changed)
|
|
echo "Reloading Nginx..."
|
|
sudo systemctl reload nginx
|
|
|
|
echo "Deployment complete! Access at http://asf-testarena.duckdns.org"
|