Skip to content

Commit 39f3e18

Browse files
committed
chore(dev-env): add local docker-compose, Makefile, env templates & docs
1 parent 032f095 commit 39f3e18

File tree

8 files changed

+195
-0
lines changed

8 files changed

+195
-0
lines changed

.github/workflows/ci.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
format-check:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: '3.10'
19+
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install black
24+
25+
- name: Check formatting
26+
run: make fmt

.pre-commit-config.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 23.3.0
4+
hooks:
5+
- id: black
6+
language_version: python3
7+
types: [python]
8+
9+
- repo: https://github.com/pycqa/isort
10+
rev: 5.12.0
11+
hooks:
12+
- id: isort
13+
args: ["--profile", "black"]
14+
types: [python]

Makefile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.PHONY: setup up down migrate fmt
2+
3+
setup: ## one-time env + DB prep
4+
cp -n backend/.env.template backend/.env || true
5+
cp -n frontend/.env.local.template frontend/.env.local || true
6+
./scripts/supa_migrate.sh
7+
8+
up: ## run stack
9+
docker compose -f docker-compose.local.yaml up --build
10+
11+
down: ## stop & clean
12+
docker compose -f docker-compose.local.yaml down -v
13+
14+
migrate: ## rerun Supabase migration
15+
./scripts/supa_migrate.sh
16+
17+
fmt: ## auto-format backend python
18+
black backend

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,22 @@ Suna's powerful toolkit includes seamless browser automation to navigate the web
1818
)](https://github.com/kortix-ai/suna/labels/bug)
1919
</div>
2020

21+
## 🚀 Quick start (local)
22+
23+
```bash
24+
git clone https://github.com/<YOUR_GH_USERNAME>/suna.git && cd suna
25+
make setup && make up
26+
# browse http://localhost:3000
27+
```
28+
29+
Before running, make sure to:
30+
1. Create a [Supabase](https://supabase.com) project and get your API credentials
31+
2. Get an API key from [Anthropic](https://www.anthropic.com)
32+
3. Set up a sandbox on [Daytona](https://daytona.io)
33+
34+
Fill these credentials in your `.env` files after running `make setup`.
35+
36+
For code contributors: Install pre-commit hooks with `pip install pre-commit && pre-commit install`
2137

2238
## Table of Contents
2339

backend/.env.template

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Environment mode (local, staging, production)
2+
ENV_MODE=local
3+
4+
# LLM API keys
5+
ANTHROPIC_API_KEY=
6+
OPENAI_API_KEY=
7+
GROQ_API_KEY=
8+
OPENROUTER_API_KEY=
9+
OPENROUTER_API_BASE=https://openrouter.ai/api/v1
10+
OR_SITE_URL=
11+
OR_APP_NAME=Suna.so
12+
13+
# AWS Bedrock credentials
14+
AWS_ACCESS_KEY_ID=
15+
AWS_SECRET_ACCESS_KEY=
16+
AWS_REGION_NAME=
17+
18+
# Model configuration
19+
MODEL_TO_USE=anthropic/claude-3-7-sonnet-latest
20+
21+
# Supabase configuration
22+
SUPABASE_URL=
23+
SUPABASE_ANON_KEY=
24+
SUPABASE_SERVICE_ROLE_KEY=
25+
26+
# Redis configuration (for local development)
27+
REDIS_HOST=redis
28+
REDIS_PORT=6379
29+
REDIS_PASSWORD=
30+
REDIS_SSL=false
31+
32+
# Daytona sandbox configuration
33+
DAYTONA_API_KEY=
34+
DAYTONA_SERVER_URL=
35+
DAYTONA_TARGET=
36+
37+
# Search and other API keys
38+
TAVILY_API_KEY=
39+
RAPID_API_KEY=
40+
CLOUDFLARE_API_TOKEN=
41+
FIRECRAWL_API_KEY=
42+
43+
# Stripe configuration
44+
STRIPE_SECRET_KEY=
45+
STRIPE_DEFAULT_PLAN_ID=
46+
STRIPE_DEFAULT_TRIAL_DAYS=14

docker-compose.local.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
version: '3.8'
2+
3+
services:
4+
backend:
5+
build:
6+
context: ./backend
7+
dockerfile: Dockerfile
8+
ports:
9+
- "8000:8000"
10+
volumes:
11+
- ./backend:/app
12+
env_file:
13+
- ./backend/.env
14+
depends_on:
15+
- redis
16+
healthcheck:
17+
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
18+
interval: 30s
19+
timeout: 10s
20+
retries: 3
21+
22+
frontend:
23+
build:
24+
context: ./frontend
25+
dockerfile: Dockerfile
26+
ports:
27+
- "3000:3000"
28+
volumes:
29+
- ./frontend:/app
30+
- /app/node_modules
31+
env_file:
32+
- ./frontend/.env.local
33+
depends_on:
34+
- backend
35+
healthcheck:
36+
test: ["CMD", "curl", "-f", "http://localhost:3000"]
37+
interval: 30s
38+
timeout: 10s
39+
retries: 3
40+
41+
redis:
42+
image: redis:7-alpine
43+
ports:
44+
- "6379:6379"
45+
healthcheck:
46+
test: ["CMD", "redis-cli", "ping"]
47+
interval: 30s
48+
timeout: 10s
49+
retries: 3

frontend/.env.local.template

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Supabase configuration
2+
NEXT_PUBLIC_SUPABASE_URL=
3+
NEXT_PUBLIC_SUPABASE_ANON_KEY=
4+
5+
# Backend URL
6+
NEXT_PUBLIC_BACKEND_URL=http://localhost:8000

scripts/supa_migrate.sh

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# Check if supabase CLI is installed
4+
if ! command -v supabase &> /dev/null; then
5+
echo "❌ Error: supabase CLI is not installed"
6+
echo "Please install it from: https://supabase.com/docs/guides/cli"
7+
exit 1
8+
fi
9+
10+
# Run migration
11+
echo "🔄 Running Supabase migration..."
12+
supabase db push
13+
14+
# Check if migration was successful
15+
if [ $? -eq 0 ]; then
16+
echo "✅ DB migrated"
17+
else
18+
echo "❌ Migration failed"
19+
exit 1
20+
fi

0 commit comments

Comments
 (0)