Docker Compose¶
Deploy and run Genji Shimada using Docker Compose for local development and remote environments.
Overview¶
The project provides three Docker Compose configurations:
docker-compose.local.yml- Local development (infrastructure only: PostgreSQL, RabbitMQ, MinIO)docker-compose.dev.yml- Remote staging server (full stack: API, bot, database, RabbitMQ)docker-compose.prod.yml- Remote production server (full stack: API, bot, database, RabbitMQ)
Local Development¶
For local development on your Mac/Linux machine, use docker-compose.local.yml. This runs infrastructure only (PostgreSQL, RabbitMQ, MinIO) while you run the API and bot natively for fast iteration.
Services¶
services:
postgres-local: # PostgreSQL 17
rabbitmq-local: # RabbitMQ 4
minio-local: # MinIO (S3-compatible storage)
Starting Local Infrastructure¶
Ports¶
| Service | Ports | Description |
|---|---|---|
| PostgreSQL | 5432 | Database (host: localhost) |
| RabbitMQ | 5672, 15672 | Broker + Management UI |
| MinIO | 9000, 9001 | S3 API + Console |
All services bind to 127.0.0.1 (localhost only).
Environment Configuration¶
Use .env.local (see .env.local.example):
APP_ENVIRONMENT=local
POSTGRES_HOST=localhost
RABBITMQ_HOST=localhost
S3_ENDPOINT_URL=http://localhost:9000
Running API and Bot¶
Run the API and bot natively for hot reload:
See the Quick Start Guide for detailed local development instructions.
Remote Staging (Dev Server)¶
The dev compose file is for deploying to a remote staging server, not for local development.
Both remote files (dev and prod) expect the external Docker network genji-network to exist.
Services¶
The staging compose file defines:
services:
genjishimada-api-dev: # Litestar API
genjishimada-bot-dev: # Discord bot
genjishimada-db-dev: # PostgreSQL 17
genjishimada-rabbitmq-dev: # RabbitMQ
Starting Staging Services¶
To run only infrastructure services on staging:
Ports¶
| Service | Port | Description |
|---|---|---|
| PostgreSQL | 65432 | Database (host: 127.0.0.1) |
RabbitMQ management UI is not exposed directly in this repo.
Environment Variables¶
Required in .env:
# PostgreSQL
POSTGRES_USER=genjishimada
POSTGRES_PASSWORD=dev_password
POSTGRES_DB=genjishimada
# RabbitMQ
RABBITMQ_USER=admin
RABBITMQ_PASS=dev_password
# API/Bot
APP_ENVIRONMENT=development
API_KEY=your_api_key_for_bot
DISCORD_TOKEN=your_discord_bot_token
Verifying Services¶
Check service health:
Production Environment¶
Services¶
The production compose file runs:
services:
genjishimada-api: # Litestar API
genjishimada-bot: # Discord bot
genjishimada-db: # PostgreSQL 17
genjishimada-rabbitmq: # RabbitMQ
Starting Production Services¶
Ports¶
| Service | Port | Description |
|---|---|---|
| PostgreSQL | 55432 | Database (host: 127.0.0.1) |
The API and RabbitMQ are not exposed directly; access is handled via your reverse proxy (e.g., Caddy).
Environment Variables¶
Create .env in the repository root:
# Application
APP_ENVIRONMENT=production
# Discord
DISCORD_TOKEN=your_production_bot_token
# PostgreSQL
POSTGRES_USER=genjishimada
POSTGRES_PASSWORD=secure_production_password
POSTGRES_DB=genjishimada
# RabbitMQ
RABBITMQ_USER=admin
RABBITMQ_PASS=secure_production_password
# API Authentication
API_KEY=secure_api_key_for_bot
# S3 Storage
AWS_ACCESS_KEY_ID=your_key
AWS_SECRET_ACCESS_KEY=your_secret
R2_ACCOUNT_ID=your_account_id
# Email
RESEND_API_KEY=your_resend_key
# Monitoring
SENTRY_DSN=your_sentry_dsn
Health Checks¶
The API health check is:
Viewing Logs¶
All services:
Specific service:
Restarting Services¶
Networking¶
Both compose files attach to genji-network:
Create it once if needed:
Volumes¶
The database and RabbitMQ use named volumes for persistence.
Next Steps¶
- Infrastructure Guide - Understand the services
- Operations Overview - Monitoring and backups
- Bot Configuration - Configure the bot