Skip to content

feat: add docker-compose configuration for evolution-api, redis, and postgres services#2527

Open
Jubilio wants to merge 1 commit intoEvolutionAPI:mainfrom
Jubilio:main
Open

feat: add docker-compose configuration for evolution-api, redis, and postgres services#2527
Jubilio wants to merge 1 commit intoEvolutionAPI:mainfrom
Jubilio:main

Conversation

@Jubilio
Copy link
Copy Markdown

@Jubilio Jubilio commented Apr 30, 2026

Summary by Sourcery

Deployment:

  • Introduce docker-compose.mwanga.yaml to orchestrate evolution-api, Redis, and Postgres containers on a shared bridge network.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Apr 30, 2026

Reviewer's Guide

Adds a new docker-compose configuration to run the evolution API alongside Redis and Postgres using a shared bridge network and .env-based configuration.

File-Level Changes

Change Details Files
Introduce a dedicated docker-compose stack for evolution-api with Redis and Postgres dependencies.
  • Add api service using evoapicloud/evolution-api:latest image, exposing port 8080 and loading environment variables from .env
  • Configure redis service using the official redis:latest image on a shared custom bridge network
  • Configure evolution_postgres service with postgres:15 image, database/user/password environment variables, and .env support
  • Define a custom bridge network evolution-net and attach all services to it
  • Set restart policy to always for all services and declare api depends_on redis and evolution_postgres
docker-compose.mwanga.yaml

Possibly linked issues

  • #Error: P1001: Can't reach database server at postgres:5432: PR’s unified docker-compose with shared network and Postgres service directly resolves the database connectivity error described.
  • #(unknown): Issue reports services not starting via Docker Compose; PR adds a working compose setup for API, Redis, Postgres.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 3 issues, and left some high level feedback:

  • Consider moving the hard-coded Postgres credentials (especially POSTGRES_PASSWORD) into the .env file so sensitive values are not committed in the compose file.
  • You may want to add named volumes for Postgres (and possibly Redis) to ensure data persists across container restarts instead of relying solely on ephemeral container storage.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider moving the hard-coded Postgres credentials (especially POSTGRES_PASSWORD) into the .env file so sensitive values are not committed in the compose file.
- You may want to add named volumes for Postgres (and possibly Redis) to ensure data persists across container restarts instead of relying solely on ephemeral container storage.

## Individual Comments

### Comment 1
<location path="docker-compose.mwanga.yaml" line_range="4-13" />
<code_context>
+services:
+  api:
+    container_name: evolution_api
+    image: evoapicloud/evolution-api:latest
+    restart: always
+    depends_on:
+      - redis
+      - evolution_postgres
+    ports:
+      - "8080:8080"
+    env_file:
+      - .env
+    networks:
+      - evolution-net
+
+  redis:
+    container_name: evolution_redis
+    image: redis:latest
+    restart: always
+    networks:
</code_context>
<issue_to_address>
**suggestion:** Using `latest` tags for images can make deployments non-reproducible and harder to debug.

For both `api` and `redis`, please pin images to specific versions or digests (e.g. `evoapicloud/evolution-api:1.2.3`, `redis:7.2`) so updates are explicit and controlled.

Suggested implementation:

```
    image: evoapicloud/evolution-api:1.2.3

```

```
    image: redis:7.2

```
</issue_to_address>

### Comment 2
<location path="docker-compose.mwanga.yaml" line_range="32" />
<code_context>
+    environment:
+      - POSTGRES_DB=evolution_db
+      - POSTGRES_USER=postgres
+      - POSTGRES_PASSWORD=postgres_pass
+    networks:
+      - evolution-net
</code_context>
<issue_to_address>
**🚨 issue (security):** Hard-coding the database password in the compose file is a security risk.

Even for local use, embedding `POSTGRES_PASSWORD` in the compose file makes it easy to leak via version control or shared configs. Since you already use `.env`, reference the variable instead (e.g., `POSTGRES_PASSWORD=${POSTGRES_PASSWORD}`) and keep the actual secret only in `.env` or your secrets manager.
</issue_to_address>

### Comment 3
<location path="docker-compose.mwanga.yaml" line_range="23-13" />
<code_context>
+    networks:
+      - evolution-net
+
+  evolution_postgres:
+    container_name: evolution_postgres
+    image: postgres:15
+    restart: always
+    env_file:
+      - .env
+    environment:
+      - POSTGRES_DB=evolution_db
+      - POSTGRES_USER=postgres
+      - POSTGRES_PASSWORD=postgres_pass
+    networks:
+      - evolution-net
+
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Lack of a volume for Postgres means database data will be lost when the container is removed.

If this is meant for more than disposable local testing, define a named volume for `evolution_postgres` (e.g. `volumes: [evolution_postgres_data:/var/lib/postgresql/data]`) so data persists across container recreations and `docker-compose down` runs.

Suggested implementation:

```
  evolution_postgres:
    container_name: evolution_postgres
    image: postgres:15
    volumes:
      - evolution_postgres_data:/var/lib/postgresql/data

```

You also need to declare the named volume `evolution_postgres_data` at the top level of the compose file, for example:

```yaml
volumes:
  evolution_postgres_data:
```

Place this alongside the existing top-level `services:` / `networks:` keys (not nested under a service). If there is already a `volumes:` section, just add `evolution_postgres_data:` under it instead of creating a new `volumes:` key.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +4 to +13
image: evoapicloud/evolution-api:latest
restart: always
depends_on:
- redis
- evolution_postgres
ports:
- "8080:8080"
env_file:
- .env
networks:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Using latest tags for images can make deployments non-reproducible and harder to debug.

For both api and redis, please pin images to specific versions or digests (e.g. evoapicloud/evolution-api:1.2.3, redis:7.2) so updates are explicit and controlled.

Suggested implementation:

    image: evoapicloud/evolution-api:1.2.3

    image: redis:7.2

environment:
- POSTGRES_DB=evolution_db
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres_pass
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 issue (security): Hard-coding the database password in the compose file is a security risk.

Even for local use, embedding POSTGRES_PASSWORD in the compose file makes it easy to leak via version control or shared configs. Since you already use .env, reference the variable instead (e.g., POSTGRES_PASSWORD=${POSTGRES_PASSWORD}) and keep the actual secret only in .env or your secrets manager.

- "8080:8080"
env_file:
- .env
networks:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Lack of a volume for Postgres means database data will be lost when the container is removed.

If this is meant for more than disposable local testing, define a named volume for evolution_postgres (e.g. volumes: [evolution_postgres_data:/var/lib/postgresql/data]) so data persists across container recreations and docker-compose down runs.

Suggested implementation:

  evolution_postgres:
    container_name: evolution_postgres
    image: postgres:15
    volumes:
      - evolution_postgres_data:/var/lib/postgresql/data

You also need to declare the named volume evolution_postgres_data at the top level of the compose file, for example:

volumes:
  evolution_postgres_data:

Place this alongside the existing top-level services: / networks: keys (not nested under a service). If there is already a volumes: section, just add evolution_postgres_data: under it instead of creating a new volumes: key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant