# ROA AUTO - Deploy Guide ## Prerequisites - Docker & Docker Compose installed - Domain configured (e.g., roaauto.romfast.ro) - Cloudflare Tunnel configured (or reverse proxy) ## Production Deploy on Dokploy ### 1. Clone and configure ```bash git clone roaauto cd roaauto cp .env.example .env ``` Edit `.env` with production values: ``` SECRET_KEY= DATABASE_URL=sqlite+aiosqlite:///./data/roaauto.db SMSAPI_TOKEN= CORS_ORIGINS=https://roaauto.romfast.ro ``` Generate a secret key: ```bash python3 -c "import secrets; print(secrets.token_urlsafe(64))" ``` ### 2. Build and start ```bash make prod-build make prod-up ``` Verify: ```bash curl http://localhost/api/health # {"status":"ok"} ``` ### 3. Run initial migration ```bash docker compose exec backend alembic upgrade head ``` ### 4. Seed catalog data (first deploy only) ```bash docker compose exec backend python -m app.db.seed ``` ## Cloudflare Tunnel Setup 1. Install `cloudflared` on the Proxmox host 2. Create a tunnel: `cloudflared tunnel create roaauto` 3. Configure the tunnel to route `roaauto.romfast.ro` to `http://localhost:80` 4. Run as a service: `cloudflared service install` The tunnel provides HTTPS termination - nginx listens on port 80 internally. ## Dokploy Configuration If using Dokploy instead of manual Docker: 1. Create a new project in Dokploy 2. Set source to your Git repository 3. Set compose file to `docker-compose.yml` 4. Add environment variables from `.env.example` 5. Set the domain to `roaauto.romfast.ro` 6. Deploy ## Maintenance ### Logs ```bash make prod-logs ``` ### Database backup ```bash make backup ``` ### Update deployment ```bash git pull make prod-build make prod-up ``` ### Rollback ```bash git checkout make prod-build make prod-up ``` ## Architecture ``` Internet → Cloudflare Tunnel → nginx (:80) ├── / → SPA (static files) └── /api → backend (:8000) backend: Python 3.12 + FastAPI + SQLite (file-based) frontend: Vue 3 SPA served by nginx data: ./backend/data/ (bind mount, persisted) ```