-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
134 lines (122 loc) · 4.1 KB
/
Copy pathdocker-compose.yml
File metadata and controls
134 lines (122 loc) · 4.1 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Infrastructure services for local development and integration testing.
#
# Functions run as local Node processes (via `make dev-fn` or `pnpm dev:fn`),
# NOT inside Docker. This keeps the edit-run cycle fast — no rebuild needed.
#
# Usage:
# docker compose up -d # Start infra (postgres, graphql, mailpit)
# docker compose down # Stop everything
# docker compose logs -f # Follow logs
services:
postgres:
image: ghcr.io/constructive-io/docker/postgres-plus:18
environment:
POSTGRES_DB: constructive
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set (see .env.example)}
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
db-setup:
image: ghcr.io/constructive-io/constructive-db-job:latest
depends_on:
postgres:
condition: service_healthy
environment:
PGHOST: postgres
PGPORT: "5432"
PGUSER: postgres
PGPASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set (see .env.example)}
PGDATABASE: constructive
CONSTRUCTIVE_DOMAIN: "localhost"
entrypoint: ["bash", "-c"]
command:
- |
set -eo pipefail
cd /app
echo "Creating database $$PGDATABASE"
createdb -h "$$PGHOST" -U "$$PGUSER" "$$PGDATABASE" || true
echo "Applying bootstrap roles"
pgpm admin-users bootstrap --yes
pgpm admin-users add --test --yes
echo "Deploying constructive-local (services + database record)"
pgpm deploy --yes --database "$$PGDATABASE" --package constructive-local
echo "Deploying metaschema"
pgpm deploy --yes --database "$$PGDATABASE" --package metaschema
echo "Deploying pgpm-database-jobs"
pgpm deploy --yes --database "$$PGDATABASE" --package pgpm-database-jobs
echo "Done"
graphql-server:
image: ghcr.io/constructive-io/constructive:latest
pull_policy: always
depends_on:
db-setup:
condition: service_completed_successfully
extra_hosts:
- "host.docker.internal:host-gateway"
- "localhost:host-gateway"
entrypoint: ["cnc", "server", "--host", "0.0.0.0", "--port", "3000", "--origin", "*", "--strictAuth", "false"]
environment:
NODE_ENV: development
LOG_LEVEL: debug
DEBUG: "graphile*"
PORT: "3000"
SERVER_HOST: "0.0.0.0"
SERVER_TRUST_PROXY: "true"
SERVER_ORIGIN: "*"
SERVER_STRICT_AUTH: "false"
# Postgres connection
PGHOST: postgres
PGPORT: "5432"
PGUSER: postgres
PGPASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set (see .env.example)}
PGDATABASE: constructive
# API configuration — header-based routing (X-Api-Name, X-Database-Id)
API_ENABLE_META: "true"
API_ENABLE_SERVICES: "true"
API_ENABLE_TENANT: "true"
API_EXPOSED_SCHEMAS: "collections_public,meta_public,storage_public,app_public"
API_ANON_ROLE: "administrator"
API_ROLE_NAME: "administrator"
API_DEFAULT_DATABASE_ID: "constructive"
# S3/MinIO configuration (extra_hosts makes localhost work from inside container)
CDN_ENDPOINT: "http://localhost:9000"
BUCKET_NAME: "test-bucket"
BUCKET_PROVIDER: "minio"
AWS_REGION: "us-east-1"
AWS_ACCESS_KEY: "minioadmin"
AWS_SECRET_KEY: "minioadmin"
ports:
- "3002:3000"
mailpit:
image: axllent/mailpit:latest
ports:
- "1025:1025" # SMTP
- "8025:8025" # Web UI
minio:
image: quay.io/minio/minio:latest
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
# Enable CORS for browser uploads
MINIO_API_CORS_ALLOW_ORIGIN: "*"
ports:
- "9000:9000" # API
- "9001:9001" # Console
volumes:
- minio-data:/data
command: server /data --console-address ":9001"
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 5s
timeout: 5s
retries: 5
volumes:
pgdata:
minio-data: