Complete rewrite of Django REST API to Go with: - Gin web framework for HTTP routing - GORM for database operations - GoAdmin for admin panel - Gorush integration for push notifications - Redis for caching and job queues Features implemented: - User authentication (login, register, logout, password reset) - Residence management (CRUD, sharing, share codes) - Task management (CRUD, kanban board, completions) - Contractor management (CRUD, specialties) - Document management (CRUD, warranties) - Notifications (preferences, push notifications) - Subscription management (tiers, limits) Infrastructure: - Docker Compose for local development - Database migrations and seed data - Admin panel for data management 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
223 lines
6.2 KiB
YAML
223 lines
6.2 KiB
YAML
services:
|
|
# PostgreSQL Database
|
|
db:
|
|
image: postgres:16-alpine
|
|
container_name: mycrib-db
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER:-mycrib}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-mycrib_dev_password}
|
|
POSTGRES_DB: ${POSTGRES_DB:-mycrib}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
ports:
|
|
- "${DB_PORT:-5433}:5432" # Use 5433 externally to avoid conflicts
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-mycrib} -d ${POSTGRES_DB:-mycrib}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- mycrib-network
|
|
|
|
# Redis Cache
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: mycrib-redis
|
|
restart: unless-stopped
|
|
command: redis-server --appendonly yes
|
|
volumes:
|
|
- redis_data:/data
|
|
ports:
|
|
- "${REDIS_PORT:-6379}:6379"
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- mycrib-network
|
|
|
|
# Gorush Push Notification Server
|
|
# Note: Disabled by default. Start with: docker-compose --profile push up
|
|
gorush:
|
|
image: appleboy/gorush:latest
|
|
container_name: mycrib-gorush
|
|
restart: unless-stopped
|
|
profiles:
|
|
- push # Only start when push profile is enabled
|
|
ports:
|
|
- "${GORUSH_PORT:-8088}:8088"
|
|
volumes:
|
|
- ./push_certs:/certs:ro
|
|
environment:
|
|
GORUSH_CORE_PORT: "8088"
|
|
GORUSH_CORE_SYNC: "true"
|
|
GORUSH_IOS_ENABLED: "${GORUSH_IOS_ENABLED:-true}"
|
|
GORUSH_IOS_KEY_PATH: "/certs/apns_key.p8"
|
|
GORUSH_IOS_KEY_ID: "${APNS_AUTH_KEY_ID}"
|
|
GORUSH_IOS_TEAM_ID: "${APNS_TEAM_ID}"
|
|
GORUSH_IOS_TOPIC: "${APNS_TOPIC:-com.example.mycrib}"
|
|
GORUSH_IOS_PRODUCTION: "${APNS_PRODUCTION:-false}"
|
|
GORUSH_ANDROID_ENABLED: "${GORUSH_ANDROID_ENABLED:-true}"
|
|
GORUSH_ANDROID_APIKEY: "${FCM_SERVER_KEY}"
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8088/api/stat/go"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
networks:
|
|
- mycrib-network
|
|
|
|
# MyCrib API
|
|
api:
|
|
build:
|
|
context: .
|
|
target: api
|
|
container_name: mycrib-api
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${PORT:-8000}:8000"
|
|
environment:
|
|
# Server
|
|
PORT: "8000"
|
|
DEBUG: "${DEBUG:-false}"
|
|
ALLOWED_HOSTS: "${ALLOWED_HOSTS:-localhost,127.0.0.1}"
|
|
TIMEZONE: "${TIMEZONE:-UTC}"
|
|
|
|
# Database
|
|
DB_HOST: db
|
|
DB_PORT: "5432"
|
|
POSTGRES_USER: ${POSTGRES_USER:-mycrib}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-mycrib_dev_password}
|
|
POSTGRES_DB: ${POSTGRES_DB:-mycrib}
|
|
DB_SSLMODE: "${DB_SSLMODE:-disable}"
|
|
|
|
# Redis
|
|
REDIS_URL: "redis://redis:6379/0"
|
|
|
|
# Security
|
|
SECRET_KEY: ${SECRET_KEY:-dev-secret-key-change-in-production-min-32-chars}
|
|
|
|
# Email
|
|
EMAIL_HOST: ${EMAIL_HOST:-smtp.gmail.com}
|
|
EMAIL_PORT: ${EMAIL_PORT:-587}
|
|
EMAIL_HOST_USER: ${EMAIL_HOST_USER}
|
|
EMAIL_HOST_PASSWORD: ${EMAIL_HOST_PASSWORD}
|
|
DEFAULT_FROM_EMAIL: ${DEFAULT_FROM_EMAIL:-MyCrib <noreply@mycrib.com>}
|
|
EMAIL_USE_TLS: "${EMAIL_USE_TLS:-true}"
|
|
|
|
# Push Notifications
|
|
GORUSH_URL: "http://gorush:8088"
|
|
APNS_AUTH_KEY_PATH: "/certs/apns_key.p8"
|
|
APNS_AUTH_KEY_ID: ${APNS_AUTH_KEY_ID}
|
|
APNS_TEAM_ID: ${APNS_TEAM_ID}
|
|
APNS_TOPIC: ${APNS_TOPIC:-com.example.mycrib}
|
|
APNS_USE_SANDBOX: "${APNS_USE_SANDBOX:-true}"
|
|
FCM_SERVER_KEY: ${FCM_SERVER_KEY}
|
|
volumes:
|
|
- ./push_certs:/certs:ro
|
|
- api_uploads:/app/uploads
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
# gorush: # Optional - enable when push notifications are configured
|
|
# condition: service_started
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8000/api/health/"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
networks:
|
|
- mycrib-network
|
|
|
|
# MyCrib Worker (Background Jobs)
|
|
worker:
|
|
build:
|
|
context: .
|
|
target: worker
|
|
container_name: mycrib-worker
|
|
restart: unless-stopped
|
|
environment:
|
|
# Database
|
|
DB_HOST: db
|
|
DB_PORT: "5432"
|
|
POSTGRES_USER: ${POSTGRES_USER:-mycrib}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-mycrib_dev_password}
|
|
POSTGRES_DB: ${POSTGRES_DB:-mycrib}
|
|
DB_SSLMODE: "${DB_SSLMODE:-disable}"
|
|
|
|
# Redis
|
|
REDIS_URL: "redis://redis:6379/0"
|
|
|
|
# Security
|
|
SECRET_KEY: ${SECRET_KEY:-dev-secret-key-change-in-production-min-32-chars}
|
|
|
|
# Push Notifications
|
|
GORUSH_URL: "http://gorush:8088"
|
|
|
|
# Email
|
|
EMAIL_HOST: ${EMAIL_HOST:-smtp.gmail.com}
|
|
EMAIL_PORT: ${EMAIL_PORT:-587}
|
|
EMAIL_HOST_USER: ${EMAIL_HOST_USER}
|
|
EMAIL_HOST_PASSWORD: ${EMAIL_HOST_PASSWORD}
|
|
DEFAULT_FROM_EMAIL: ${DEFAULT_FROM_EMAIL:-MyCrib <noreply@mycrib.com>}
|
|
EMAIL_USE_TLS: "${EMAIL_USE_TLS:-true}"
|
|
|
|
# Worker settings
|
|
CELERY_BEAT_REMINDER_HOUR: ${CELERY_BEAT_REMINDER_HOUR:-20}
|
|
CELERY_BEAT_REMINDER_MINUTE: ${CELERY_BEAT_REMINDER_MINUTE:-0}
|
|
volumes:
|
|
- ./push_certs:/certs:ro
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- mycrib-network
|
|
|
|
# MyCrib Admin Panel
|
|
admin:
|
|
build:
|
|
context: .
|
|
target: admin
|
|
container_name: mycrib-admin
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${ADMIN_PORT:-9000}:9000"
|
|
environment:
|
|
# Server
|
|
PORT: "8000" # Used to calculate admin port
|
|
DEBUG: "${DEBUG:-false}"
|
|
|
|
# Database
|
|
DB_HOST: db
|
|
DB_PORT: "5432"
|
|
POSTGRES_USER: ${POSTGRES_USER:-mycrib}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-mycrib_dev_password}
|
|
POSTGRES_DB: ${POSTGRES_DB:-mycrib}
|
|
DB_SSLMODE: "${DB_SSLMODE:-disable}"
|
|
|
|
# Security
|
|
SECRET_KEY: ${SECRET_KEY:-dev-secret-key-change-in-production-min-32-chars}
|
|
volumes:
|
|
- admin_uploads:/app/uploads
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
networks:
|
|
- mycrib-network
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
api_uploads:
|
|
admin_uploads:
|
|
|
|
networks:
|
|
mycrib-network:
|
|
driver: bridge
|