Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules
.next
.git
.gitignore
README.md
Dockerfile
docker-compose.yml
.dockerignore
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.env.local
.env.development.local
.env.test.local
.env.production.local
121 changes: 121 additions & 0 deletions DOCKER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Docker Setup for Open Agent Platform

This Docker Compose setup allows you to run all required services locally with a single command.

## Prerequisites

1. Docker and Docker Compose installed
2. All external repositories cloned as siblings to this repo:
```
parent-directory/
├── open-agent-platform/ (this repo)
├── deep-agent/ (port 2024)
├── agent-optimizer/ (port 2025)
├── triggers/ (port 8080)
├── langconnect/ (port 8888)
└── tool-server/ (port 8000)
```

## Setup

### 1. Configure External Services

Each external service needs a Dockerfile. Copy the appropriate template:

**For Node.js services:**
```bash
cp docker/Dockerfile.oap.node ../service-name/Dockerfile.oap
```

**For Python services:**
```bash
cp docker/Dockerfile.oap.python ../service-name/Dockerfile.oap
```

### 2. Update Docker Compose

Edit `docker-compose.yml` and:
- Adjust the `context` paths to match your repo locations
- Uncomment Python service commands for Python-based services
- Remove `/app/node_modules` volume mounts for Python services
- Add any service-specific environment variables

### 3. Environment Variables

Copy and configure environment files:
```bash
cp apps/web/.env.example apps/web/.env
```

Update the environment variables in `.env` and `docker-compose.yml` as needed.

## Usage

### Start all services
```bash
docker-compose up
```

### Start with rebuild
```bash
docker-compose up --build
```

### Start in background
```bash
docker-compose up -d
```

### View logs
```bash
docker-compose logs -f [service-name]
```

### Stop all services
```bash
docker-compose down
```

## Service Ports

- **web**: http://localhost:3000 (this repo)
- **deep-agent**: http://localhost:2024
- **agent-optimizer**: http://localhost:2025
- **triggers**: http://localhost:8080
- **langconnect**: http://localhost:8888
- **tool-server**: http://localhost:8000

## Hot Reloading

All services are configured with volume mounts to enable hot reloading:
- Source code changes will automatically trigger rebuilds
- Node modules are cached in anonymous volumes for performance

## Troubleshooting

### Service won't start
1. Check if the external repo path exists
2. Verify the Dockerfile exists in the external repo
3. Check service logs: `docker-compose logs [service-name]`

### Port conflicts
If ports are already in use, update the port mappings in `docker-compose.yml`:
```yaml
ports:
- "NEW_PORT:ORIGINAL_PORT"
```

### Dependencies not installing
For Node.js services, ensure `package.json` exists in the external repo root.
For Python services, ensure `requirements.txt` exists in the external repo root.

## Customization

### Adding environment variables
Add them to the `environment` section of each service in `docker-compose.yml`.

### Changing start commands
Update the `command` field for each service in `docker-compose.yml`.

### Adding new services
Follow the same pattern as existing services in `docker-compose.yml`.
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM node:20-alpine

# Install build dependencies for native modules
RUN apk add --no-cache make gcc g++ python3

WORKDIR /app

COPY package.json yarn.lock ./
COPY .yarn .yarn
COPY .yarnrc.yml .yarnrc.yml

COPY apps/ ./apps/
COPY packages/ ./packages/
COPY turbo.json ./

RUN corepack enable
RUN yarn install --immutable

COPY . .

EXPOSE 3000

CMD ["yarn", "dev"]
137 changes: 137 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
version: '3.8'

services:
# Main web application (this repo)
web:
build:
context: .
dockerfile: Dockerfile
ports:
- "3000:3000"
volumes:
# Mount source code for hot reloading
- .:/app
- /app/node_modules
- /app/.next
env_file:
- apps/web/.env
depends_on:
- deep-agent
- agent-optimizer
- triggers
- langconnect-oap
- tool-server
networks:
- open-agent-network

# Deep agent service (external repo)
deep-agent:
build:
context: ../deep-agent
dockerfile: Dockerfile
ports:
- "2024:2024"
volumes:
- ../deep-agent:/app
- /app/node_modules # If JS/TS
env_file:
- ../deep-agent/.env
networks:
- open-agent-network

# Agent optimizer service (external repo)
agent-optimizer:
build:
context: ../agent-optimizer
dockerfile: Dockerfile
ports:
- "2025:2025"
volumes:
- ../agent-optimizer:/app
- /app/node_modules # If JS/TS
env_file:
- ../agent-optimizer/.env
networks:
- open-agent-network

# Triggers service (external repo)
triggers:
build:
context: ../triggers
dockerfile: Dockerfile
ports:
- "8080:8080"
volumes:
- ../triggers:/app
- /app/node_modules # If JS/TS
env_file:
- ../triggers/.env
networks:
- open-agent-network

# LangConnect PostgreSQL database
langconnect-postgres-oap:
image: pgvector/pgvector:pg16
container_name: langconnect-postgres-oap
restart: always
ports:
- "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
volumes:
- langconnect_postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
interval: 5s
timeout: 5s
retries: 5
networks:
- open-agent-network

# LangConnect API service (external repo)
langconnect-oap:
build:
context: ../langconnect
dockerfile: Dockerfile
container_name: langconnect-api-oap
restart: always
depends_on:
langconnect-postgres-oap:
condition: service_healthy
ports:
- "8888:8888"
env_file:
- ../langconnect/.env
environment:
POSTGRES_HOST: langconnect-postgres-oap
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
volumes:
- ../langconnect/langconnect:/app/langconnect
networks:
- open-agent-network

# Tool server service (external repo)
tool-server:
build:
context: ../tool-server
dockerfile: Dockerfile
ports:
- "8000:8000"
volumes:
- ../tool-server:/app
env_file:
- ../tool-server/.env
networks:
- open-agent-network

volumes:
langconnect_postgres_data:

networks:
open-agent-network:
driver: bridge
14 changes: 14 additions & 0 deletions docker/Dockerfile.oap.node
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Example Dockerfile for Node.js services
FROM node:20-alpine

WORKDIR /app

# Install dependencies
COPY package*.json ./
RUN npm install

# Copy source code
COPY . .

# Default command (override in docker-compose.yml if needed)
CMD ["npm", "run", "dev"]
19 changes: 19 additions & 0 deletions docker/Dockerfile.oap.python
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Example Dockerfile for Python services
FROM python:3.11-slim

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
&& rm -rf /var/lib/apt/lists/*

# Install Python dependencies
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

# Copy source code
COPY . .

# Default command (override in docker-compose.yml if needed)
CMD ["python", "main.py"]