Files
roaauto/docs/DEPLOY.md
Marius Mutu a16d01a669 chore(deploy): Docker production config, nginx gzip/cache, deploy docs
- docker-compose.yml: restart always, env_file, named volume, start_period
- frontend/nginx.conf: gzip compression, cache headers for assets, no-cache for SW
- Makefile: add prod-down and prod-logs targets
- docs/DEPLOY.md: Dokploy + Cloudflare Tunnel deploy instructions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 17:20:36 +02:00

2.1 KiB

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

git clone <repo-url> roaauto
cd roaauto
cp .env.example .env

Edit .env with production values:

SECRET_KEY=<generate-a-strong-secret>
DATABASE_URL=sqlite+aiosqlite:///./data/roaauto.db
SMSAPI_TOKEN=<your-smsapi-token>
CORS_ORIGINS=https://roaauto.romfast.ro

Generate a secret key:

python3 -c "import secrets; print(secrets.token_urlsafe(64))"

2. Build and start

make prod-build
make prod-up

Verify:

curl http://localhost/api/health
# {"status":"ok"}

3. Run initial migration

docker compose exec backend alembic upgrade head

4. Seed catalog data (first deploy only)

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

make prod-logs

Database backup

make backup

Update deployment

git pull
make prod-build
make prod-up

Rollback

git checkout <previous-commit>
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)