Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Added postgres to gh compose for production use #1860

Merged
merged 1 commit into from
Jul 9, 2024
Merged
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
51 changes: 50 additions & 1 deletion docker-compose.gh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ services:
image: ghcr.io/agenta-ai/agenta-backend
environment:
- MONGODB_URI=mongodb://username:password@mongo:27017
- POSTGRES_URI=postgresql+asyncpg://username:password@postgres:5432/agenta_oss
- REDIS_URL=redis://redis:6379/0
- ENVIRONMENT=production
- DATABASE_MODE=v2
- MIGRATION_SRC_MONGO_DB_NAME=v2
- FEATURE_FLAG=oss
- AGENTA_TEMPLATE_REPO=agentaai/templates_v2
- POSTHOG_API_KEY=phc_hmVSxIjTW1REBHXgj2aw4HW9X6CXb6FzerBgP9XenC7
Expand Down Expand Up @@ -60,6 +62,8 @@ services:
depends_on:
mongo:
condition: service_healthy
postgres:
condition: service_healthy
restart: always

agenta-web:
Expand Down Expand Up @@ -140,27 +144,72 @@ services:
command: >
celery -A agenta_backend.main.celery_app worker --concurrency=1 --loglevel=INFO
environment:
- POSTGRES_URI=postgresql+asyncpg://username:password@postgres:5432/agenta_oss
- MONGODB_URI=mongodb://username:password@mongo:27017
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=amqp://guest@rabbitmq//
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- FEATURE_FLAG=oss
volumes:
- ./agenta-backend/agenta_backend:/app/agenta_backend
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- mongo
- postgres
- rabbitmq
- redis
extra_hosts:
- "host.docker.internal:host-gateway"
networks:
- agenta-network

postgres:
image: postgres:16.2
container_name: postgres
restart: always
environment:
POSTGRES_USER: username
POSTGRES_PASSWORD: password
POSTGRES_DB: agenta_oss
ports:
- "5432:5432"
networks:
- agenta-network
volumes:
- postgresdb-data:/var/lib/postgresql/data/
- ./docker-assets/postgres/init-db.sql:/docker-entrypoint-initdb.d/init-db.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5

pgadmin:
image: dpage/pgadmin4
restart: always
environment:
PGADMIN_DEFAULT_EMAIL: "admin@example.com"
PGADMIN_DEFAULT_PASSWORD: "password"
PGADMIN_SERVER_HOST: "postgres"
PGADMIN_SERVER_PORT: 5432
PGADMIN_SERVER_USER: "username"
PGADMIN_SERVER_PASSWORD: "password"
PGADMIN_SERVER_DB: agenta_oss
ports:
- "5050:80"
networks:
- agenta-network
volumes:
- pgadmin-data:/var/lib/pgadmin
depends_on:
postgres:
condition: service_healthy

networks:
agenta-network:
name: agenta-network

volumes:
mongodb_data:
redis_data:
postgresdb-data:
pgadmin-data:
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ services:
- REDIS_URL=redis://redis:6379/0
- ENVIRONMENT=development
- DATABASE_MODE=v2
- MIGRATION_SRC_MONGO_DB_NAME=v2
- BARE_DOMAIN_NAME=localhost
- DOMAIN_NAME=http://localhost
- FEATURE_FLAG=oss
Expand Down