From 9c8c2bc4ab9caa283a7a2bf8ac0a9919804ca2fb Mon Sep 17 00:00:00 2001 From: Lucas Tonon Date: Sun, 17 Nov 2024 12:08:00 -0300 Subject: [PATCH] fix: connection with postgres and redis --- .env.example | 4 ++-- .gitignore | 2 ++ docker-compose.yaml | 30 ++++++++++++++++++++++++++---- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index d6412fec..54996d0f 100644 --- a/.env.example +++ b/.env.example @@ -26,7 +26,7 @@ DEL_INSTANCE=false # Provider: postgresql | mysql DATABASE_PROVIDER=postgresql -DATABASE_CONNECTION_URI='postgresql://user:pass@localhost:5432/evolution?schema=public' +DATABASE_CONNECTION_URI=postgresql://user:password@postgres:5432/evolution?schema=public # Client name for the database connection # It is used to separate an API installation from another that uses the same database. DATABASE_CONNECTION_CLIENT_NAME=evolution_exchange @@ -211,7 +211,7 @@ DIFY_ENABLED=false # Cache - Environment variables # Redis Cache enabled CACHE_REDIS_ENABLED=true -CACHE_REDIS_URI=redis://localhost:6379/6 +CACHE_REDIS_URI=redis://redis:6379/6 CACHE_REDIS_TTL=604800 # Prefix serves to differentiate data from one installation to another that are using the same redis CACHE_REDIS_PREFIX_KEY=evolution diff --git a/.gitignore b/.gitignore index 3c511120..28ec8a55 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,5 @@ lerna-debug.log* .tool-versions /prisma/migrations/* + +pgadmin/* \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index b286919c..67bfaaf9 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,7 +1,7 @@ services: api: container_name: evolution_api - image: atendai/evolution-api:homolog + image: atendai/evolution-api:latest restart: always depends_on: - redis @@ -16,9 +16,11 @@ services: - .env expose: - 8080 + environment: + - DATABASE_PROVIDER=postgresql redis: - image: redis:latest + image: redis:alpine networks: - evolution-net container_name: redis @@ -29,21 +31,41 @@ services: ports: - 6379:6379 + postgres: container_name: postgres image: postgres:15 networks: - evolution-net - command: ["postgres", "-c", "max_connections=1000"] + command: ["postgres", "-c", "max_connections=1000", "-c", "listen_addresses=*"] restart: always ports: - 5432:5432 environment: - - POSTGRES_PASSWORD=PASSWORD + - POSTGRES_USER=user + - POSTGRES_PASSWORD=pass + - POSTGRES_DB=evolution + - POSTGRES_HOST_AUTH_METHOD=trust volumes: - postgres_data:/var/lib/postgresql/data expose: - 5432 + + pgadmin: + image: dpage/pgadmin4 + container_name: pgadmin-container + environment: + PGADMIN_DEFAULT_EMAIL: user@example.com + PGADMIN_DEFAULT_PASSWORD: adm + volumes: + - ./pgadmin:/var/lib/pgadmin + ports: + - "5050:80" + depends_on: + - postgres + networks: + - evolution-net + volumes: evolution_instances: