Skip to content

Commit a8b5af9

Browse files
add local email service docker compse
1 parent b6c718e commit a8b5af9

1 file changed

Lines changed: 123 additions & 0 deletions

File tree

docker-compose.local-email.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
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+
environment:
34+
NODE_ENV: development
35+
PORT: "3000"
36+
SERVER_HOST: "0.0.0.0"
37+
SERVER_TRUST_PROXY: "true"
38+
SERVER_ORIGIN: "*"
39+
SERVER_STRICT_AUTH: "false"
40+
# Postgres - use host.docker.internal to connect to local postgres
41+
PGHOST: host.docker.internal
42+
PGPORT: "5432"
43+
PGUSER: ${PGUSER:-postgres}
44+
PGPASSWORD: ${PGPASSWORD:-password}
45+
PGDATABASE: constructive
46+
# API configuration
47+
API_ENABLE_SERVICES: "true"
48+
API_IS_PUBLIC: "false"
49+
API_EXPOSED_SCHEMAS: "metaschema_public,services_public,constructive_auth_public"
50+
API_META_SCHEMAS: "metaschema_public,services_public,metaschema_modules_public,constructive_auth_public"
51+
API_ANON_ROLE: "administrator"
52+
API_ROLE_NAME: "administrator"
53+
ports:
54+
- "3002:3000"
55+
networks:
56+
- constructive-net
57+
58+
# Send email link function (uses SMTP to Mailpit)
59+
send-email-link:
60+
container_name: send-email-link
61+
image: constructive:dev
62+
entrypoint: ["node", "functions/send-email-link/dist/index.js"]
63+
depends_on:
64+
- mailpit
65+
- constructive-admin-server
66+
environment:
67+
NODE_ENV: development
68+
PORT: "8080"
69+
LOG_LEVEL: info
70+
# GraphQL endpoints
71+
GRAPHQL_URL: "http://constructive-admin-server:3000/graphql"
72+
META_GRAPHQL_URL: "http://constructive-admin-server:3000/graphql"
73+
GRAPHQL_API_NAME: "private"
74+
# SMTP configuration (Mailpit)
75+
EMAIL_SEND_USE_SMTP: "true"
76+
SMTP_HOST: mailpit
77+
SMTP_PORT: "1025"
78+
SMTP_FROM: "noreply@localhost"
79+
# Local app port for email links
80+
LOCAL_APP_PORT: "3011"
81+
ALLOW_LOCALHOST: "true"
82+
SEND_EMAIL_LINK_DRY_RUN: "false"
83+
ports:
84+
- "8082:8080"
85+
networks:
86+
- constructive-net
87+
88+
# Job service (polls app_jobs, triggers send-email-link)
89+
knative-job-service:
90+
container_name: knative-job-service
91+
image: constructive:dev
92+
entrypoint: ["node", "jobs/knative-job-service/dist/run.js"]
93+
depends_on:
94+
- send-email-link
95+
environment:
96+
NODE_ENV: development
97+
# Postgres - use host.docker.internal to connect to local postgres
98+
PGHOST: host.docker.internal
99+
PGPORT: "5432"
100+
PGUSER: ${PGUSER:-postgres}
101+
PGPASSWORD: ${PGPASSWORD:-password}
102+
PGDATABASE: constructive
103+
JOBS_SCHEMA: app_jobs
104+
# Worker config
105+
JOBS_SUPPORT_ANY: "true"
106+
JOBS_SUPPORTED: "send-email-link"
107+
HOSTNAME: "local-worker"
108+
# Callback server
109+
INTERNAL_JOBS_CALLBACK_PORT: "8080"
110+
INTERNAL_JOBS_CALLBACK_URL: "http://knative-job-service:8080/callback"
111+
JOBS_CALLBACK_HOST: "knative-job-service"
112+
# Function gateway
113+
INTERNAL_GATEWAY_URL: "http://send-email-link:8080"
114+
INTERNAL_GATEWAY_DEVELOPMENT_MAP: '{"send-email-link":"http://send-email-link:8080"}'
115+
ports:
116+
- "8080:8080"
117+
networks:
118+
- constructive-net
119+
120+
networks:
121+
constructive-net:
122+
external: true
123+
name: constructive-net

0 commit comments

Comments
 (0)