nxtgauge-backend-rust/docker-compose.yml
Ashwin Kumar 23c2edd567 feat: improve startup and routing
- Create scripts/init-db.sql for DB schema initialization
- Enhance start-services.sh to auto-initialize DB if needed
- Fix users admin handler: change root route from '/users' to '/' to avoid double prefix
- Remove deprecated handlers (departments/designations/employees) from users service
- Add missing admin route mappings for users and approval/case endpoints in gateway
- Update gateway to correctly handle /api/admin/users, /api/admin/approvals, etc.
- Update .env.example and docs

These changes enable running the stack without Docker and fix admin panel routing.
2026-04-07 22:12:37 +02:00

322 lines
9.3 KiB
YAML

version: '3.9'
services:
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_USER: nxtgauge
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-nxtgauge_dev}
POSTGRES_DB: nxtgauge_db
ports:
- '5432:5432'
volumes:
- pgdata:/var/lib/postgresql/data
- ./scripts/init-db.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U nxtgauge -d nxtgauge_db']
interval: 5s
timeout: 5s
retries: 10
redis:
image: redis:7-alpine
restart: unless-stopped
ports:
- '6379:6379'
volumes:
- redisdata:/data
command: redis-server --appendonly yes
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 5s
timeout: 5s
retries: 10
# ── Core Services ────────────────────────────────────────────────────────
gateway:
build:
context: .
dockerfile: apps/gateway/Dockerfile
environment:
PORT: 8000
USERS_SERVICE_URL: http://users:8080
COMPANIES_SERVICE_URL: http://companies:8081
JOB_SEEKERS_SERVICE_URL: http://job_seekers:8082
CUSTOMERS_SERVICE_URL: http://customers:8083
PHOTOGRAPHERS_SERVICE_URL: http://photographers:8085
MAKEUP_ARTISTS_SERVICE_URL: http://makeup_artists:8086
TUTORS_SERVICE_URL: http://tutors:8087
DEVELOPERS_SERVICE_URL: http://developers:8088
VIDEO_EDITORS_SERVICE_URL: http://video_editors:8089
GRAPHIC_DESIGNERS_SERVICE_URL: http://graphic_designers:8090
SOCIAL_MEDIA_MANAGERS_SERVICE_URL: http://social_media_managers:8091
FITNESS_TRAINERS_SERVICE_URL: http://fitness_trainers:8092
CATERING_SERVICES_SERVICE_URL: http://catering_services:8093
PAYMENTS_SERVICE_URL: http://payments:8094
REDIS_URL: redis://redis:6379
ports:
- '8000:8000'
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
users:
build:
context: .
dockerfile: apps/users/Dockerfile
environment:
PORT: 8080
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
JWT_EXPIRY_MINUTES: 15
REFRESH_TOKEN_EXPIRY_DAYS: 30
FRONTEND_URL: ${FRONTEND_URL:-http://localhost:3000}
SMTP_HOST: ${SMTP_HOST:-}
SMTP_PORT: ${SMTP_PORT:-587}
SMTP_USER: ${SMTP_USER:-}
SMTP_PASS: ${SMTP_PASS:-}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
companies:
build:
context: .
dockerfile: apps/companies/Dockerfile
environment:
PORT: 8081
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
job_seekers:
build:
context: .
dockerfile: apps/job_seekers/Dockerfile
environment:
PORT: 8082
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
customers:
build:
context: .
dockerfile: apps/customers/Dockerfile
environment:
PORT: 8083
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
# ── 9 Profession Services ─────────────────────────────────────────────────
photographers:
build:
context: .
dockerfile: apps/photographers/Dockerfile
environment:
PORT: 8085
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
makeup_artists:
build:
context: .
dockerfile: apps/makeup_artists/Dockerfile
environment:
PORT: 8086
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
tutors:
build:
context: .
dockerfile: apps/tutors/Dockerfile
environment:
PORT: 8087
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
developers:
build:
context: .
dockerfile: apps/developers/Dockerfile
environment:
PORT: 8088
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
video_editors:
build:
context: .
dockerfile: apps/video_editors/Dockerfile
environment:
PORT: 8089
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
graphic_designers:
build:
context: .
dockerfile: apps/graphic_designers/Dockerfile
environment:
PORT: 8090
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
social_media_managers:
build:
context: .
dockerfile: apps/social_media_managers/Dockerfile
environment:
PORT: 8091
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
fitness_trainers:
build:
context: .
dockerfile: apps/fitness_trainers/Dockerfile
environment:
PORT: 8092
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
catering_services:
build:
context: .
dockerfile: apps/catering_services/Dockerfile
environment:
PORT: 8093
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
# ── Payments ──────────────────────────────────────────────────────────────
payments:
build:
context: .
dockerfile: apps/payments/Dockerfile
environment:
PORT: 8094
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
RAZORPAY_KEY_ID: ${RAZORPAY_KEY_ID:-}
RAZORPAY_KEY_SECRET: ${RAZORPAY_KEY_SECRET:-}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
employees:
build:
context: .
dockerfile: apps/employees/Dockerfile
environment:
PORT: 8095
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
ugc_content_creators:
build:
context: .
dockerfile: apps/ugc_content_creators/Dockerfile
environment:
PORT: 8096
DATABASE_URL: postgresql://nxtgauge:${POSTGRES_PASSWORD:-nxtgauge_dev}@postgres:5432/nxtgauge_db
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
volumes:
pgdata:
redisdata: