Skip to content

Commit e06cb81

Browse files
authored
Feat/dev deployment (#88)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added Docker-based deployment tooling for simplified local development and full image builds. * Introduced a lightweight deployment mode for fast startup without rebuilding images. * New commands for starting/stopping services, viewing status and logs, and printing DevTools/UI and API endpoints. * Built-in Chrome/Chromium launch with remote debugging, profile handling, and a cleanup command for development workflows. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents 6bd384c + 5cd243d commit e06cb81

2 files changed

Lines changed: 127 additions & 0 deletions

File tree

docker/Makefile

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Makefile for Browser Operator Core
2+
# Provides DevTools frontend + Agent Server deployments
3+
4+
.PHONY: help build devtools-up up down logs status chrome chrome-clean
5+
6+
# Chrome binary detection with cross-platform fallbacks
7+
# Override with: CHROME_BINARY=/path/to/chrome make chrome
8+
CHROME_BINARY ?= $(shell \
9+
if command -v google-chrome >/dev/null 2>&1; then echo "google-chrome"; \
10+
elif command -v chromium >/dev/null 2>&1; then echo "chromium"; \
11+
elif command -v chromium-browser >/dev/null 2>&1; then echo "chromium-browser"; \
12+
elif [ -x "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary" ]; then echo "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary"; \
13+
elif [ -x "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ]; then echo "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"; \
14+
else echo "chrome-not-found"; \
15+
fi)
16+
17+
# Chrome profile directory (cleaned before each run)
18+
CHROME_PROFILE ?= /tmp/browser-operator-chrome-profile
19+
20+
help: ## Show this help
21+
@echo "Browser Operator Core - Docker Deployments"
22+
@echo "==========================================="
23+
@echo ""
24+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-12s %s\n", $$1, $$2}'
25+
@echo ""
26+
@echo "Deployment options:"
27+
@echo " Type 1: make devtools-up # DevTools only (AUTOMATED_MODE=true by default)"
28+
@echo " Type 2: make up # DevTools + Agent Server (lightweight)"
29+
@echo ""
30+
@echo "Full build (includes agent-server in image):"
31+
@echo " make build && docker-compose up -d"
32+
@echo ""
33+
@echo "For manual debugging mode (Type 1 without API key bypass):"
34+
@echo " docker-compose build --build-arg AUTOMATED_MODE=false && make devtools-up"
35+
36+
build: ## Build full image (DevTools + Agent Server baked in)
37+
docker-compose build
38+
39+
devtools-up: ## Start DevTools only (Type 1)
40+
docker-compose up -d
41+
@echo ""
42+
@echo "DevTools UI: http://localhost:8000"
43+
44+
up: ## Start DevTools + Agent Server (Type 2 - lightweight)
45+
docker-compose -f docker-compose.lightweight.yml up -d
46+
@echo ""
47+
@echo "Services:"
48+
@echo " DevTools: http://localhost:8000"
49+
@echo " Agent API: http://localhost:8080"
50+
@echo " Agent WS: ws://localhost:8082"
51+
52+
down: ## Stop all containers
53+
docker-compose -f docker-compose.lightweight.yml down 2>/dev/null || true
54+
docker-compose down 2>/dev/null || true
55+
56+
logs: ## Show logs
57+
docker-compose -f docker-compose.lightweight.yml logs -f 2>/dev/null || docker-compose logs -f
58+
59+
status: ## Show container status
60+
@docker ps --filter "name=browser-operator"
61+
62+
chrome-clean: ## Remove Chrome debug profile
63+
@rm -rf "$(CHROME_PROFILE)"
64+
@echo "Cleaned Chrome profile: $(CHROME_PROFILE)"
65+
66+
chrome: chrome-clean ## Launch Chrome with custom DevTools (clean profile)
67+
@if [ "$(CHROME_BINARY)" = "chrome-not-found" ]; then \
68+
echo "Error: No Chrome/Chromium binary found."; \
69+
echo "Set CHROME_BINARY=/path/to/chrome make chrome"; \
70+
exit 1; \
71+
fi
72+
@echo "Using Chrome: $(CHROME_BINARY)"
73+
@echo "Profile: $(CHROME_PROFILE)"
74+
"$(CHROME_BINARY)" \
75+
--remote-debugging-port=9222 \
76+
--remote-allow-origins="*" \
77+
--auto-open-devtools-for-tabs \
78+
--user-data-dir="$(CHROME_PROFILE)" \
79+
--custom-devtools-frontend=http://localhost:8000/
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Lightweight deployment: DevTools + Agent Server (no full build required)
2+
# Uses pre-built DevTools image + separate Agent Server container
3+
#
4+
# Usage:
5+
# docker-compose -f docker-compose.lightweight.yml up -d
6+
7+
services:
8+
devtools:
9+
image: browser-operator-devtools:latest
10+
container_name: browser-operator-devtools
11+
ports:
12+
- "8000:8000"
13+
volumes:
14+
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
15+
restart: unless-stopped
16+
networks:
17+
- devtools-network
18+
19+
agent-server:
20+
image: node:18-alpine
21+
container_name: browser-operator-agent
22+
working_dir: /app
23+
volumes:
24+
- ../agent-server/nodejs:/app:ro
25+
- agent-data:/app/clients
26+
command: ["node", "start.js"]
27+
ports:
28+
- "8080:8080"
29+
- "8082:8082"
30+
environment:
31+
- NODE_ENV=production
32+
- HOST=0.0.0.0
33+
- PORT=8082
34+
- API_PORT=8080
35+
- CDP_HOST=${CDP_HOST:-host.docker.internal}
36+
- CDP_PORT=${CDP_PORT:-9222}
37+
extra_hosts:
38+
- "host.docker.internal:host-gateway"
39+
restart: unless-stopped
40+
networks:
41+
- devtools-network
42+
43+
volumes:
44+
agent-data:
45+
46+
networks:
47+
devtools-network:
48+
driver: bridge

0 commit comments

Comments
 (0)