-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.self-hosted.yml
More file actions
165 lines (156 loc) · 4.88 KB
/
docker-compose.self-hosted.yml
File metadata and controls
165 lines (156 loc) · 4.88 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# ============================================================================
# Betterbase Self-Hosted Production Docker Compose
#
# Full self-hosted deployment with all services.
# No external dependencies required.
#
# Usage:
# 1. Build the dashboard: bun --cwd apps/dashboard run build
# (Produces ./apps/dashboard/dist - required before starting)
# 2. Build the server: bun run build
# 3. cp .env.example .env
# 4. docker compose -f docker-compose.self-hosted.yml up -d
#
# Services:
# - PostgreSQL: http://localhost:5432
# - MinIO: http://localhost:9000 (console: http://localhost:9001)
# - Inngest: http://localhost:8288
# - Server: http://localhost:3000
# - Dashboard: http://localhost:3000 (root)
# ============================================================================
services:
postgres:
image: postgres:16-alpine
container_name: betterbase-postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-betterbase}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-betterbase}
POSTGRES_DB: ${POSTGRES_DB:-betterbase}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-betterbase}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- betterbase-internal
minio:
image: minio/minio:RELEASE.2024-11-07T19-31-41Z
container_name: betterbase-minio
restart: unless-stopped
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin}
volumes:
- minio_data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 10s
timeout: 5s
retries: 5
networks:
- betterbase-internal
minio-init:
image: minio/mc:RELEASE.2024-11-08T03-47-05Z
container_name: betterbase-minio-init
depends_on:
minio:
condition: service_healthy
entrypoint: >
/bin/sh -c "
mc alias set local http://minio:9000 ${MINIO_ROOT_USER:-minioadmin} ${MINIO_ROOT_PASSWORD:-minioadmin};
mc mb --ignore-existing local/betterbase;
echo 'MinIO bucket initialized.';
"
networks:
- betterbase-internal
inngest:
image: inngest/inngest:v1.17.5
container_name: betterbase-inngest
restart: unless-stopped
command: inngest start --host 0.0.0.0 --port 8288
environment:
INNGEST_LOG_LEVEL: ${INNGEST_LOG_LEVEL:-info}
volumes:
- inngest_data:/data
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:8288/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
networks:
- betterbase-internal
betterbase-server:
build:
context: .
dockerfile: packages/server/Dockerfile
container_name: betterbase-server
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
minio:
condition: service_healthy
minio-init:
condition: service_completed_successfully
inngest:
condition: service_healthy
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-betterbase}:${POSTGRES_PASSWORD:-betterbase}@postgres:5432/${POSTGRES_DB:-betterbase}
BETTERBASE_JWT_SECRET: ${BETTERBASE_JWT_SECRET:?JWT secret required - set BETTERBASE_JWT_SECRET in .env}
BETTERBASE_PUBLIC_URL: ${BETTERBASE_PUBLIC_URL:-http://localhost:3000}
STORAGE_ENDPOINT: http://minio:9000
STORAGE_ACCESS_KEY: ${MINIO_ROOT_USER:-minioadmin}
STORAGE_SECRET_KEY: ${MINIO_ROOT_PASSWORD:-minioadmin}
STORAGE_BUCKET: betterbase
PORT: "3001"
NODE_ENV: production
CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost}
INNGEST_BASE_URL: http://inngest:8288
INNGEST_SIGNING_KEY: ${INNGEST_SIGNING_KEY:-}
INNGEST_EVENT_KEY: ${INNGEST_EVENT_KEY:-}
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:3001/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
networks:
- betterbase-internal
dashboard:
image: nginx:alpine
container_name: betterbase-dashboard
restart: unless-stopped
volumes:
- ./apps/dashboard/dist:/usr/share/nginx/html:ro
depends_on:
- betterbase-server
networks:
- betterbase-internal
nginx:
image: nginx:alpine
container_name: betterbase-nginx
restart: unless-stopped
depends_on:
- betterbase-server
- dashboard
ports:
- "${HTTP_PORT:-80}:80"
volumes:
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost/health"]
interval: 30s
timeout: 10s
retries: 3
networks:
- betterbase-internal
volumes:
postgres_data:
minio_data:
inngest_data:
networks:
betterbase-internal:
driver: bridge