Skip to content

Commit ba6d712

Browse files
authored
Merge pull request #17 from mjunaidca/008-dev-containers
feat(docker): add development containers with hot reload
2 parents c7ce492 + 5258ff8 commit ba6d712

19 files changed

Lines changed: 1606 additions & 3 deletions

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,6 @@ cookies.txt
6161
panaversity-fs/
6262
rag-agent/
6363

64-
blueprints/
64+
pnpm-store
65+
.pnpm-store/
66+
blueprints/

compose.dev.yaml

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
# =============================================================================
2+
# TaskFlow Platform - Development Docker Compose
3+
# =============================================================================
4+
# Development stack with hot reloading for all services
5+
#
6+
# Uses Dockerfile.dev for each service with:
7+
# - Polling-based file watching (macOS Docker compatible)
8+
# - Hot reload commands built-in
9+
#
10+
# Usage:
11+
# ./docker-dev.sh # Start dev environment
12+
# ./docker-dev.sh --logs # Start and follow logs
13+
# ./docker-dev.sh --clean # Clean volumes and restart
14+
#
15+
# Hot Reload:
16+
# - Python: uvicorn --reload with polling
17+
# - Next.js: Fast Refresh with polling
18+
# =============================================================================
19+
20+
name: taskflow-dev
21+
22+
services:
23+
# ===========================================================================
24+
# PostgreSQL Database (shared with production)
25+
# ===========================================================================
26+
postgres:
27+
image: postgres:16-alpine
28+
environment:
29+
POSTGRES_USER: postgres
30+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
31+
POSTGRES_DB: taskflow
32+
volumes:
33+
- postgres_data:/var/lib/postgresql/data
34+
ports:
35+
- "5432:5432"
36+
healthcheck:
37+
test: ["CMD-SHELL", "pg_isready -U postgres -d taskflow"]
38+
interval: 10s
39+
timeout: 5s
40+
retries: 5
41+
start_period: 10s
42+
restart: unless-stopped
43+
networks:
44+
- taskflow-network
45+
46+
# ===========================================================================
47+
# pgAdmin (Database UI)
48+
# ===========================================================================
49+
pgadmin:
50+
image: dpage/pgadmin4:latest
51+
environment:
52+
- PGADMIN_DEFAULT_EMAIL=admin@example.com
53+
- PGADMIN_DEFAULT_PASSWORD=admin
54+
- PGADMIN_CONFIG_SERVER_MODE=False
55+
- PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED=False
56+
ports:
57+
- "5050:80"
58+
volumes:
59+
- pgadmin_data:/var/lib/pgadmin
60+
- ./pgadmin-servers.json:/pgadmin4/servers.json:ro
61+
depends_on:
62+
postgres:
63+
condition: service_healthy
64+
restart: unless-stopped
65+
networks:
66+
- taskflow-network
67+
68+
# ===========================================================================
69+
# SSO Platform (Better Auth) - Development with Hot Reload
70+
# ===========================================================================
71+
sso-platform:
72+
build:
73+
context: ./sso-platform
74+
dockerfile: Dockerfile.dev
75+
environment:
76+
- DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD:-postgres}@postgres:5432/taskflow?sslmode=disable
77+
- BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET}
78+
- BETTER_AUTH_URL=http://localhost:3001
79+
- NEXT_PUBLIC_BETTER_AUTH_URL=http://localhost:3001
80+
- ALLOWED_ORIGINS=http://localhost:3000,http://localhost:8000,http://web-dashboard:3000,http://api:8000
81+
- DISABLE_EMAIL_VERIFICATION=true
82+
volumes:
83+
- ./sso-platform:/app
84+
- /app/node_modules
85+
- /app/.next
86+
ports:
87+
- "3001:3001"
88+
depends_on:
89+
postgres:
90+
condition: service_healthy
91+
restart: unless-stopped
92+
networks:
93+
- taskflow-network
94+
95+
# ===========================================================================
96+
# TaskFlow API (FastAPI) - Development with Hot Reload
97+
# ===========================================================================
98+
api:
99+
build:
100+
context: ./packages/api
101+
dockerfile: Dockerfile.dev
102+
environment:
103+
- DATABASE_URL=postgresql+asyncpg://postgres:${POSTGRES_PASSWORD:-postgres}@postgres:5432/taskflow
104+
- SSO_URL=http://sso-platform:3001
105+
- ALLOWED_ORIGINS=http://localhost:3000,http://localhost:3001,http://web-dashboard:3000,http://sso-platform:3001
106+
- DEBUG=true
107+
- LOG_LEVEL=DEBUG
108+
- DEV_MODE=true
109+
- MCP_SERVER_URL=http://mcp-server:8001/mcp
110+
- OPENAI_API_KEY=${OPENAI_API_KEY}
111+
- TASKFLOW_CHATKIT_DATABASE_URL=${TASKFLOW_CHATKIT_DATABASE_URL:-postgresql+asyncpg://postgres:${POSTGRES_PASSWORD:-postgres}@postgres:5432/taskflow}
112+
volumes:
113+
- ./packages/api/src:/app/src
114+
ports:
115+
- "8000:8000"
116+
depends_on:
117+
postgres:
118+
condition: service_healthy
119+
restart: unless-stopped
120+
networks:
121+
- taskflow-network
122+
123+
# ===========================================================================
124+
# MCP Server (HTTP transport) - Development with Hot Reload
125+
# ===========================================================================
126+
mcp-server:
127+
build:
128+
context: ./packages/mcp-server
129+
dockerfile: Dockerfile.dev
130+
environment:
131+
- TASKFLOW_API_URL=http://api:8000
132+
- TASKFLOW_MCP_HOST=0.0.0.0
133+
- TASKFLOW_MCP_PORT=8001
134+
- TASKFLOW_DEV_MODE=true
135+
- TASKFLOW_API_TIMEOUT=30.0
136+
volumes:
137+
- ./packages/mcp-server/src:/app/src
138+
ports:
139+
- "8001:8001"
140+
depends_on:
141+
postgres:
142+
condition: service_healthy
143+
restart: unless-stopped
144+
networks:
145+
- taskflow-network
146+
147+
# ===========================================================================
148+
# Web Dashboard (Next.js) - Development with Fast Refresh
149+
# ===========================================================================
150+
web-dashboard:
151+
build:
152+
context: ./web-dashboard
153+
dockerfile: Dockerfile.dev
154+
environment:
155+
# Browser URLs (used by client-side code)
156+
- NEXT_PUBLIC_SSO_URL=http://localhost:3001
157+
- NEXT_PUBLIC_API_URL=http://localhost:8000
158+
- NEXT_PUBLIC_OAUTH_CLIENT_ID=taskflow-sso-public-client
159+
- NEXT_PUBLIC_OAUTH_REDIRECT_URI=http://localhost:3000/api/auth/callback
160+
- NEXT_PUBLIC_OAUTH_SCOPE=openid profile email
161+
- NEXT_PUBLIC_CHATKIT_DOMAIN_KEY=${NEXT_PUBLIC_CHATKIT_DOMAIN_KEY:-domain_pk_local_dev}
162+
# Server URLs (used by API routes)
163+
- SERVER_API_URL=http://api:8000
164+
- SERVER_SSO_URL=http://sso-platform:3001
165+
volumes:
166+
- ./web-dashboard:/app
167+
- /app/node_modules
168+
- /app/.next
169+
ports:
170+
- "3000:3000"
171+
depends_on:
172+
postgres:
173+
condition: service_healthy
174+
restart: unless-stopped
175+
networks:
176+
- taskflow-network
177+
178+
networks:
179+
taskflow-network:
180+
driver: bridge
181+
182+
volumes:
183+
postgres_data:
184+
pgadmin_data:
185+
186+
# =============================================================================
187+
# HOT RELOAD:
188+
# - Edit src/ files → auto-reload in ~3-5 seconds
189+
# - Dependencies installed in Docker image (not mounted)
190+
# - Only src/ and public/ folders are mounted for hot reload
191+
# =============================================================================

dev-local.sh

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#!/bin/bash
2+
# =============================================================================
3+
# TaskFlow Local Development Script (No Docker)
4+
# =============================================================================
5+
# Starts all 4 services locally with hot reload
6+
#
7+
# Prerequisites:
8+
# - PostgreSQL running on localhost:5432
9+
# - Node.js + pnpm installed
10+
# - Python + uv installed
11+
#
12+
# Usage:
13+
# ./dev-local.sh
14+
# =============================================================================
15+
16+
set -e
17+
18+
RED='\033[0;31m'
19+
GREEN='\033[0;32m'
20+
YELLOW='\033[1;33m'
21+
CYAN='\033[0;36m'
22+
NC='\033[0m'
23+
24+
echo -e "${CYAN}=== TaskFlow Local Dev ===${NC}"
25+
echo ""
26+
27+
# Check .env files
28+
echo -e "${YELLOW}Checking .env files...${NC}"
29+
MISSING=false
30+
31+
check_env() {
32+
local dir=$1
33+
local name=$2
34+
if [ -f "$dir/.env" ] || [ -f "$dir/.env.local" ]; then
35+
echo -e " ${GREEN}${NC} $name"
36+
else
37+
echo -e " ${RED}${NC} $name - missing .env or .env.local"
38+
MISSING=true
39+
fi
40+
}
41+
42+
check_env "sso-platform" "sso-platform"
43+
check_env "web-dashboard" "web-dashboard"
44+
check_env "packages/api" "api"
45+
check_env "packages/mcp-server" "mcp-server"
46+
47+
if [ "$MISSING" = true ]; then
48+
echo ""
49+
echo -e "${RED}ERROR: Missing .env files. Copy from .env.example${NC}"
50+
exit 1
51+
fi
52+
53+
echo ""
54+
echo -e "${GREEN}All .env files present!${NC}"
55+
echo ""
56+
57+
# Start services in background
58+
echo -e "${YELLOW}Starting services...${NC}"
59+
60+
# SSO Platform (port 3001)
61+
echo " - sso-platform (port 3001)"
62+
cd sso-platform && pnpm dev &
63+
SSO_PID=$!
64+
cd ..
65+
66+
# Web Dashboard (port 3000)
67+
echo " - web-dashboard (port 3000)"
68+
cd web-dashboard && pnpm dev &
69+
DASH_PID=$!
70+
cd ..
71+
72+
# API (port 8000)
73+
echo " - api (port 8000)"
74+
cd packages/api && uv run uvicorn taskflow_api.main:app --reload --port 8000 &
75+
API_PID=$!
76+
cd ../..
77+
78+
# MCP Server (port 8001)
79+
echo " - mcp-server (port 8001)"
80+
cd packages/mcp-server && uv run uvicorn taskflow_mcp.http_server:app --reload --port 8001 &
81+
MCP_PID=$!
82+
cd ../..
83+
84+
echo ""
85+
echo -e "${GREEN}=== All Services Started ===${NC}"
86+
echo ""
87+
echo " Dashboard: http://localhost:3000"
88+
echo " SSO: http://localhost:3001"
89+
echo " API: http://localhost:8000"
90+
echo " MCP: http://localhost:8001"
91+
echo ""
92+
echo -e "${CYAN}Press Ctrl+C to stop all services${NC}"
93+
94+
# Wait and cleanup on exit
95+
trap "kill $SSO_PID $DASH_PID $API_PID $MCP_PID 2>/dev/null; echo ''; echo 'Stopped all services.'" EXIT
96+
wait

0 commit comments

Comments
 (0)