fix: connection with postgres and redis

This commit is contained in:
Lucas Tonon 2024-11-17 12:08:00 -03:00
parent 1665654676
commit 9c8c2bc4ab
3 changed files with 30 additions and 6 deletions

View File

@ -26,7 +26,7 @@ DEL_INSTANCE=false
# Provider: postgresql | mysql # Provider: postgresql | mysql
DATABASE_PROVIDER=postgresql 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 # Client name for the database connection
# It is used to separate an API installation from another that uses the same database. # It is used to separate an API installation from another that uses the same database.
DATABASE_CONNECTION_CLIENT_NAME=evolution_exchange DATABASE_CONNECTION_CLIENT_NAME=evolution_exchange
@ -211,7 +211,7 @@ DIFY_ENABLED=false
# Cache - Environment variables # Cache - Environment variables
# Redis Cache enabled # Redis Cache enabled
CACHE_REDIS_ENABLED=true CACHE_REDIS_ENABLED=true
CACHE_REDIS_URI=redis://localhost:6379/6 CACHE_REDIS_URI=redis://redis:6379/6
CACHE_REDIS_TTL=604800 CACHE_REDIS_TTL=604800
# Prefix serves to differentiate data from one installation to another that are using the same redis # Prefix serves to differentiate data from one installation to another that are using the same redis
CACHE_REDIS_PREFIX_KEY=evolution CACHE_REDIS_PREFIX_KEY=evolution

2
.gitignore vendored
View File

@ -47,3 +47,5 @@ lerna-debug.log*
.tool-versions .tool-versions
/prisma/migrations/* /prisma/migrations/*
pgadmin/*

View File

@ -1,7 +1,7 @@
services: services:
api: api:
container_name: evolution_api container_name: evolution_api
image: atendai/evolution-api:homolog image: atendai/evolution-api:latest
restart: always restart: always
depends_on: depends_on:
- redis - redis
@ -16,9 +16,11 @@ services:
- .env - .env
expose: expose:
- 8080 - 8080
environment:
- DATABASE_PROVIDER=postgresql
redis: redis:
image: redis:latest image: redis:alpine
networks: networks:
- evolution-net - evolution-net
container_name: redis container_name: redis
@ -29,22 +31,42 @@ services:
ports: ports:
- 6379:6379 - 6379:6379
postgres: postgres:
container_name: postgres container_name: postgres
image: postgres:15 image: postgres:15
networks: networks:
- evolution-net - evolution-net
command: ["postgres", "-c", "max_connections=1000"] command: ["postgres", "-c", "max_connections=1000", "-c", "listen_addresses=*"]
restart: always restart: always
ports: ports:
- 5432:5432 - 5432:5432
environment: environment:
- POSTGRES_PASSWORD=PASSWORD - POSTGRES_USER=user
- POSTGRES_PASSWORD=pass
- POSTGRES_DB=evolution
- POSTGRES_HOST_AUTH_METHOD=trust
volumes: volumes:
- postgres_data:/var/lib/postgresql/data - postgres_data:/var/lib/postgresql/data
expose: expose:
- 5432 - 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: volumes:
evolution_instances: evolution_instances:
evolution_redis: evolution_redis: