# Banatie Infrastructure

Production deployment configuration files for VPS.

## Files

| File | Purpose |
|------|---------|
| `docker-compose.production.yml` | Docker Compose for VPS deployment |
| `.env.example` | Environment variables template |
| `secrets.env.example` | Secrets template (passwords, API keys) |
| `init-db.sql` | PostgreSQL initialization (grants permissions) |

## Usage

```bash
# Copy to VPS
scp -r infrastructure/* usul-vps:/opt/banatie/

# On VPS
cd /opt/banatie
cp docker-compose.production.yml docker-compose.yml
cp .env.example .env
cp secrets.env.example secrets.env
cp init-db.sql scripts/

# Edit configuration
nano .env
nano secrets.env
chmod 600 secrets.env

# Deploy
docker compose --env-file .env --env-file secrets.env up -d
```

## VPS Directory Structure

```
/opt/banatie/
├── docker-compose.yml      # Copy from docker-compose.production.yml
├── .env                    # Copy from .env.example and configure
├── secrets.env             # Copy from secrets.env.example and configure
├── scripts/
│   └── init-db.sql         # Copy from init-db.sql
├── data/
│   ├── postgres/           # PostgreSQL data (DO NOT CREATE MANUALLY)
│   ├── minio/              # MinIO drives (DO NOT CREATE MANUALLY)
│   ├── waitlist-logs/
│   ├── api-results/
│   └── api-uploads/
└── logs/
    └── api/
```

## Important Notes

1. **Docker User NS Remapping**: VPS uses UID offset 165536. Let Docker create data directories.
2. **Secrets**: Never commit secrets.env to git. Use `chmod 600`.
3. **Database**: Tables are created by Drizzle ORM, not init-db.sql.

## Documentation

- Full guide: [docs/deployment.md](../docs/deployment.md)
- VPS docs: VPS repo `docs/banatie-deployment.md`
