Repository navigation
Expand file tree
/
Copy pathdocker-compose.local.yml
More file actions
140 lines (132 loc) · 5.39 KB
/
Copy pathdocker-compose.local.yml
File metadata and controls
140 lines (132 loc) · 5.39 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
135
136
137
138
139
140
# Local development dependencies only. FrontLit itself runs on the host:
#
# docker compose -f docker-compose.local.yml up
# bun run dev:api
# bun run dev:web
# bun run dev:sites
#
# This file also applies FrontLit Drizzle migrations onto Postgres (the
# `frontlit-migrate` job). Wait for "FrontLit migrations applied." before
# `bun run dev:api`.
#
# Do not run this file at the same time as the self-host stack
# (`docker-compose.yml`) — both publish Postgres on 5433 and SendLit on 3001.
# For the full in-Docker product, see docker-compose.yml.
name: frontlit-local
x-postgres-user: &postgres-user ${POSTGRES_USER:-frontlit}
x-postgres-password: &postgres-password ${POSTGRES_PASSWORD:-frontlit}
x-postgres-db: &postgres-db ${POSTGRES_DB:-frontlit}
services:
postgres:
image: pgvector/pgvector:pg17
restart: unless-stopped
environment:
POSTGRES_USER: *postgres-user
POSTGRES_PASSWORD: *postgres-password
POSTGRES_DB: *postgres-db
ports:
- "${POSTGRES_BIND:-127.0.0.1}:${POSTGRES_PORT:-5433}:5432"
volumes:
- frontlit-local-postgres-data:/var/lib/postgresql/data
- ./docker/postgres-init/01-create-sendlit-db.sh:/docker-entrypoint-initdb.d/01-create-sendlit-db.sh:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 5s
timeout: 5s
retries: 12
sendlit-redis:
image: redis:7-alpine
restart: unless-stopped
command: redis-server --appendonly yes
ports:
- "${REDIS_BIND:-127.0.0.1}:${REDIS_PORT:-6379}:6379"
volumes:
- sendlit-local-redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 12
# Applies apps/api/drizzle onto the `frontlit` database. Restart: "no"
# so `docker compose up` does not loop; re-run with
# `docker compose -f docker-compose.local.yml up frontlit-migrate`.
frontlit-migrate:
image: pgvector/pgvector:pg17
restart: "no"
depends_on:
postgres:
condition: service_healthy
environment:
PGHOST: postgres
PGUSER: *postgres-user
PGPASSWORD: *postgres-password
PGDATABASE: *postgres-db
MIGRATIONS_FOLDER: /migrations
volumes:
- ./apps/api/drizzle:/migrations:ro
- ./docker/frontlit-migrate.sh:/frontlit-migrate.sh:ro
command: ["sh", "/frontlit-migrate.sh"]
sendlit-db-init:
image: pgvector/pgvector:pg17
restart: "no"
depends_on:
postgres:
condition: service_healthy
environment:
PGPASSWORD: *postgres-password
command:
- sh
- -ec
- >-
psql -h postgres -U ${POSTGRES_USER:-frontlit} -d ${POSTGRES_DB:-frontlit} -tAc
"SELECT 1 FROM pg_database WHERE datname = 'sendlit'" |
grep -q 1 || psql -h postgres -U ${POSTGRES_USER:-frontlit} -d ${POSTGRES_DB:-frontlit}
-v ON_ERROR_STOP=1 -c "CREATE DATABASE sendlit OWNER ${POSTGRES_USER:-frontlit}"
sendlit-api:
image: codelit/sendlit-api:latest
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
sendlit-redis:
condition: service_healthy
sendlit-db-init:
condition: service_completed_successfully
command:
- sh
- -ec
- |
node apps/api/dist/db/migrate.js
exec node apps/api/dist/index.js
environment:
SENDLIT_DEPLOYMENT_MODE: "${SENDLIT_DEPLOYMENT_MODE:-oss}"
NODE_ENV: "${SENDLIT_NODE_ENV:-development}"
PORT: 3001
DB_CONNECTION_STRING: postgres://${POSTGRES_USER:-frontlit}:${POSTGRES_PASSWORD:-frontlit}@postgres:5432/sendlit
REDIS_HOST: sendlit-redis
REDIS_PORT: 6379
API_PUBLIC_URL: "${SENDLIT_API_PUBLIC_URL:-http://localhost:3001}"
WEB_CLIENT: "${SENDLIT_WEB_CLIENT:-http://localhost:3001}"
PROTOCOL: "${SENDLIT_PROTOCOL:-http}"
DOMAIN: "${SENDLIT_DOMAIN:-localhost:3001}"
BETTER_AUTH_SECRET: "${SENDLIT_BETTER_AUTH_SECRET:-frontlit-local-sendlit-better-auth-secret}"
PIXEL_SIGNING_SECRET: "${SENDLIT_PIXEL_SIGNING_SECRET:-frontlit-local-sendlit-pixel-signing}"
ESP_CREDENTIALS_ENCRYPTION_KEY: "${SENDLIT_ESP_CREDENTIALS_ENCRYPTION_KEY:-frontlit-local-sendlit-esp-key-32b}"
SUPPRESSION_HASH_KEY: "${SENDLIT_SUPPRESSION_HASH_KEY:-frontlit-local-sendlit-suppression}"
SUPER_ADMIN_EMAIL: "${SENDLIT_SUPER_ADMIN_EMAIL:-admin@example.com}"
ports:
- "${SENDLIT_API_PORT:-3001}:3001"
healthcheck:
test: ["CMD-SHELL", "node -e \"fetch('http://127.0.0.1:3001/health').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))\""]
interval: 10s
timeout: 5s
retries: 12
mailpit:
image: axllent/mailpit:latest
restart: unless-stopped
ports:
- "${MAILPIT_SMTP_PORT:-1025}:1025"
- "${MAILPIT_HTTP_PORT:-8025}:8025"
volumes:
frontlit-local-postgres-data:
sendlit-local-redis-data: