feat(rnd): Add support for supabase locally (#8077)

* add just auth for now

* add supabase script

* add to docker compose

* update docker compose

* tweak(rnd) Add prefix in logs (#8001)

* add prefix

* fix typos

* fix conflicts

* feat(rnd): Reduce container size remove dep with forge and autogpt (#8040)

* Remove forge and autogpt

* update lock files

* Update build process to reduce image size

* Reduced built image size

* fixed docker compose watch

* Updated logging

* updated env.example

* formatting

* linting issue

* linting not working in github actions..

* trying to get around github action linting issue

* updated version

* sleep for prisma issues

* add exp backoff on connection issues

* updated config based on review comments

* Sorting alphabetical

* updated default config

* updated depends checks

* fixed missing prisma binaries

* remove dead layer

* remove try

* remove dead layer

* updated lock file

* add to docker compose

* update for init

* add local supabase variables to docker compose

* wip supbase connectioon

* subabase submodule

* combined docker file wth new supbase url pointing to kong

* updated combined

* ngix

* updated docker compose without frontend

* updated docker compose

* update to remove frontend

* update docs

* update newline

* remove unescessary change

---------

Co-authored-by: Swifty <craigswift13@gmail.com>
This commit is contained in:
Aarushi
2024-09-18 09:50:39 +01:00
committed by GitHub
parent 0c915cb558
commit dc72ec97bc
6 changed files with 218 additions and 56 deletions

3
.gitmodules vendored
View File

@@ -1,3 +1,6 @@
[submodule "forge/tests/vcr_cassettes"]
path = forge/tests/vcr_cassettes
url = https://github.com/Significant-Gravitas/Auto-GPT-test-cassettes
[submodule "rnd/supabase"]
path = rnd/supabase
url = https://github.com/supabase/supabase.git

View File

@@ -102,21 +102,14 @@ poetry run prisma generate
Without running this command, the necessary Python modules (prisma.models) won't be available, leading to a `ModuleNotFoundError`.
### Running the server without Docker
### Running the server
To run the server, you can run the following commands in the same terminal you ran the `poetry install` command:
```bash
poetry run app
```
### Running the server within Docker
To run the server, you can run the following commands in the same terminal you ran the `poetry install` command:
```bash
docker compose build
docker compose up
cp supabase/docker/.env.example .env
docker compose -f docker-compose.combined.yml build
docker compose -f docker-compose.combined.yml up -d
```
In the other terminal from autogpt_builder, you can run the following command to start the frontend:

View File

@@ -16,19 +16,33 @@ To run the AutoGPT Platform, follow these steps:
1. Clone this repository to your local machine.
2. Navigate to the project directory.
3. Run the following command:
```
cp supabase/docker/.env.example .env
```
4. Run the following command:
```
docker compose up -d
docker compose -f docker-compose.combined.yml up -d
```
This command will start all the necessary services defined in the `docker-compose.yml` file in detached mode.
This command will start all the necessary backend services defined in the `docker-compose.combined.yml` file in detached mode.
5. Navigate to rnd/autogpt_builder.
6. Run the following command:
```
cp .env.example .env.local
```
7. Run the following command:
```
yarn dev
```
### Docker Compose Commands
Here are some useful Docker Compose commands for managing your AutoGPT Platform:
- `docker compose up -d`: Start the services in detached mode.
- `docker compose stop`: Stop the running services without removing them.
- `docker compose -f docker-compose.combined.yml up -d`: Start the services in detached mode.
- `docker compose -f docker-compose.combined.yml stop`: Stop the running services without removing them.
- `docker compose rm`: Remove stopped service containers.
- `docker compose build`: Build or rebuild services.
- `docker compose down`: Stop and remove containers, networks, and volumes.

View File

@@ -0,0 +1,145 @@
version: '3.8'
networks:
app-network:
name: app-network
shared-network:
name: shared-network
volumes:
db-config:
x-agpt-services:
&agpt-services
networks:
- app-network
- shared-network
x-supabase-services:
&supabase-services
networks:
- app-network
- shared-network
services:
# AGPT services
postgres:
<<: *agpt-services
extends:
file: ./docker-compose.yml
service: postgres
migrate:
<<: *agpt-services
extends:
file: ./docker-compose.yml
service: migrate
redis:
<<: *agpt-services
extends:
file: ./docker-compose.yml
service: redis
rest_server:
<<: *agpt-services
extends:
file: ./docker-compose.yml
service: rest_server
executor:
<<: *agpt-services
extends:
file: ./docker-compose.yml
service: executor
websocket_server:
<<: *agpt-services
extends:
file: ./docker-compose.yml
service: websocket_server
market:
<<: *agpt-services
extends:
file: ./docker-compose.yml
service: market
# frontend:
# <<: *agpt-services
# extends:
# file: ./docker-compose.yml
# service: frontend
# Supabase services
studio:
<<: *supabase-services
extends:
file: ./supabase/docker/docker-compose.yml
service: studio
kong:
<<: *supabase-services
extends:
file: ./supabase/docker/docker-compose.yml
service: kong
auth:
<<: *supabase-services
extends:
file: ./supabase/docker/docker-compose.yml
service: auth
rest:
<<: *supabase-services
extends:
file: ./supabase/docker/docker-compose.yml
service: rest
realtime:
<<: *supabase-services
extends:
file: ./supabase/docker/docker-compose.yml
service: realtime
storage:
<<: *supabase-services
extends:
file: ./supabase/docker/docker-compose.yml
service: storage
imgproxy:
<<: *supabase-services
extends:
file: ./supabase/docker/docker-compose.yml
service: imgproxy
meta:
<<: *supabase-services
extends:
file: ./supabase/docker/docker-compose.yml
service: meta
functions:
<<: *supabase-services
extends:
file: ./supabase/docker/docker-compose.yml
service: functions
analytics:
<<: *supabase-services
extends:
file: ./supabase/docker/docker-compose.yml
service: analytics
db:
<<: *supabase-services
extends:
file: ./supabase/docker/docker-compose.yml
service: db
vector:
<<: *supabase-services
extends:
file: ./supabase/docker/docker-compose.yml
service: vector

View File

@@ -11,21 +11,18 @@ services:
timeout: 5s
retries: 5
ports:
- "5432:5432"
- "5433:5432"
networks:
- app-network
migrate:
build:
context: ../
dockerfile: rnd/autogpt_server/Dockerfile
target: server
image: autogpt_server:latest
command: ["sh", "-c", "poetry run prisma migrate deploy"]
develop:
watch:
- path: ./
target: rnd/autogpt_server/migrate
action: rebuild
command: ["poetry", "run", "prisma", "migrate", "deploy"]
depends_on:
postgres:
condition: service_healthy
@@ -72,15 +69,18 @@ services:
migrate:
condition: service_completed_successfully
environment:
- SUPABASE_URL=http://kong:8000
- SUPABASE_JWT_SECRET=your-super-secret-jwt-token-with-at-least-32-characters-long
- SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE
- DATABASE_URL=postgresql://agpt_user:pass123@postgres:5432/agpt_local?connect_timeout=60
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=password
- AUTH_ENABLED=false
- ENABLE_AUTH=true
- PYRO_HOST=0.0.0.0
- EXECUTIONMANAGER_HOST=executor
ports:
- "8000:8000"
- "8006:8000"
- "8003:8003" # execution scheduler
networks:
- app-network
@@ -104,11 +104,14 @@ services:
migrate:
condition: service_completed_successfully
environment:
- NEXT_PUBLIC_SUPABASE_URL=http://kong:8000
- SUPABASE_JWT_SECRET=your-super-secret-jwt-token-with-at-least-32-characters-long
- SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE
- DATABASE_URL=postgresql://agpt_user:pass123@postgres:5432/agpt_local?connect_timeout=60
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=password
- AUTH_ENABLED=false
- ENABLE_AUTH=true
- PYRO_HOST=0.0.0.0
- AGENTSERVER_HOST=rest_server
ports:
@@ -135,11 +138,14 @@ services:
migrate:
condition: service_completed_successfully
environment:
- SUPABASE_URL=http://kong:8000
- SUPABASE_JWT_SECRET=your-super-secret-jwt-token-with-at-least-32-characters-long
- SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE
- DATABASE_URL=postgresql://agpt_user:pass123@postgres:5432/agpt_local?connect_timeout=60
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=password
- AUTH_ENABLED=false
- ENABLE_AUTH=true
- PYRO_HOST=0.0.0.0
ports:
- "8001:8001"
@@ -161,40 +167,40 @@ services:
migrate:
condition: service_completed_successfully
environment:
- DATABASE_URL=postgresql://agpt_user:pass123@postgres:5432/agpt_local?connect_timeout=60&schema=market
- SUPABASE_URL=http://kong:8000
- SUPABASE_JWT_SECRET=your-super-secret-jwt-token-with-at-least-32-characters-long
- SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE
- DATABASE_URL=postgresql://agpt_user:pass123@postgres:5432/agpt_local?connect_timeout=60
ports:
- "8015:8015"
networks:
- app-network
frontend:
build:
context: ../
dockerfile: rnd/autogpt_builder/Dockerfile
target: dev
develop:
watch:
- path: ./
target: rnd/autogpt_builder/
action: rebuild
depends_on:
postgres:
condition: service_healthy
rest_server:
condition: service_started
websocket_server:
condition: service_started
migrate:
condition: service_completed_successfully
environment:
- DATABASE_URL=postgresql://agpt_user:pass123@postgres:5432/agpt_local?connect_timeout=60
- NEXT_PUBLIC_AGPT_SERVER_URL=http://localhost:8000/api
- NEXT_PUBLIC_AGPT_WS_SERVER_URL=ws://localhost:8001/ws
- NEXT_PUBLIC_AGPT_MARKETPLACE_URL=http://localhost:8015/api/v1/market
ports:
- "3000:3000"
networks:
- app-network
# frontend:
# build:
# context: ../
# dockerfile: rnd/autogpt_builder/Dockerfile
# target: dev
# depends_on:
# postgres:
# condition: service_healthy
# rest_server:
# condition: service_started
# websocket_server:
# condition: service_started
# migrate:
# condition: service_completed_successfully
# environment:
# - NEXT_PUBLIC_SUPABASE_URL=http://kong:8000
# - NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE
# - DATABASE_URL=postgresql://agpt_user:pass123@postgres:5432/agpt_local?connect_timeout=60
# - NEXT_PUBLIC_AGPT_SERVER_URL=http://localhost:8006/api
# - NEXT_PUBLIC_AGPT_WS_SERVER_URL=ws://localhost:8001/ws
# - NEXT_PUBLIC_AGPT_MARKETPLACE_URL=http://localhost:8015/api/v1/market
# ports:
# - "3000:3000"
# networks:
# - app-network
networks:
app-network:

1
rnd/supabase Submodule

Submodule rnd/supabase added at 5e4e7d521b