Skip to content

Docker Compose Services ​

The docker-compose.yaml file defines five services for a complete production-like deployment.

Services ​

postgres ​

PropertyValue
Imagepostgres:16-alpine
Host port35432 → container 5432
Restartunless-stopped
Volume./data/pg:/var/lib/postgresql/data
Health checkpg_isready -U tt

Environment: POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB (from .env)

redis ​

PropertyValue
Imageredis:7-alpine
Host port36379 → container 6379
Restartunless-stopped
Volume./data/redis:/data
Commandredis-server --appendonly yes (AOF persistence enabled)
Health checkredis-cli ping

rustfs ​

S3-compatible object storage for invoice files.

PropertyValue
Imagerustfs/rustfs:latest
Host ports39000 → 9000 (API), 39001 → 9001 (web console)
Restartunless-stopped
Volumes./data/rustfs/data:/data, ./data/rustfs/logs:/app/logs

Environment: RUSTFS_ROOT_USER, RUSTFS_ROOT_PASSWORD, RUSTFS_ACCESS_KEY, RUSTFS_SECRET_KEY, RUSTFS_ADDRESS=:9000, RUSTFS_CONSOLE_ENABLE=true

Access the web console at http://localhost:39001 to browse uploaded files.

api ​

The NestJS REST API.

PropertyValue
Buildservices/api/Dockerfile
Host port33000 → container 3000
Restartunless-stopped
Depends onpostgres (healthy), redis (healthy), rustfs (started)

The API runs prisma migrate deploy on startup. If migrations fail, the container exits and Docker restarts it.

worker ​

The BullMQ background worker.

PropertyValue
Buildservices/worker/Dockerfile
Exposed portNone
Restartunless-stopped
Depends onpostgres (healthy), redis (healthy), rustfs (started)

Data persistence ​

All state is stored under ./data/ on the host machine:

data/
├── pg/          ← PostgreSQL data directory
├── redis/       ← Redis AOF journal
└── rustfs/
    ├── data/    ← Uploaded invoice files
    └── logs/    ← RustFS logs

Back up this directory to protect your data. The ./data/ directory is created automatically on first run.

Starting only infrastructure ​

For local development, start just the infrastructure without building the API and worker:

bash
pnpm db:up
# equivalent to: docker compose up postgres redis rustfs -d

TT Time Tracker — Internal Documentation