diff --git a/deploy.sh b/deploy.sh index 7897aaa..841f1f2 100644 --- a/deploy.sh +++ b/deploy.sh @@ -16,7 +16,17 @@ echo "🚀 Starting TestArena Deployment..." # 1. Install System Dependencies echo "📦 Installing system dependencies..." apt-get update -apt-get install -y nginx python3-pip python3-venv +apt-get install -y nginx python3-pip python3-venv sqlite3 + +# 1.1 Database Migration (Add source column if missing) +echo "🗄️ Checking database schema..." +DB_PATH="/home/asf/testarena/testarena.db" +if [ -f "$DB_PATH" ]; then + if ! sqlite3 "$DB_PATH" ".schema queues" | grep -q "source"; then + echo "➕ Adding 'source' column to 'queues' table..." + sqlite3 "$DB_PATH" "ALTER TABLE queues ADD COLUMN source TEXT;" + fi +fi # 2. Set up Python Virtual Environment echo "🐍 Setting up Python environment..." diff --git a/deployment_guide.md b/deployment_guide.md index cb22f05..3fce217 100644 --- a/deployment_guide.md +++ b/deployment_guide.md @@ -14,19 +14,19 @@ 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`. +### 3. Manage Application Services +The application and worker are managed by `systemd`. You can control them using the following commands: -**Start the API Server:** +**Check Status:** ```bash -source venv/bin/activate -uvicorn testarena_app.main:app --host 0.0.0.0 --port 8000 +sudo systemctl status testarena-app +sudo systemctl status testarena-worker ``` -**Start the Background Worker:** +**Restart Services:** ```bash -source venv/bin/activate -python3 -m testarena_app.worker +sudo systemctl restart testarena-app +sudo systemctl restart testarena-worker ``` --- @@ -44,16 +44,16 @@ Navigate to: 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: +Run the following `curl` command to queue a test task with branch information: ```bash curl -X POST http://asf-server.duckdns.org:8080/api/queue \ -H "Content-Type: application/json" \ -d '{ - "test_queue_001": [ + "source": "add_esp_idf_io_wrappers", + "345": [ "staging", { - "task_1": "/home/asf/scenarios/test1.py", - "task_2": "/home/asf/scenarios/test2.py" + "5555": "application_layer/business_stack/actuator_manager/test/actuator_manager_init_test.test_scenario.xml" } ] }'