mirror of https://github.com/kortix-ai/suna.git
refactor(docker): remove RabbitMQ service and related configurations from Docker setup
This commit is contained in:
parent
d300fa4171
commit
a343264160
|
@ -192,7 +192,6 @@ supabase/.temp/storage-version
|
|||
.env.scripts
|
||||
|
||||
redis_data
|
||||
rabbitmq_data
|
||||
|
||||
.setup_progress
|
||||
|
||||
|
|
|
@ -14,9 +14,6 @@ REDIS_PORT=6379
|
|||
REDIS_PASSWORD=
|
||||
REDIS_SSL=false
|
||||
|
||||
RABBITMQ_HOST=rabbitmq
|
||||
RABBITMQ_PORT=5672
|
||||
|
||||
# LLM Providers:
|
||||
ANTHROPIC_API_KEY=
|
||||
OPENAI_API_KEY=
|
||||
|
|
|
@ -23,30 +23,30 @@ docker compose down && docker compose up --build
|
|||
|
||||
You can run individual services from the docker-compose file. This is particularly useful during development:
|
||||
|
||||
### Running only Redis and RabbitMQ
|
||||
### Running only Redis
|
||||
|
||||
```bash
|
||||
docker compose up redis rabbitmq
|
||||
docker compose up redis
|
||||
```
|
||||
|
||||
### Running only the API and Worker
|
||||
### Running only the API
|
||||
|
||||
```bash
|
||||
docker compose up api worker
|
||||
docker compose up api
|
||||
```
|
||||
|
||||
## Development Setup
|
||||
|
||||
For local development, you might only need to run Redis and RabbitMQ, while working on the API locally. This is useful when:
|
||||
For local development, you might only need to run Redis, while working on the API locally. This is useful when:
|
||||
|
||||
- You're making changes to the API code and want to test them directly
|
||||
- You want to avoid rebuilding the API container on every change
|
||||
- You're running the API service directly on your machine
|
||||
|
||||
To run just Redis and RabbitMQ for development:
|
||||
To run just Redis for development:
|
||||
|
||||
```bash
|
||||
docker compose up redis rabbitmq
|
||||
docker compose up redis
|
||||
```
|
||||
|
||||
Then you can run your API service locally with the following commands:
|
||||
|
@ -55,10 +55,6 @@ Then you can run your API service locally with the following commands:
|
|||
# On one terminal
|
||||
cd backend
|
||||
uv run api.py
|
||||
|
||||
# On another terminal
|
||||
cd backend
|
||||
uv run dramatiq --processes 4 --threads 4 run_agent_background
|
||||
```
|
||||
|
||||
### Environment Configuration
|
||||
|
@ -79,8 +75,6 @@ SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
|
|||
# Infrastructure
|
||||
REDIS_HOST=redis # Use 'localhost' when running API locally
|
||||
REDIS_PORT=6379
|
||||
RABBITMQ_HOST=rabbitmq # Use 'localhost' when running API locally
|
||||
RABBITMQ_PORT=5672
|
||||
|
||||
# LLM Providers (at least one required)
|
||||
ANTHROPIC_API_KEY=your-anthropic-key
|
||||
|
@ -119,8 +113,7 @@ When running services individually, make sure to:
|
|||
|
||||
1. Check your `.env` file and adjust any necessary environment variables
|
||||
2. Ensure Redis connection settings match your local setup (default: `localhost:6379`)
|
||||
3. Ensure RabbitMQ connection settings match your local setup (default: `localhost:5672`)
|
||||
4. Update any service-specific environment variables if needed
|
||||
3. Update any service-specific environment variables if needed
|
||||
|
||||
### Important: Redis Host Configuration
|
||||
|
||||
|
@ -129,22 +122,12 @@ When running the API locally with Redis in Docker, you need to set the correct R
|
|||
- For Docker-to-Docker communication (when running both services in Docker): use `REDIS_HOST=redis`
|
||||
- For local-to-Docker communication (when running API locally): use `REDIS_HOST=localhost`
|
||||
|
||||
### Important: RabbitMQ Host Configuration
|
||||
|
||||
When running the API locally with RabbitMQ in Docker, you need to set the correct RabbitMQ host in your `.env` file:
|
||||
|
||||
- For Docker-to-Docker communication (when running both services in Docker): use `RABBITMQ_HOST=rabbitmq`
|
||||
- For local-to-Docker communication (when running API locally): use `RABBITMQ_HOST=localhost`
|
||||
|
||||
Example `.env` configuration for local development:
|
||||
|
||||
```sh
|
||||
REDIS_HOST=localhost # (instead of 'redis')
|
||||
REDIS_PORT=6379
|
||||
REDIS_PASSWORD=
|
||||
|
||||
RABBITMQ_HOST=localhost # (instead of 'rabbitmq')
|
||||
RABBITMQ_PORT=5672
|
||||
```
|
||||
|
||||
---
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
services:
|
||||
api:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: "14"
|
||||
memory: 48G
|
||||
reservations:
|
||||
cpus: "8"
|
||||
memory: 32G
|
||||
|
||||
worker:
|
||||
command: uv run dramatiq --skip-logging --processes 40 --threads 8 run_agent_background
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: "14"
|
||||
memory: 48G
|
||||
reservations:
|
||||
cpus: "8"
|
||||
memory: 32G
|
||||
|
||||
redis:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: "2"
|
||||
memory: 12G
|
||||
reservations:
|
||||
cpus: "1"
|
||||
memory: 8G
|
||||
|
||||
rabbitmq:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: "2"
|
||||
memory: 12G
|
||||
reservations:
|
||||
cpus: "1"
|
||||
memory: 8G
|
|
@ -17,8 +17,6 @@ services:
|
|||
depends_on:
|
||||
redis:
|
||||
condition: service_healthy
|
||||
rabbitmq:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- app-network
|
||||
environment:
|
||||
|
@ -26,8 +24,6 @@ services:
|
|||
- REDIS_PORT=6379
|
||||
- REDIS_PASSWORD=
|
||||
- LOG_LEVEL=INFO
|
||||
- RABBITMQ_HOST=rabbitmq
|
||||
- RABBITMQ_PORT=5672
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
|
@ -40,45 +36,6 @@ services:
|
|||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
worker:
|
||||
image: ghcr.io/suna-ai/suna-backend:latest
|
||||
platform: linux/amd64
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
command: uv run dramatiq --skip-logging --processes 4 --threads 4 run_agent_background
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- .:/app
|
||||
- /app/.venv
|
||||
- ./worker-logs:/app/logs
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
redis:
|
||||
condition: service_healthy
|
||||
rabbitmq:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- app-network
|
||||
environment:
|
||||
- REDIS_HOST=redis
|
||||
- REDIS_PORT=6379
|
||||
- REDIS_PASSWORD=
|
||||
- LOG_LEVEL=INFO
|
||||
- RABBITMQ_HOST=rabbitmq
|
||||
- RABBITMQ_PORT=5672
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
healthcheck:
|
||||
test: ["CMD", "uv", "run", "worker_health.py"]
|
||||
timeout: 20s
|
||||
interval: 30s
|
||||
start_period: 40s
|
||||
|
||||
redis:
|
||||
image: redis:8-alpine
|
||||
ports:
|
||||
|
@ -102,31 +59,9 @@ services:
|
|||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
rabbitmq:
|
||||
image: rabbitmq
|
||||
ports:
|
||||
- "127.0.0.1:5672:5672"
|
||||
volumes:
|
||||
- rabbitmq_data:/var/lib/rabbitmq
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- app-network
|
||||
healthcheck:
|
||||
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 10s
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
networks:
|
||||
app-network:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
redis_data:
|
||||
rabbitmq_data:
|
||||
|
|
|
@ -44,7 +44,6 @@ dependencies = [
|
|||
"tavily-python==0.5.4",
|
||||
"pytesseract==0.3.13",
|
||||
"stripe==12.0.1",
|
||||
"dramatiq==1.18.0",
|
||||
"pika==1.3.2",
|
||||
"prometheus-client==0.21.1",
|
||||
"langfuse==2.60.5",
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
import sentry_sdk
|
||||
from sentry_sdk.integrations.dramatiq import DramatiqIntegration
|
||||
import os
|
||||
|
||||
sentry_dsn = os.getenv("SENTRY_DSN", None)
|
||||
if sentry_dsn:
|
||||
sentry_sdk.init(
|
||||
dsn=sentry_dsn,
|
||||
integrations=[DramatiqIntegration()],
|
||||
traces_sample_rate=0.1,
|
||||
send_default_pii=True,
|
||||
_experiments={
|
||||
|
|
|
@ -581,18 +581,6 @@ wheels = [
|
|||
{ url = "https://files.pythonhosted.org/packages/68/1b/e0a87d256e40e8c888847551b20a017a6b98139178505dc7ffb96f04e954/dnspython-2.7.0-py3-none-any.whl", hash = "sha256:b4c34b7d10b51bcc3a5071e7b8dee77939f1e878477eeecc965e9835f63c6c86", size = 313632 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dramatiq"
|
||||
version = "1.18.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "prometheus-client" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/d9/9f/c8be928a88c387ed27344de089278e76d893dc71ad9e4b2a39a61deab0d8/dramatiq-1.18.0.tar.gz", hash = "sha256:5ea436b6e50dae64d4de04f1eb519ad239a6b1ba6315ba1dce1c0c4c1ebedfaf", size = 100868 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/ac/00/d9ea755cdeda3d498504775b62122b72ba282b91446fd58980171fb1084c/dramatiq-1.18.0-py3-none-any.whl", hash = "sha256:d360f608aa3cd06f5db714bfcd23825dc7098bacfee52aca536b0bb0faae3c69", size = 121231 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "e2b"
|
||||
version = "1.5.1"
|
||||
|
@ -2419,7 +2407,6 @@ dependencies = [
|
|||
{ name = "daytona-api-client" },
|
||||
{ name = "daytona-api-client-async" },
|
||||
{ name = "daytona-sdk" },
|
||||
{ name = "dramatiq" },
|
||||
{ name = "e2b-code-interpreter" },
|
||||
{ name = "email-validator" },
|
||||
{ name = "exa-py" },
|
||||
|
@ -2479,7 +2466,6 @@ requires-dist = [
|
|||
{ name = "daytona-api-client", specifier = "==0.21.0" },
|
||||
{ name = "daytona-api-client-async", specifier = "==0.21.0" },
|
||||
{ name = "daytona-sdk", specifier = "==0.21.0" },
|
||||
{ name = "dramatiq", specifier = "==1.18.0" },
|
||||
{ name = "e2b-code-interpreter", specifier = "==1.2.0" },
|
||||
{ name = "email-validator", specifier = "==2.0.0" },
|
||||
{ name = "exa-py", specifier = "==1.9.1" },
|
||||
|
|
|
@ -13,21 +13,6 @@ services:
|
|||
timeout: 5s
|
||||
retries: 3
|
||||
|
||||
rabbitmq:
|
||||
image: rabbitmq
|
||||
ports:
|
||||
- "5672:5672"
|
||||
- "15672:15672"
|
||||
volumes:
|
||||
- rabbitmq_data:/var/lib/rabbitmq
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 10s
|
||||
|
||||
backend:
|
||||
image: ghcr.io/suna-ai/suna-backend:latest
|
||||
platform: linux/amd64
|
||||
|
@ -45,39 +30,9 @@ services:
|
|||
- REDIS_PORT=6379
|
||||
- REDIS_PASSWORD=
|
||||
- REDIS_SSL=False
|
||||
- RABBITMQ_HOST=rabbitmq
|
||||
- RABBITMQ_PORT=5672
|
||||
depends_on:
|
||||
redis:
|
||||
condition: service_healthy
|
||||
rabbitmq:
|
||||
condition: service_healthy
|
||||
worker:
|
||||
condition: service_started
|
||||
|
||||
worker:
|
||||
image: ghcr.io/suna-ai/suna-backend:latest
|
||||
platform: linux/amd64
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
command: uv run dramatiq --skip-logging --processes 4 --threads 4 run_agent_background
|
||||
volumes:
|
||||
- ./backend/.env:/app/.env:ro
|
||||
env_file:
|
||||
- ./backend/.env
|
||||
environment:
|
||||
- REDIS_HOST=redis
|
||||
- REDIS_PORT=6379
|
||||
- REDIS_PASSWORD=
|
||||
- REDIS_SSL=False
|
||||
- RABBITMQ_HOST=rabbitmq
|
||||
- RABBITMQ_PORT=5672
|
||||
depends_on:
|
||||
redis:
|
||||
condition: service_healthy
|
||||
rabbitmq:
|
||||
condition: service_healthy
|
||||
|
||||
frontend:
|
||||
init: true
|
||||
|
@ -96,4 +51,3 @@ services:
|
|||
|
||||
volumes:
|
||||
redis_data:
|
||||
rabbitmq_data:
|
||||
|
|
|
@ -16,10 +16,9 @@ This guide provides detailed instructions for setting up and hosting your own in
|
|||
Suna consists of four main components:
|
||||
|
||||
1. **Backend API** - Python/FastAPI service for REST endpoints, thread management, and LLM integration
|
||||
2. **Backend Worker** - Python/Dramatiq worker service for handling agent tasks
|
||||
3. **Frontend** - Next.js/React application providing the user interface
|
||||
4. **Agent Docker** - Isolated execution environment for each agent
|
||||
5. **Supabase Database** - Handles data persistence and authentication
|
||||
2. **Frontend** - Next.js/React application providing the user interface
|
||||
3. **Agent Docker** - Isolated execution environment for each agent
|
||||
4. **Supabase Database** - Handles data persistence and authentication
|
||||
|
||||
## Prerequisites
|
||||
|
||||
|
@ -161,10 +160,6 @@ REDIS_PORT=6379
|
|||
REDIS_PASSWORD=
|
||||
REDIS_SSL=false
|
||||
|
||||
# RABBITMQ
|
||||
RABBITMQ_HOST=rabbitmq
|
||||
RABBITMQ_PORT=5672
|
||||
|
||||
# LLM Providers
|
||||
ANTHROPIC_API_KEY=your-anthropic-key
|
||||
OPENAI_API_KEY=your-openai-key
|
||||
|
@ -242,10 +237,10 @@ python start.py # Use the same to stop it later
|
|||
|
||||
This method requires you to start each component separately:
|
||||
|
||||
1. Start Redis and RabbitMQ (required for backend):
|
||||
1. Start Redis (required for backend):
|
||||
|
||||
```bash
|
||||
docker compose up redis rabbitmq -d
|
||||
docker compose up redis -d
|
||||
# or
|
||||
python start.py # Use the same to stop it later
|
||||
```
|
||||
|
@ -264,13 +259,6 @@ cd backend
|
|||
uv run api.py
|
||||
```
|
||||
|
||||
4. Start the worker (in one more terminal):
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
uv run dramatiq run_agent_background
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
@ -322,10 +310,6 @@ npm run dev -- --turbopack
|
|||
# Backend logs (manual setup)
|
||||
cd backend
|
||||
uv run api.py
|
||||
|
||||
# Worker logs (manual setup)
|
||||
cd backend
|
||||
uv run dramatiq run_agent_background
|
||||
```
|
||||
|
||||
### Resuming Setup
|
||||
|
|
14
setup.py
14
setup.py
|
@ -450,7 +450,7 @@ class SetupWizard:
|
|||
"uv": "https://github.com/astral-sh/uv#installation",
|
||||
"node": "https://nodejs.org/en/download/",
|
||||
"npm": "https://docs.npmjs.com/downloading-and-installing-node-js-and-npm",
|
||||
"docker": "https://docs.docker.com/get-docker/", # For Redis/RabbitMQ
|
||||
"docker": "https://docs.docker.com/get-docker/", # For Redis
|
||||
}
|
||||
|
||||
missing = []
|
||||
|
@ -1018,15 +1018,12 @@ class SetupWizard:
|
|||
# --- Backend .env ---
|
||||
is_docker = self.env_vars["setup_method"] == "docker"
|
||||
redis_host = "redis" if is_docker else "localhost"
|
||||
rabbitmq_host = "rabbitmq" if is_docker else "localhost"
|
||||
|
||||
backend_env = {
|
||||
"ENV_MODE": "local",
|
||||
**self.env_vars["supabase"],
|
||||
"REDIS_HOST": redis_host,
|
||||
"REDIS_PORT": "6379",
|
||||
"RABBITMQ_HOST": rabbitmq_host,
|
||||
"RABBITMQ_PORT": "5672",
|
||||
**self.env_vars["llm"],
|
||||
**self.env_vars["search"],
|
||||
**self.env_vars["rapidapi"],
|
||||
|
@ -1276,7 +1273,7 @@ class SetupWizard:
|
|||
print(
|
||||
f"\n{Colors.BOLD}1. Start Infrastructure (in project root):{Colors.ENDC}"
|
||||
)
|
||||
print(f"{Colors.CYAN} docker compose up redis rabbitmq -d{Colors.ENDC}")
|
||||
print(f"{Colors.CYAN} docker compose up redis -d{Colors.ENDC}")
|
||||
|
||||
print(f"\n{Colors.BOLD}2. Start Frontend (in a new terminal):{Colors.ENDC}")
|
||||
print(f"{Colors.CYAN} cd frontend && npm run dev{Colors.ENDC}")
|
||||
|
@ -1284,13 +1281,6 @@ class SetupWizard:
|
|||
print(f"\n{Colors.BOLD}3. Start Backend (in a new terminal):{Colors.ENDC}")
|
||||
print(f"{Colors.CYAN} cd backend && python run api.py{Colors.ENDC}")
|
||||
|
||||
print(
|
||||
f"\n{Colors.BOLD}4. Start Background Worker (in a new terminal):{Colors.ENDC}"
|
||||
)
|
||||
print(
|
||||
f"{Colors.CYAN} cd backend && uv run dramatiq run_agent_background{Colors.ENDC}"
|
||||
)
|
||||
|
||||
print("\nOnce all services are running, access Suna at: http://localhost:3000")
|
||||
|
||||
|
||||
|
|
15
start.py
15
start.py
|
@ -57,7 +57,7 @@ def print_manual_instructions():
|
|||
print("To start Suna, you need to run these commands in separate terminals:\n")
|
||||
|
||||
print(f"{Colors.BOLD}1. Start Infrastructure (in project root):{Colors.ENDC}")
|
||||
print(f"{Colors.CYAN} docker compose up redis rabbitmq -d{Colors.ENDC}\n")
|
||||
print(f"{Colors.CYAN} docker compose up redis -d{Colors.ENDC}\n")
|
||||
|
||||
print(f"{Colors.BOLD}2. Start Frontend (in a new terminal):{Colors.ENDC}")
|
||||
print(f"{Colors.CYAN} cd frontend && npm run dev{Colors.ENDC}\n")
|
||||
|
@ -65,11 +65,6 @@ def print_manual_instructions():
|
|||
print(f"{Colors.BOLD}3. Start Backend (in a new terminal):{Colors.ENDC}")
|
||||
print(f"{Colors.CYAN} cd backend && python run api.py{Colors.ENDC}\n")
|
||||
|
||||
print(f"{Colors.BOLD}4. Start Background Worker (in a new terminal):{Colors.ENDC}")
|
||||
print(
|
||||
f"{Colors.CYAN} cd backend && python run -m dramatiq run_agent_background{Colors.ENDC}\n"
|
||||
)
|
||||
|
||||
print("Once all services are running, access Suna at: http://localhost:3000\n")
|
||||
|
||||
print(
|
||||
|
@ -96,17 +91,17 @@ def main():
|
|||
setup_method = "docker"
|
||||
|
||||
if setup_method == "manual":
|
||||
# For manual setup, we only manage infrastructure services (redis, rabbitmq)
|
||||
# For manual setup, we only manage infrastructure services (redis)
|
||||
# and show instructions for the rest
|
||||
print(f"{Colors.BLUE}{Colors.BOLD}Manual Setup Detected{Colors.ENDC}")
|
||||
print("Managing infrastructure services (Redis, RabbitMQ)...\n")
|
||||
print("Managing infrastructure services (Redis)...\n")
|
||||
|
||||
force = "-f" in sys.argv
|
||||
if force:
|
||||
print("Force awakened. Skipping confirmation.")
|
||||
|
||||
is_infra_up = subprocess.run(
|
||||
["docker", "compose", "ps", "-q", "redis", "rabbitmq"],
|
||||
["docker", "compose", "ps", "-q", "redis"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
shell=IS_WINDOWS,
|
||||
|
@ -136,7 +131,7 @@ def main():
|
|||
print(f"\n{Colors.GREEN}✅ Infrastructure services stopped.{Colors.ENDC}")
|
||||
else:
|
||||
subprocess.run(
|
||||
["docker", "compose", "up", "redis", "rabbitmq", "-d"], shell=IS_WINDOWS
|
||||
["docker", "compose", "up", "redis", "-d"], shell=IS_WINDOWS
|
||||
)
|
||||
print(f"\n{Colors.GREEN}✅ Infrastructure services started.{Colors.ENDC}")
|
||||
print_manual_instructions()
|
||||
|
|
Loading…
Reference in New Issue