Skip to content

Commit 70d8a2b

Browse files
authored
Merge pull request #888 from constructive-io/feat/add-local-email-service-docker-compse
add local email service docker compse
2 parents 0b7edbd + 022559e commit 70d8a2b

1 file changed

Lines changed: 127 additions & 0 deletions

File tree

docker-compose.local-email.yml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Local Email Services for Development
2+
#
3+
# Usage:
4+
# docker-compose -f docker-compose.local-email.yml up -d
5+
#
6+
# Services:
7+
# - mailpit (SMTP: 1025, Web UI: 8025)
8+
# - constructive-admin-server (3002)
9+
# - send-email-link (8082)
10+
# - knative-job-service (8080)
11+
#
12+
# Prerequisites:
13+
# - PostgreSQL running with constructive database
14+
# - Network: constructive-net (created by docker-compose.yml)
15+
# - Build image first: docker build -t constructive:dev .
16+
17+
services:
18+
# Mailpit - Local email testing (replaces Mailgun)
19+
mailpit:
20+
container_name: mailpit
21+
image: axllent/mailpit:latest
22+
ports:
23+
- "1025:1025" # SMTP
24+
- "8025:8025" # Web UI
25+
networks:
26+
- constructive-net
27+
28+
# Admin GraphQL Server (internal, header-based routing)
29+
constructive-admin-server:
30+
container_name: constructive-admin-server
31+
image: constructive:dev
32+
entrypoint: ["constructive", "server", "--host", "0.0.0.0", "--port", "3000", "--origin", "*"]
33+
extra_hosts:
34+
- "host.docker.internal:host-gateway"
35+
environment:
36+
NODE_ENV: development
37+
PORT: "3000"
38+
SERVER_HOST: "0.0.0.0"
39+
SERVER_TRUST_PROXY: "true"
40+
SERVER_ORIGIN: "*"
41+
SERVER_STRICT_AUTH: "false"
42+
# Postgres - use host.docker.internal to connect to local postgres
43+
PGHOST: host.docker.internal
44+
PGPORT: "5432"
45+
PGUSER: ${PGUSER:-postgres}
46+
PGPASSWORD: ${PGPASSWORD:-password}
47+
PGDATABASE: constructive
48+
# API configuration
49+
API_ENABLE_SERVICES: "true"
50+
API_IS_PUBLIC: "false"
51+
API_EXPOSED_SCHEMAS: "metaschema_public,services_public,constructive_auth_public"
52+
API_META_SCHEMAS: "metaschema_public,services_public,metaschema_modules_public,constructive_auth_public"
53+
API_ANON_ROLE: "administrator"
54+
API_ROLE_NAME: "administrator"
55+
ports:
56+
- "3002:3000"
57+
networks:
58+
- constructive-net
59+
60+
# Send email link function (uses SMTP to Mailpit)
61+
send-email-link:
62+
container_name: send-email-link
63+
image: constructive:dev
64+
entrypoint: ["node", "functions/send-email-link/dist/index.js"]
65+
depends_on:
66+
- mailpit
67+
- constructive-admin-server
68+
environment:
69+
NODE_ENV: development
70+
PORT: "8080"
71+
LOG_LEVEL: info
72+
# GraphQL endpoints
73+
GRAPHQL_URL: "http://constructive-admin-server:3000/graphql"
74+
META_GRAPHQL_URL: "http://constructive-admin-server:3000/graphql"
75+
GRAPHQL_API_NAME: "private"
76+
# SMTP configuration (Mailpit)
77+
EMAIL_SEND_USE_SMTP: "true"
78+
SMTP_HOST: mailpit
79+
SMTP_PORT: "1025"
80+
SMTP_FROM: "noreply@localhost"
81+
# Local app port for email links
82+
LOCAL_APP_PORT: "3011"
83+
ALLOW_LOCALHOST: "true"
84+
SEND_EMAIL_LINK_DRY_RUN: "false"
85+
ports:
86+
- "8082:8080"
87+
networks:
88+
- constructive-net
89+
90+
# Job service (polls app_jobs, triggers send-email-link)
91+
knative-job-service:
92+
container_name: knative-job-service
93+
image: constructive:dev
94+
entrypoint: ["node", "jobs/knative-job-service/dist/run.js"]
95+
depends_on:
96+
- send-email-link
97+
extra_hosts:
98+
- "host.docker.internal:host-gateway"
99+
environment:
100+
NODE_ENV: development
101+
# Postgres - use host.docker.internal to connect to local postgres
102+
PGHOST: host.docker.internal
103+
PGPORT: "5432"
104+
PGUSER: ${PGUSER:-postgres}
105+
PGPASSWORD: ${PGPASSWORD:-password}
106+
PGDATABASE: constructive
107+
JOBS_SCHEMA: app_jobs
108+
# Worker config
109+
JOBS_SUPPORT_ANY: "true"
110+
JOBS_SUPPORTED: "send-email-link"
111+
HOSTNAME: "local-worker"
112+
# Callback server
113+
INTERNAL_JOBS_CALLBACK_PORT: "8080"
114+
INTERNAL_JOBS_CALLBACK_URL: "http://knative-job-service:8080/callback"
115+
JOBS_CALLBACK_HOST: "knative-job-service"
116+
# Function gateway
117+
INTERNAL_GATEWAY_URL: "http://send-email-link:8080"
118+
INTERNAL_GATEWAY_DEVELOPMENT_MAP: '{"send-email-link":"http://send-email-link:8080"}'
119+
ports:
120+
- "8080:8080"
121+
networks:
122+
- constructive-net
123+
124+
networks:
125+
constructive-net:
126+
external: true
127+
name: constructive-net

0 commit comments

Comments
 (0)