update DB table
This commit is contained in:
12
deploy.sh
12
deploy.sh
@@ -16,7 +16,17 @@ echo "🚀 Starting TestArena Deployment..."
|
|||||||
# 1. Install System Dependencies
|
# 1. Install System Dependencies
|
||||||
echo "📦 Installing system dependencies..."
|
echo "📦 Installing system dependencies..."
|
||||||
apt-get update
|
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
|
# 2. Set up Python Virtual Environment
|
||||||
echo "🐍 Setting up Python environment..."
|
echo "🐍 Setting up Python environment..."
|
||||||
|
|||||||
@@ -14,19 +14,19 @@ sudo chmod +x deploy.sh
|
|||||||
sudo ./deploy.sh
|
sudo ./deploy.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Start the Application Services
|
### 3. Manage Application Services
|
||||||
You should run these in the background or using a process manager like `pm2` or `systemd`.
|
The application and worker are managed by `systemd`. You can control them using the following commands:
|
||||||
|
|
||||||
**Start the API Server:**
|
**Check Status:**
|
||||||
```bash
|
```bash
|
||||||
source venv/bin/activate
|
sudo systemctl status testarena-app
|
||||||
uvicorn testarena_app.main:app --host 0.0.0.0 --port 8000
|
sudo systemctl status testarena-worker
|
||||||
```
|
```
|
||||||
|
|
||||||
**Start the Background Worker:**
|
**Restart Services:**
|
||||||
```bash
|
```bash
|
||||||
source venv/bin/activate
|
sudo systemctl restart testarena-app
|
||||||
python3 -m testarena_app.worker
|
sudo systemctl restart testarena-worker
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -44,16 +44,16 @@ Navigate to:
|
|||||||
You should see an automatic directory listing of `/home/asf/testarena/`.
|
You should see an automatic directory listing of `/home/asf/testarena/`.
|
||||||
|
|
||||||
### 3. Test the Queue API
|
### 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
|
```bash
|
||||||
curl -X POST http://asf-server.duckdns.org:8080/api/queue \
|
curl -X POST http://asf-server.duckdns.org:8080/api/queue \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d '{
|
||||||
"test_queue_001": [
|
"source": "add_esp_idf_io_wrappers",
|
||||||
|
"345": [
|
||||||
"staging",
|
"staging",
|
||||||
{
|
{
|
||||||
"task_1": "/home/asf/scenarios/test1.py",
|
"5555": "application_layer/business_stack/actuator_manager/test/actuator_manager_init_test.test_scenario.xml"
|
||||||
"task_2": "/home/asf/scenarios/test2.py"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}'
|
}'
|
||||||
|
|||||||
Reference in New Issue
Block a user