Update README and Docker configurations to streamline Redis setup with Docker Compose

This commit is contained in:
Korzhavin Ivan 2025-04-24 23:02:42 +02:00
parent 2753a4de89
commit 00539ffcf4
4 changed files with 70 additions and 5 deletions

View File

@ -105,7 +105,10 @@ You'll need the following components:
- [Mac](https://formulae.brew.sh/formula/redis): `brew install redis`
- [Linux](https://redis.io/docs/getting-started/installation/install-redis-on-linux/): Follow distribution-specific instructions
- [Windows](https://redis.io/docs/getting-started/installation/install-redis-on-windows/): Use WSL2 or Docker
- Save your Redis connection details for later use
- Docker Compose (included in our setup):
- If you're using our Docker Compose setup, Redis is included and configured automatically
- No additional installation is needed
- Save your Redis connection details for later use (not needed if using Docker Compose)
3. **Daytona**:
- Create an account on [Daytona](https://app.daytona.io/)
@ -240,6 +243,14 @@ python api.py
Before running with Docker Compose, make sure your environment files are properly configured:
- In `backend/.env`, set all the required environment variables as described above
- For Redis configuration, use `REDIS_HOST=redis` instead of localhost
- The Docker Compose setup will automatically set these Redis environment variables:
```
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_SSL=False
```
- In `frontend/.env.local`, make sure to set `NEXT_PUBLIC_BACKEND_URL="http://backend:8000/api"` to use the container name
Then run:
@ -253,6 +264,8 @@ If you're building the images locally instead of using pre-built ones:
docker compose up
```
The Docker Compose setup includes a Redis service that will be used by the backend automatically.
7. **Access Suna**:
- Open your browser and navigate to `http://localhost:3000`

View File

@ -1,6 +1,19 @@
version: '3.8'
services:
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redis-data:/data
command: redis-server --save 60 1 --loglevel warning
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
backend:
image: ghcr.io/${GITHUB_REPOSITORY}/suna-backend:latest
ports:
@ -9,6 +22,13 @@ services:
- ./backend/.env:/app/.env:ro
environment:
- ENV_MODE=local
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=
- REDIS_SSL=False
depends_on:
redis:
condition: service_healthy
frontend:
image: ghcr.io/${GITHUB_REPOSITORY}/suna-frontend:latest
@ -17,6 +37,10 @@ services:
volumes:
- ./frontend/.env.local:/app/.env.local:ro
environment:
- NODE_ENV=development
- NODE_ENV=production
command: ["npm", "run", "start"]
depends_on:
- backend
- backend
volumes:
redis-data:

View File

@ -1,6 +1,19 @@
version: '3.8'
services:
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redis-data:/data
command: redis-server --save 60 1 --loglevel warning
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
backend:
build:
context: ./backend
@ -11,6 +24,13 @@ services:
- ./backend/.env:/app/.env:ro
environment:
- ENV_MODE=local
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=
- REDIS_SSL=False
depends_on:
redis:
condition: service_healthy
frontend:
build:
@ -21,6 +41,10 @@ services:
volumes:
- ./frontend/.env.local:/app/.env.local:ro
environment:
- NODE_ENV=development
- NODE_ENV=production
command: ["npm", "run", "start"]
depends_on:
- backend
- backend
volumes:
redis-data:

View File

@ -9,6 +9,10 @@ RUN npm install
# Copy the frontend code
COPY . .
# Build the application
RUN npm run build
EXPOSE 3000
# Default command is dev, but can be overridden in docker-compose
CMD ["npm", "run", "dev"]