Architecture Overview
The Docker Compose configuration defines 9 services across 3 networks:Data Services
PostgreSQL, ClickHouse, Redis
Applications
Web, Landing, Docs
Workers
Agent Worker, Migrations
Network Architecture
Services
PostgreSQL (db)
Main application database for storing users, workspaces, prompts, and configuration.ghcr.io/${GHCR_USERNAME}/oneglanse-postgres:latestCustom PostgreSQL image with initialization scripts.postgres_dbdb_data:/var/lib/postgresql/data- Persistent database storage./packages/db/init-scripts:/docker-entrypoint-initdb.d- Initialization SQL scripts
data- Internal data network
POSTGRES_USERPOSTGRES_PASSWORDPOSTGRES_DB
ClickHouse (clickhouse)
Analytics database for storing prompt responses, metrics, and time-series data.clickhouse/clickhouse-server:latestOfficial ClickHouse server image.clickhouse_dbNo external ports exposed (internal access only via HTTP on port 8123).
clickhouse_data:/var/lib/clickhouse- Persistent analytics data./packages/db/clickhouse-init:/docker-entrypoint-initdb.d- Initialization scripts
data- Internal data network
CLICKHOUSE_USERCLICKHOUSE_PASSWORDCLICKHOUSE_DB
Redis (redis)
In-memory data store for BullMQ job queues and application caching.redis:7-alpineLightweight Redis 7 image.redisredis_data:/data- Persistent cache and queue data
data- Internal data network
REDIS_PASSWORD
Web App (web)
Main authenticated product application (Next.js 15 + tRPC).ghcr.io/${GHCR_USERNAME}/oneglanse-web:latestoneglanse-web127.0.0.1:3001:3000- Web interface bound to localhost only
frontend- Public-facing networkbackend- Internal backend communicationdata- Database access
.env.Waits for:
db(healthy)migrate(completed successfully)redis(healthy)clickhouse(healthy)
Landing App (landing)
Public marketing website.ghcr.io/${GHCR_USERNAME}/oneglanse-landing:latestoneglanse-landing127.0.0.1:3000:3000- Public website bound to localhost
frontend- Public-facing network only
Docs App (docs)
Public technical documentation site.ghcr.io/${GHCR_USERNAME}/oneglanse-docs:latestoneglanse-docs127.0.0.1:3002:3002- Documentation site bound to localhost
frontend- Public-facing network only
Agent Worker (agent-worker)
BullMQ worker that processes browser automation jobs using Playwright.ghcr.io/${GHCR_USERNAME}/oneglanse-agent:latestoneglanse-agent-worker1gbRequired for Chromium browser instances.16mAllows long-running browser jobs to complete gracefully before shutdown.agent_storage:/storage- Browser profiles and session data
backend- Communication with web appdata- Redis queue access
.env- Shared environment variablesapps/agent/.env- Agent-specific configuration
Waits for:
redis(healthy)
Database Migrations (migrate)
One-shot service that runs Drizzle ORM migrations on startup.ghcr.io/${GHCR_USERNAME}/oneglanse-web:latestUses web image which contains the @oneglanse/db package.oneglanse-migratenoRuns once and exits.data- Database access
Waits for:
db(healthy)
Volumes
Persistent storage volumes for stateful services:PostgreSQL database files. Contains all application data including users, workspaces, prompts.Location:
/var/lib/postgresql/data in containerClickHouse database files. Contains analytics data, prompt responses, metrics.Location:
/var/lib/clickhouse in containerRedis persistence files. Contains job queues and cache data.Location:
/data in containerAgent worker storage. Contains browser profiles, authentication data, temporary files.Location:
/storage in containerNetworks
Three isolated networks for security and organization:Purpose: Public-facing applicationsServices: Landing, Docs, WebApplications that serve HTTP traffic to users.
Purpose: Internal service communicationServices: Web, Agent WorkerServices that communicate internally but don’t need database access.
Purpose: Database and cache accessServices: DB, ClickHouse, Redis, Web, Agent Worker, MigrateServices that require direct database or cache connectivity.
Common Commands
Starting Services
Stopping Services
Viewing Logs
Service Management
Health Checks
Port Mappings
Services accessible from the host machine:| Service | Container Port | Host Port | URL |
|---|---|---|---|
| Web App | 3000 | 3001 | http://localhost:3001 |
| Landing | 3000 | 3000 | http://localhost:3000 |
| Docs | 3002 | 3002 | http://localhost:3002 |
| PostgreSQL | 5432 | Not exposed | Internal only |
| ClickHouse | 8123 | Not exposed | Internal only |
| Redis | 6379 | Not exposed | Internal only |
Database services are not exposed to the host for security. Use
docker compose exec to access them directly.Resource Management
Total resource allocation when all services are running:Maximum: 7.5 CPUs
Reserved: 2.85 CPUs
Maximum: 9.5 GB
Reserved: 2.6 GB
Adjusting Resources
Modify resource limits indocker-compose.yml:
Troubleshooting
Services won't start
Services won't start
Problem: Services fail to start or remain unhealthy.Solutions:
-
Check service logs:
-
Verify environment variables:
-
Ensure
GHCR_USERNAMEis set: - Check Docker resources in Docker Desktop settings
-
Reset everything:
Port already in use
Port already in use
Problem: Port binding errors on startup.Solutions:
-
Find process using the port:
-
Stop conflicting service or change port in
docker-compose.yml:
Database connection errors
Database connection errors
Problem: Applications can’t connect to databases.Solutions:
-
Verify database is healthy:
-
Check DATABASE_URL uses service name:
-
Test connection:
-
Verify credentials match:
Migration fails
Migration fails
Problem:
migrate service fails or exits with error.Solutions:-
Check migration logs:
-
Ensure database is ready:
-
Run manually:
-
Reset database (development only):
Agent worker not processing jobs
Agent worker not processing jobs
Problem: Jobs queue but aren’t executed.Solutions:
-
Check agent worker logs:
-
Verify Redis connectivity:
-
Check Redis password matches in
.envandapps/agent/.env -
Restart worker:
-
Increase worker concurrency in
.env:
Out of memory errors
Out of memory errors
Problem: Services crash with OOM errors.Solutions:
- Increase Docker memory limit in Docker Desktop
-
Reduce agent worker concurrency:
-
Adjust memory limits in
docker-compose.yml -
Monitor resource usage:
Image pull failures
Image pull failures
Problem: Can’t pull Docker images from GHCR.Solutions:
-
Verify
GHCR_USERNAMEis set: -
Authenticate with GHCR:
-
Check image exists:
-
For private repos, ensure GitHub token has
read:packagesscope
Production Considerations
-
Use External Databases
- Managed PostgreSQL (RDS, Cloud SQL)
- Managed Redis (ElastiCache, Redis Cloud)
- Managed ClickHouse (ClickHouse Cloud)
-
Configure Reverse Proxy
- Use nginx or Traefik in front of services
- Configure SSL/TLS certificates
- Set up domain routing
-
Enable Monitoring
- Add Prometheus for metrics
- Configure logging aggregation
- Set up health check endpoints
-
Secrets Management
- Use Docker secrets or external secret managers
- Never commit
.envwith production credentials - Rotate secrets regularly
-
Backup Strategy
- Automate volume backups
- Test restore procedures
- Document backup retention policy
-
Security Hardening
- Run containers as non-root users
- Enable Docker Content Trust
- Scan images for vulnerabilities
- Use private networks
Next Steps
Local Setup
Complete local development setup guide
Environment Variables
Learn about all environment variables
Architecture
Understand the system architecture
Deployment
Deploy to production