Autopilot/README.md

152 lines
4.4 KiB
Markdown
Raw Permalink Normal View History

2026-06-30 07:26:45 +00:00
# AutoPilot — Distributed Web Test Automation Platform
AutoPilot is a full-stack, enterprise-grade distributed web browser automation platform. It consists of three components deployed together as a monorepo.
```
autopilot/
├── master/ # Cloud Coordinator — Spring Boot REST API + Scheduler + DB
├── worker/ # Execution Engine — Selenium WebDriver agent (polls master)
├── ui/ # Dashboard — React + Vite frontend (served via Nginx)
├── docker-compose.yml # Production: full stack with PostgreSQL
├── docker-compose.local.yml # Local dev: DB only (run services manually)
└── .env.example # Template for environment variables
```
---
## 🚀 Production Deployment (AWS / Any Linux Server)
### Prerequisites
- Docker & Docker Compose installed
- At least 2 CPU cores and 2GB RAM
### 1. Clone the repository
```bash
git clone https://repo.qruize.com/VithobaaSrinivasakumar/Autopilot.git
cd Autopilot
```
### 2. Configure environment variables
```bash
cp .env.example .env
nano .env # Fill in DB_PASS, JWT_SECRET, AWS keys, etc.
```
### 3. Deploy the full stack
```bash
docker-compose up -d --build
```
This starts:
- **PostgreSQL** (database, internal only)
- **AutoPilot Master** on port `9090`
- **AutoPilot UI** on port `80` (Nginx)
### 4. Verify deployment
```bash
docker-compose ps
curl http://localhost:9090/api/health
```
### 5. Updating to a new version
```bash
git pull origin main
docker-compose up -d --build
```
2026-06-30 07:32:26 +00:00
### 6. Connecting to the AWS Server (Production)
To connect to the live AWS server and manage the deployment:
1. Install **MobaXterm** (or any SSH terminal application).
2. Create a new SSH session with the IP address: `13.232.42.59`.
3. Use the private key named `mesibo.pem` *(Ask Dhakshan for this key, it is not stored in this repository for security reasons)*.
4. Once connected, navigate to the project directory:
```bash
cd /home/ubuntu/Autopilot
```
5. Check if the containers are running properly:
```bash
docker ps -a
```
6. Access the live dashboard at [http://13.232.42.59](http://13.232.42.59).
2026-06-30 07:26:45 +00:00
---
## 🏗️ Local Development (No Docker for Services)
### 1. Start only the database
```bash
docker-compose -f docker-compose.local.yml up -d
```
### 2. Start the Master (Terminal 1)
```bash
cd master
./mvnw spring-boot:run
# Runs on http://localhost:9090
```
### 3. Start the UI (Terminal 2)
```bash
cd ui
npm install
npm run dev
# Runs on http://localhost:5173
```
### 4. Start the Worker (Terminal 3)
```bash
cd worker
./mvnw spring-boot:run
# Polls http://localhost:9090 for jobs
```
---
## 🔗 CI/CD Integration
AutoPilot can be triggered directly from your DevOps pipeline using an API key.
### Trigger a test suite
```bash
curl -X POST \
-H "Authorization: Bearer ap_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{"suiteName": "Smoke Tests", "browser": "chrome"}' \
https://your-domain.com/api/v1/suites/trigger-by-name
```
### Poll for results
```bash
curl -H "Authorization: Bearer ap_live_your_api_key" \
https://your-domain.com/api/v1/schedulers/{schedulerId}/execution-status
# exitCode: 0 = all passed, 1 = failures, 2 = still running
```
For full GitHub Actions, GitLab CI, and Jenkins snippets, see the **CI/CD Integration** page inside the dashboard.
---
## 🌐 Environment Variables Reference
| Variable | Description | Required |
|---|---|---|
| `DB_URL` | JDBC connection string to PostgreSQL | ✅ |
| `DB_USER` | Database username | ✅ |
| `DB_PASS` | Database password | ✅ |
| `JWT_SECRET` | Minimum 256-bit secret for signing tokens | ✅ |
| `AWS_REGION` | AWS region for S3 screenshot storage | Optional |
| `AWS_ACCESS_KEY_ID` | AWS access key | Optional |
| `AWS_SECRET_ACCESS_KEY` | AWS secret key | Optional |
| `S3_BUCKET_NAME` | S3 bucket for storing screenshots | Optional |
| `LOCALAGENT_CLOUD_URL` | URL the Worker uses to reach the Master | Worker only |
---
## 📖 API Reference
| Method | Endpoint | Description |
|---|---|---|
| `POST` | `/api/v1/suites/{id}/trigger` | Trigger suite by ID |
| `POST` | `/api/v1/suites/trigger-by-name` | Trigger suite by name |
| `GET` | `/api/v1/schedulers/{id}/execution-status` | Poll execution result |
| `GET` | `/api/v1/executions/{id}/status` | Get execution detail |