127 lines
2.5 KiB
Markdown
127 lines
2.5 KiB
Markdown
|
|
# Docker Compose Infrastructure
|
||
|
|
|
||
|
|
> Local development infrastructure orchestration.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Overview
|
||
|
|
|
||
|
|
This directory contains Docker Compose configurations for local development:
|
||
|
|
|
||
|
|
- `docker-compose.yml` - Base services (Redis, etc.)
|
||
|
|
- `supabase/docker-compose.yml` - Local Supabase stack (PostgreSQL, Auth, Storage, Studio, etc.)
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Environment-Based Service Activation
|
||
|
|
|
||
|
|
Services are conditionally enabled based on `ERYAO_RUNTIME__ENVIRONMENT`:
|
||
|
|
|
||
|
|
| Environment | Services |
|
||
|
|
|-------------|----------|
|
||
|
|
| `dev` | Redis + Local Supabase |
|
||
|
|
| `prod` | Redis only (use cloud Supabase) |
|
||
|
|
|
||
|
|
### How It Works
|
||
|
|
|
||
|
|
Supabase services use `profiles: [dev]`. They only start when the `dev` profile is activated.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Usage
|
||
|
|
|
||
|
|
### Development (with local Supabase)
|
||
|
|
|
||
|
|
```bash
|
||
|
|
cd infra/docker
|
||
|
|
docker compose --profile dev up -d
|
||
|
|
```
|
||
|
|
|
||
|
|
Or with environment variable:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
ERYAO_RUNTIME__ENVIRONMENT=dev docker compose --profile dev up -d
|
||
|
|
```
|
||
|
|
|
||
|
|
### Production (cloud Supabase)
|
||
|
|
|
||
|
|
```bash
|
||
|
|
cd infra/docker
|
||
|
|
docker compose up -d
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Services Reference
|
||
|
|
|
||
|
|
### Base Services (always started)
|
||
|
|
|
||
|
|
| Service | Port | Description |
|
||
|
|
|---------|------|-------------|
|
||
|
|
| Redis | 6379 | Caching and queue backend |
|
||
|
|
|
||
|
|
### Dev-Only Services (profile: dev)
|
||
|
|
|
||
|
|
| Service | Port | Description |
|
||
|
|
|---------|------|-------------|
|
||
|
|
| PostgreSQL | 5432 | Local database |
|
||
|
|
| GoTrue (Auth) | 9999 | Authentication service |
|
||
|
|
| PostgREST | 3000 | REST API for database |
|
||
|
|
| Storage | 5000 | File storage service |
|
||
|
|
| Studio | 3000 | Supabase dashboard UI |
|
||
|
|
| Kong | 8001, 8443 | API gateway |
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Configuration
|
||
|
|
|
||
|
|
All services read configuration from `.env` (symlinked to project root `.env`).
|
||
|
|
|
||
|
|
Required environment variables:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Runtime
|
||
|
|
ERYAO_RUNTIME__ENVIRONMENT=dev
|
||
|
|
|
||
|
|
# Database
|
||
|
|
ERYAO_DATABASE__PORT=5432
|
||
|
|
ERYAO_DATABASE__NAME=postgres
|
||
|
|
ERYAO_DATABASE__PASSWORD=your-password
|
||
|
|
|
||
|
|
# Supabase
|
||
|
|
ERYAO_SUPABASE__JWT_SECRET=your-jwt-secret
|
||
|
|
ERYAO_SUPABASE__ANON_KEY=your-anon-key
|
||
|
|
ERYAO_SUPABASE__SERVICE_ROLE_KEY=your-service-role-key
|
||
|
|
ERYAO_SUPABASE__PUBLIC_URL=http://localhost:8001
|
||
|
|
|
||
|
|
# Redis
|
||
|
|
ERYAO_REDIS__PORT=6379
|
||
|
|
ERYAO_REDIS__PASSWORD=your-redis-password
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Troubleshooting
|
||
|
|
|
||
|
|
### Supabase services not starting
|
||
|
|
|
||
|
|
1. Check profile is activated: `docker compose --profile dev config`
|
||
|
|
2. Verify environment variables in `.env`
|
||
|
|
3. Check logs: `docker compose logs <service-name>`
|
||
|
|
|
||
|
|
### Port conflicts
|
||
|
|
|
||
|
|
If ports are already in use, override in `.env`:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
ERYAO_DATABASE__PORT=5433
|
||
|
|
ERYAO_REDIS__PORT=6380
|
||
|
|
```
|
||
|
|
|
||
|
|
### Reset local database
|
||
|
|
|
||
|
|
```bash
|
||
|
|
docker compose --profile dev down -v
|
||
|
|
docker compose --profile dev up -d
|
||
|
|
```
|