This commit is contained in:
2025-12-27 01:13:30 +01:00
commit aa1f5e30d9
14 changed files with 1500 additions and 0 deletions

80
deployment_guide.md Normal file
View File

@@ -0,0 +1,80 @@
# TestArena Deployment & Testing Guide
This guide explains how to deploy and test the TestArena backend application on your Ubuntu Server.
## 🚀 Deployment Steps
### 1. Clone the Repository
Ensure you have the code on your server in a directory like `/home/asf/testarena_pc_backend`.
### 2. Run the Deployment Script
The deployment script automates Nginx configuration and dependency installation.
```bash
sudo chmod +x deploy.sh
sudo ./deploy.sh
```
### 3. Start the Application Services
You should run these in the background or using a process manager like `pm2` or `systemd`.
**Start the API Server:**
```bash
source venv/bin/activate
uvicorn testarena_app.main:app --host 0.0.0.0 --port 8000
```
**Start the Background Worker:**
```bash
source venv/bin/activate
python3 -m testarena_app.worker
```
---
## 🧪 Testing the System
### 1. Verify Dashboard Access
Open your browser and navigate to:
`http://asf-server.duckdns.org:8080/`
You should see the modern, colorful TestArena dashboard.
### 2. Verify Results Browsing
Navigate to:
`http://asf-server.duckdns.org:8080/results/`
You should see an automatic directory listing of `/home/asf/testarena/`.
### 3. Test the Queue API
Run the following `curl` command to queue a test task:
```bash
curl -X POST http://asf-server.duckdns.org:8080/api/queue \
-H "Content-Type: application/json" \
-d '{
"test_queue_001": [
"staging",
{
"task_1": "/home/asf/scenarios/test1.py",
"task_2": "/home/asf/scenarios/test2.py"
}
]
}'
```
### 4. Verify Worker Execution
- Check the dashboard; you should see the new queue appear and its status change from `Waiting` to `Running` and then `Finished`.
- Check the filesystem:
```bash
ls -R /home/asf/testarena/test_queue_001
```
You should see `queue_status.json` and any results generated by `tpf_execution.py`.
### 5. Test Abortion
Queue another task and click the **Abort** button on the dashboard. Verify that the status changes to `Aborted` in both the dashboard and the `queue_status.json` file.
---
## 🛠️ Troubleshooting
- **Nginx Errors**: Check logs with `sudo tail -f /var/log/nginx/error.log`.
- **FastAPI Errors**: Check the terminal where `uvicorn` is running.
- **Permission Issues**: Ensure `/home/asf/testarena` is writable by the user running the app.
- **Port 8080 Blocked**: Ensure your firewall (ufw) allows traffic on port 8080: `sudo ufw allow 8080`.