-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
154 lines (144 loc) · 4.81 KB
/
docker-compose.yml
File metadata and controls
154 lines (144 loc) · 4.81 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
services:
# PostgreSQL Database with pgvector extension for local development
postgres:
image: pgvector/pgvector:pg16
container_name: labs-asp-postgres
ports:
- "5432:5432"
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=labs_asp_dev
volumes:
- postgres-data:/var/lib/postgresql/data
- ./migrations:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- mastra-network
# Browser Streaming Service (includes Playwright MCP)
browser-streaming:
build:
context: ./playwright-mcp
dockerfile: Dockerfile
ports:
- "8931:8931" # Playwright MCP server
- "8933:8933" # Browser streaming WebSocket port
restart: unless-stopped
networks:
- mastra-network
# Browser WebSocket Proxy (optional - for testing production setup locally)
# In production, this runs on Cloud Run to upgrade ws:// to wss://
# In local dev, client connects directly to ws://localhost:8933 (no proxy needed)
browser-ws-proxy:
build:
context: ./browser-ws-proxy
dockerfile: Dockerfile
ports:
- "8080:8080" # Proxy port
environment:
- BROWSER_STREAMING_HOST=browser-streaming
- BROWSER_STREAMING_PORT=8933
- PORT=8080
- NODE_ENV=development
depends_on:
- browser-streaming
restart: unless-stopped
networks:
- mastra-network
profiles:
- proxy-test # Only start with: docker-compose --profile proxy-test up
# Main Mastra Application
mastra-app:
build:
context: .
dockerfile: Dockerfile
ports:
- "4111:4112" # Mastra dev server (external:internal)
environment:
- PLAYWRIGHT_MCP_URL=http://browser-streaming:8931/mcp
- BROWSER_STREAMING_URL=ws://browser-streaming:8933
- NODE_ENV=production
env_file:
- .env
volumes:
# Mount Google credentials if using local file
- ./vertex-ai-credentials.json:/app/vertex-ai-credentials.json:ro
# Mount artifacts directory for local development
- ./artifacts:/app/artifacts
depends_on:
- browser-streaming
- postgres
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:4112/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
restart: unless-stopped
networks:
- mastra-network
# AI Chatbot Next.js Application
ai-chatbot:
build:
context: .
dockerfile: Dockerfile.ai-chatbot
args:
PLAYWRIGHT_MCP_URL: http://host.docker.internal:8931/mcp
BROWSER_STREAMING_URL: ws://host.docker.internal:8933
NEXT_PUBLIC_MASTRA_SERVER_URL: http://localhost:4111
# Feature flag for AI SDK agent (set to 'true' to use Kernel.sh instead of Mastra)
USE_AI_SDK_AGENT: ${USE_AI_SDK_AGENT:-false}
# Feature flag for guest login (set to 'true' to enable guest login form)
USE_GUEST_LOGIN: ${USE_GUEST_LOGIN:-false}
ports:
- "3000:3000" # Next.js application
environment:
# Existing Mastra backend config (keep for backward compatibility)
- PLAYWRIGHT_MCP_URL=http://browser-streaming:8931/mcp
- BROWSER_STREAMING_URL=ws://browser-streaming:8933
- NODE_ENV=production
- NEXTAUTH_URL=http://localhost:3000
- NEXT_PUBLIC_MASTRA_SERVER_URL=http://localhost:4111
- MASTRA_SERVER_URL=http://mastra-app:4112
- BROWSER_STREAMING_HOST=browser-streaming
- BROWSER_STREAMING_PORT=8933
# NEW: Feature flag and Kernel API for AI SDK agent
- USE_AI_SDK_AGENT=${USE_AI_SDK_AGENT:-false}
- NEXT_PUBLIC_USE_AI_SDK_AGENT=${USE_AI_SDK_AGENT:-false}
- KERNEL_API_KEY=${KERNEL_API_KEY:-}
# Feature flag for guest login in preview environments
- USE_GUEST_LOGIN=${USE_GUEST_LOGIN:-false}
- NEXT_PUBLIC_USE_GUEST_LOGIN=${USE_GUEST_LOGIN:-false}
env_file:
- client/.env.local
volumes:
# Mount Google credentials if using local file
- ./vertex-ai-credentials.json:/app/vertex-ai-credentials.json:ro
# Mount artifacts directory for local development
- ./artifacts:/app/artifacts
# Mount client vertex ai credentials
- ./client/vertex-ai-credentials.json:/app/client/vertex-ai-credentials.json:ro
depends_on:
- browser-streaming
- mastra-app
- postgres
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health", "||", "curl", "-f", "http://localhost:3000"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
restart: unless-stopped
networks:
- mastra-network
networks:
mastra-network:
driver: bridge
volumes:
postgres-data:
driver: local