-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.selfhosted.yml
More file actions
130 lines (123 loc) · 3.42 KB
/
Copy pathdocker-compose.selfhosted.yml
File metadata and controls
130 lines (123 loc) · 3.42 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
version: "3.8"
# Self-hosted Kyrozen backend deployment.
#
# This stack runs the Kyrozen API backend + a local PostgreSQL instance.
# Public access is provided via Cloudflare Tunnel, so no inbound 80/443 ports
# or local TLS certificates are required on the host.
#
# Quick start:
# 1. Copy .env.example to .env and fill in your Supabase + AI keys.
# 2. Set KYROZEN_DB_BACKEND=postgres and KYROZEN_POSTGRES_DSN.
# 3. Add TUNNEL_TOKEN from Cloudflare Zero Trust (see docs/CLOUDFLARE_TUNNEL.md).
# 4. docker compose -f docker-compose.selfhosted.yml up -d --build --remove-orphans
services:
kyrozen-postgres:
image: postgres:16-alpine
container_name: kyrozen-postgres
restart: unless-stopped
env_file:
- .env
environment:
POSTGRES_DB: ${POSTGRES_DB:-kyrozen}
POSTGRES_USER: ${POSTGRES_USER:-kyrozen}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
volumes:
- kyrozen_postgres_data:/var/lib/postgresql/data
networks:
- kyrozen-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-kyrozen} -d ${POSTGRES_DB:-kyrozen}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
deploy:
resources:
limits:
cpus: "1.0"
memory: 1G
reservations:
cpus: "0.25"
memory: 256M
kyrozen-backend:
build:
context: .
dockerfile: Dockerfile.backend
container_name: kyrozen-backend
restart: unless-stopped
env_file:
- .env
environment:
- KYROZEN_HOST=0.0.0.0
- KYROZEN_PORT=8000
- KYROZEN_DB_BACKEND=postgres
- KYROZEN_POSTGRES_DSN=postgresql://${POSTGRES_USER:-kyrozen}:${POSTGRES_PASSWORD}@kyrozen-postgres:5432/${POSTGRES_DB:-kyrozen}
- KYROZEN_WORKSPACE_ROOT=/app/workspace
volumes:
- kyrozen_workspace:/app/workspace
networks:
- kyrozen-network
depends_on:
kyrozen-postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:8000/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
deploy:
resources:
limits:
cpus: "2.0"
memory: 2G
reservations:
cpus: "0.5"
memory: 512M
# Caddy is disabled when using Cloudflare Tunnel. Cloudflare handles TLS
# termination at the edge and forwards traffic through the tunnel.
# caddy:
# image: caddy:2-alpine
# container_name: kyrozen-caddy
# restart: unless-stopped
# ports:
# - "80:80"
# - "443:443"
# - "443:443/udp"
# volumes:
# - ./Caddyfile:/etc/caddy/Caddyfile:ro
# - caddy_data:/data
# - caddy_config:/config
# networks:
# - kyrozen-network
# depends_on:
# - kyrozen-backend
# deploy:
# resources:
# limits:
# cpus: "0.5"
# memory: 256M
cloudflared:
image: cloudflare/cloudflared:latest
container_name: kyrozen-cloudflared
restart: unless-stopped
command: tunnel run --token ${TUNNEL_TOKEN:?TUNNEL_TOKEN is required}
networks:
- kyrozen-network
env_file:
- .env
depends_on:
- kyrozen-backend
deploy:
resources:
limits:
cpus: "0.5"
memory: 256M
volumes:
kyrozen_workspace:
driver: local
kyrozen_postgres_data:
driver: local
networks:
kyrozen-network:
driver: bridge