File size: 2,412 Bytes
3577b8e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
services:
  # =====================
  # PostgreSQL Database
  # =====================
  postgres:
    image: postgres:15-alpine
    container_name: quzuu-postgres
    restart: unless-stopped
    environment:
      POSTGRES_USER: ${POSTGRES_USER:-quzuu}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-quzuu}
      POSTGRES_DB: ${POSTGRES_DB:-quzuu}
    volumes:
      - postgres_data:/var/lib/postgresql/data
      # Init script: buat roles yang dibutuhkan supabase/storage-api
      - ./docker/postgres/init-supabase-roles.sql:/docker-entrypoint-initdb.d/01-init-supabase-roles.sql
    ports:
      - "5432:5432"
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-quzuu} -d ${POSTGRES_DB:-quzuu}"]
      interval: 5s
      timeout: 5s
      retries: 10

  # =====================
  # Supabase Storage API (Self-Hosted)
  # =====================
  storage:
    image: supabase/storage-api:latest
    container_name: quzuu-storage
    restart: unless-stopped
    depends_on:
      postgres:
        condition: service_healthy
    environment:
      ANON_KEY: ${ANON_KEY}
      SERVICE_KEY: ${SERVICE_KEY}
      JWT_SECRET: ${JWT_SECRET}
      DATABASE_URL: ${DATABASE_URL:-postgres://quzuu:quzuu@postgres:5432/quzuu}
      DB_INSTALL_ROLES: "false"
      STORAGE_BACKEND: ${STORAGE_BACKEND:-file}
      FILE_STORAGE_BACKEND_PATH: ${FILE_STORAGE_BACKEND_PATH:-/var/lib/storage}
      IS_MULTITENANT: "false"
      TENANT_ID: stub
      PGRST_JWT_SECRET: ${PGRST_JWT_SECRET}
    volumes:
      - storage_data:/var/lib/storage
    ports:
      - "5000:5000"
    healthcheck:
      test: ["CMD-SHELL", "node -e \"require('http').get('http://localhost:5000/health', r => process.exit(r.statusCode < 500 ? 0 : 1)).on('error', () => process.exit(1))\""]
      interval: 10s
      timeout: 10s
      retries: 10
      start_period: 15s

  # =====================
  # Go Backend App
  # =====================
  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: quzuu-app
    restart: unless-stopped
    depends_on:
      postgres:
        condition: service_healthy
      storage:
        condition: service_healthy
    env_file:
      - .env.local
    ports:
      - "${HOST_PORT:-8080}:8080"
    volumes:
      # Mount logs directory agar bisa diakses dari host
      - ./logs:/app/logs

volumes:
  postgres_data:
    driver: local
  storage_data:
    driver: local