update for pc server

This commit is contained in:
2025-11-24 20:39:18 +01:00
parent 4df7501aba
commit bd1d56e1d0
6 changed files with 96 additions and 101 deletions

View File

@@ -13,42 +13,55 @@ A full-stack web application to manage automated software test jobs.
- **Backend**: FastAPI (Python)
- **Frontend**: React + Vite (TypeScript)
- **Database**: PostgreSQL
- **Reverse Proxy**: Caddy
- **Containerization**: Docker Compose
- **Reverse Proxy**: Nginx (Local Host)
- **Containerization**: Docker Compose (Backend + DB)
## Deployment Instructions
### Prerequisites
- Docker and Docker Compose installed on the server.
- Domain `testarena.nabd-co.com` pointing to the server IP.
- Docker and Docker Compose installed.
- Nginx installed on the host machine.
- Node.js installed (to build frontend).
- Domain `asf-testarena.duckdns.org` pointing to your PC.
### Steps
1. **Clone the repository** to your VPS.
```bash
git clone <repo_url>
cd testarena
```
### 1. Backend & Database
Start the backend and database using Docker Compose:
```bash
docker-compose up -d --build
```
This will expose the backend API on `localhost:8000`.
2. **Configure Environment**
- Edit `docker-compose.yml` if you need to change database passwords.
- Edit `backend/app/auth.py` to change the `SECRET_KEY`.
### 2. Frontend
Build the frontend application:
```bash
cd frontend
npm install
npm run build
```
Copy the contents of `frontend/dist` to your web root:
```bash
# Example path based on your request
sudo cp -r dist/* /var/www/testarena/
```
3. **Run with Docker Compose**
```bash
docker-compose up -d --build
```
### 3. Nginx Configuration
Update your Nginx configuration (usually in `/etc/nginx/sites-available/default` or similar) using the snippet provided in `nginx_config_snippet.conf`.
4. **Verify**
- Open `https://testarena.nabd-co.com` in your browser.
- Login with default credentials:
- Username: `admin`
- Password: `admin123`
Key configurations:
- Serve static files from `/var/www/testarena`.
- Proxy `/api/`, `/auth/`, `/admin/`, `/jobs/`, `/ws/` to `http://localhost:8000`.
- Alias `/results/` to the `results` folder in this project directory.
Restart Nginx:
```bash
sudo systemctl restart nginx
```
### 4. Verify
- Open `http://asf-testarena.duckdns.org`.
- Login with `admin` / `admin123`.
### Scripts Integration
- The mock scripts are located in `backend/scripts/`.
- Replace `get_scenarios.sh` and `run_tests.sh` with your actual implementation.
- Ensure the scripts are executable (`chmod +x`).
### Troubleshooting
- Check logs: `docker-compose logs -f`
- Restart services: `docker-compose restart`
- Ensure the scripts are executable.