-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
135 lines (127 loc) · 4.15 KB
/
docker-compose.yml
File metadata and controls
135 lines (127 loc) · 4.15 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
services:
# ==========================================
# PostgreSQL Database
# ==========================================
postgres:
image: postgres:16-alpine
container_name: feedback-postgres
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: feedback_widget
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
networks:
- feedback-network
# ==========================================
# Backend API
# Automatically runs migrations and seeds on startup
# Works WITHOUT AI - AI is completely optional!
# ==========================================
api:
build:
context: ./api
dockerfile: Dockerfile
target: development
container_name: feedback-api
restart: unless-stopped
environment:
# ==========================================
# DATABASE (Auto-configured for Docker)
# ==========================================
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/feedback_widget?schema=public
# ==========================================
# SERVER SETTINGS
# ==========================================
NODE_ENV: development
PORT: 3333
CORS_ORIGIN: http://localhost:4321,http://localhost:3000,http://localhost:3001
# ==========================================
# SECURITY (REQUIRED!)
# ==========================================
# Generate a secure key: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
ENCRYPTION_KEY: ${ENCRYPTION_KEY:-dev-key-change-in-production-for-security}
# ==========================================
# AI CONFIGURATION (OPTIONAL!)
# ==========================================
# The widget works GREAT without AI!
# To enable AI, set AI_PROVIDER to MOONSHOT or ANTHROPIC
# and provide your API key
#
# Get Moonshot key: https://platform.moonshot.ai
# Get Anthropic key: https://console.anthropic.com
#
AI_PROVIDER: ${AI_PROVIDER:-NONE}
AI_API_KEY: ${AI_API_KEY:-}
AI_MODEL: ${AI_MODEL:-kimi-k2.5}
# ==========================================
# EMAIL / SMTP (OPTIONAL - Mailtrap for dev)
# ==========================================
# Sign up for free at https://mailtrap.io
# Or use your own SMTP provider
SMTP_HOST: ${SMTP_HOST:-sandbox.smtp.mailtrap.io}
SMTP_PORT: ${SMTP_PORT:-2525}
SMTP_USER: ${SMTP_USER:-}
SMTP_PASS: ${SMTP_PASS:-}
ADMIN_EMAIL: ${ADMIN_EMAIL:-admin@example.com}
ENABLE_EMAIL_NOTIFICATIONS: ${ENABLE_EMAIL_NOTIFICATIONS:-false}
ports:
- "3333:3333"
volumes:
# Mount source code for hot reload in development
- ./api:/app
# Preserve node_modules
- /app/node_modules
- /app/dist
depends_on:
postgres:
condition: service_healthy
networks:
- feedback-network
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3333/health"]
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
# ==========================================
# Frontend (Optional)
# ==========================================
# For the best development experience with hot reload,
# we recommend running the frontend OUTSIDE Docker:
#
# cd web && npm install && npm run dev
#
# Uncomment below if you prefer running in Docker:
# ------------------------------------------
# web:
# image: node:20-alpine
# container_name: feedback-web
# working_dir: /app
# environment:
# PUBLIC_API_URL: http://localhost:3333
# ports:
# - "4321:4321"
# volumes:
# - ./web:/app
# - /app/node_modules
# depends_on:
# api:
# condition: service_healthy
# networks:
# - feedback-network
# command: sh -c "npm ci && npm run dev -- --host"
volumes:
postgres_data:
driver: local
networks:
feedback-network:
driver: bridge