3.0 KiB
3.0 KiB
Deployment Guide - ASF TestArena
This guide explains how to deploy the ASF TestArena application on your local PC server using Nginx and Docker.
Prerequisites
- Git: To pull the repository.
- Docker & Docker Compose: To run the backend and database.
- Node.js & npm: To build the frontend.
- Nginx: To serve the frontend and proxy requests.
- Domain:
asf-testarena.duckdns.orgconfigured.
Quick Deployment
We have provided a script to automate the deployment process.
-
Make the script executable:
chmod +x deploy.sh -
Run the script:
./deploy.sh
Manual Deployment Steps
If you prefer to deploy manually, follow these steps:
1. Update Code
git pull origin main
2. Backend Setup
Start the backend services (API + Database):
docker-compose up -d --build
The backend will be available at http://localhost:8000.
3. Frontend Setup
Build the React application:
cd frontend
npm install
npm run build
This creates a dist folder with the static files.
Copy the build artifacts to your web server root:
sudo mkdir -p /var/www/testarena
sudo cp -r dist/* /var/www/testarena/
4. Nginx Configuration
Ensure your Nginx is configured to serve the app.
- Edit your Nginx config (e.g.,
/etc/nginx/sites-available/default):server { listen 80; server_name asf-testarena.duckdns.org; # Frontend location / { root /var/www/testarena; index index.html; try_files $uri $uri/ /index.html; } # Backend API location /api/ { proxy_pass http://localhost:8000/; proxy_set_header Host $host; } # Auth location /auth/ { proxy_pass http://localhost:8000/auth/; proxy_set_header Host $host; } # Admin location /admin/ { proxy_pass http://localhost:8000/admin/; proxy_set_header Host $host; } # Jobs location /jobs/ { proxy_pass http://localhost:8000/jobs/; proxy_set_header Host $host; } # WebSocket location /ws/ { proxy_pass http://localhost:8000/ws/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; } # Results location /results/ { alias /path/to/your/project/testarena/results/; autoindex on; } } - Test and Reload Nginx:
sudo nginx -t sudo systemctl reload nginx
Troubleshooting
- Backend not starting?
Check logs:
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 theUpgradeheaders.