Skip to content

docs: improve setup instructions and add docker compose#4

Open
oismaelash wants to merge 1 commit intoEvolutionAPI:mainfrom
oismaelash:feat/start-from-sh-script
Open

docs: improve setup instructions and add docker compose#4
oismaelash wants to merge 1 commit intoEvolutionAPI:mainfrom
oismaelash:feat/start-from-sh-script

Conversation

@oismaelash
Copy link
Copy Markdown

@oismaelash oismaelash commented Mar 31, 2026

Update README to recommend using the new start.sh script for easier Docker setup. Add docker-compose.yml to define all required services (PostgreSQL, RabbitMQ, MinIO). Add start.sh script to automate submodule initialization, environment configuration, and container startup.

Description

Related Issue

Closes #(issue_number)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement

Testing

  • Manual testing completed
  • Functionality verified in development environment
  • No breaking changes introduced

Screenshots (if applicable)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have tested my changes thoroughly
  • Any dependent changes have been merged and published

Additional Notes

Summary by Sourcery

Recommend a new Docker-based startup flow and automate local environment setup for Evolution Go and its dependencies.

New Features:

  • Add a docker-compose configuration to run the API alongside PostgreSQL, RabbitMQ, and MinIO.
  • Introduce a start script that initializes submodules, prepares the .env file, and launches the Docker Compose stack.

Documentation:

  • Update README Docker section to document the new start.sh workflow and clarify how dependencies are started.

Update README to recommend using the new start.sh script for easier Docker setup.
Add docker-compose.yml to define all required services (PostgreSQL, RabbitMQ, MinIO).
Add start.sh script to automate submodule initialization, environment configuration, and container startup.
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Mar 31, 2026

Reviewer's Guide

Introduces a Docker-based one-command startup flow using a new start.sh script and docker-compose.yml, and updates the README to point users to this automated setup instead of manual make-based Docker commands.

Sequence diagram for start.sh automated Docker startup

sequenceDiagram
  actor User
  participant Start_sh
  participant Git
  participant EnvFile
  participant DockerCompose
  participant Evolution_go
  participant Postgres
  participant Rabbitmq
  participant Minio

  User->>Start_sh: execute start.sh
  Start_sh->>Git: submodule update --init --recursive
  Git-->>Start_sh: submodules_initialized
  alt env_file_missing
    Start_sh->>EnvFile: copy .env.example to .env
    Start_sh->>EnvFile: replace localhost_hosts_with_service_hosts
  else env_file_exists
    Start_sh-->>EnvFile: keep_existing_env
  end
  alt docker_compose_command_available
    Start_sh->>DockerCompose: docker-compose up -d --build
  else docker_plugin_available
    Start_sh->>DockerCompose: docker compose up -d --build
  end
  DockerCompose-->>Evolution_go: start_container
  DockerCompose-->>Postgres: start_container
  DockerCompose-->>Rabbitmq: start_container
  DockerCompose-->>Minio: start_container
  Start_sh-->>User: print_service_endpoints_and_next_steps
Loading

File-Level Changes

Change Details Files
Document new Docker-based startup flow using start.sh instead of raw make docker-* commands.
  • Replace README Docker quickstart commands with a single bash ./start.sh invocation.
  • Add explanatory note describing what start.sh does: initializes submodules, generates .env from .env.example with Docker host adjustments, and runs docker compose up -d --build.
README.md
Define a full Docker Compose stack for the app and its dependencies.
  • Add evolution-go service that builds from the local Dockerfile, exposes port 8080, mounts data and logs volumes, loads env vars from .env, and depends on postgres, rabbitmq, and minio.
  • Add postgres service with default credentials, port mapping, a data volume, and initialization SQL from docker/examples/init-db.sql.
  • Add rabbitmq service with management UI, default admin credentials, data volume, and port mappings for AMQP and management console.
  • Add minio object storage service with console enabled, default credentials, data volume, and port mappings.
  • Define named Docker volumes for app data/logs and each dependency, plus a shared bridge network for all services.
docker-compose.yml
Automate environment preparation and container startup via a bash script.
  • Add colored CLI output for clearer progress/status messages.
  • Update git submodules recursively and fail fast with a helpful error if the command fails.
  • Create .env from .env.example when missing and automatically replace localhost host:port values with Docker service hostnames for PostgreSQL, RabbitMQ, and MinIO.
  • Detect whether docker-compose or docker compose is available and run up -d --build accordingly, failing with a clear error if neither is installed.
  • Print a summary of running services with URLs and credentials and show a sample docker compose logs command for tailing API logs.
start.sh

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

@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 2 issues, and left some high level feedback:

  • The sed -i usage in start.sh assumes GNU sed semantics and will fail on macOS/BSD; consider either detecting the platform and adjusting flags or using a more portable approach (e.g., perl -pi -e or creating a temp file).
  • The .env rewriting in start.sh is tightly coupled to specific localhost:port strings; if those defaults change in .env.example the script will silently stop doing the right thing—consider either key-based substitution (e.g., updating specific variables) or checking that replacements actually occurred and warning otherwise.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `sed -i` usage in `start.sh` assumes GNU sed semantics and will fail on macOS/BSD; consider either detecting the platform and adjusting flags or using a more portable approach (e.g., `perl -pi -e` or creating a temp file).
- The `.env` rewriting in `start.sh` is tightly coupled to specific `localhost:port` strings; if those defaults change in `.env.example` the script will silently stop doing the right thing—consider either key-based substitution (e.g., updating specific variables) or checking that replacements actually occurred and warning otherwise.

## Individual Comments

### Comment 1
<location path="docker-compose.yml" line_range="31-40" />
<code_context>
+    restart: unless-stopped
+    environment:
+      POSTGRES_USER: postgres
+      POSTGRES_PASSWORD: root
+    ports:
+      - "5432:5432"
+    volumes:
+      - postgres_data:/var/lib/postgresql/data
+      - ./docker/examples/init-db.sql:/docker-entrypoint-initdb.d/init-db.sql
+    networks:
+      - evolution_network
+
+  rabbitmq:
+    image: rabbitmq:3-management-alpine
+    container_name: evolution-rabbitmq
+    restart: unless-stopped
+    environment:
+      RABBITMQ_DEFAULT_USER: admin
+      RABBITMQ_DEFAULT_PASS: admin
+      RABBITMQ_DEFAULT_VHOST: default
+    ports:
+      - "5672:5672"
</code_context>
<issue_to_address>
**🚨 issue (security):** Exposed services use default credentials and public ports, which can be risky outside a local-only environment.

Postgres, RabbitMQ, and MinIO are all using default credentials and publishing ports directly to the host. That’s OK for strictly local use, but on any network-accessible machine it exposes these services with trivial passwords. Consider documenting this clearly and/or providing a separate compose override that either binds only to `127.0.0.1` or uses stronger secrets to reduce accidental exposure.
</issue_to_address>

### Comment 2
<location path="start.sh" line_range="28-30" />
<code_context>
+        cp .env.example .env
+        
+        # Automatically adjust for Docker Compose
+        sed -i 's/localhost:5432/postgres:5432/g' .env
+        sed -i 's/localhost:5672/rabbitmq:5672/g' .env
+        sed -i 's/localhost:9000/minio:9000/g' .env
+        
+        echo -e "${GREEN}.env file created from .env.example and adjusted for Docker!${NC}\n"
</code_context>
<issue_to_address>
**issue (bug_risk):** The `sed -i` usage is GNU-specific and may fail on macOS/other BSD-based systems.

On macOS (BSD `sed`), this form of `sed -i` will fail because it requires a backup extension (e.g., `-i ''`). To keep `start.sh` portable, consider detecting the platform and adjusting the flags, or avoid in-place edits by writing to a temp file and moving it back.
</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 +31 to +40
POSTGRES_PASSWORD: root
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./docker/examples/init-db.sql:/docker-entrypoint-initdb.d/init-db.sql
networks:
- evolution_network

rabbitmq:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚨 issue (security): Exposed services use default credentials and public ports, which can be risky outside a local-only environment.

Postgres, RabbitMQ, and MinIO are all using default credentials and publishing ports directly to the host. That’s OK for strictly local use, but on any network-accessible machine it exposes these services with trivial passwords. Consider documenting this clearly and/or providing a separate compose override that either binds only to 127.0.0.1 or uses stronger secrets to reduce accidental exposure.

Comment on lines +28 to +30
sed -i 's/localhost:5432/postgres:5432/g' .env
sed -i 's/localhost:5672/rabbitmq:5672/g' .env
sed -i 's/localhost:9000/minio:9000/g' .env
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): The sed -i usage is GNU-specific and may fail on macOS/other BSD-based systems.

On macOS (BSD sed), this form of sed -i will fail because it requires a backup extension (e.g., -i ''). To keep start.sh portable, consider detecting the platform and adjusting the flags, or avoid in-place edits by writing to a temp file and moving it back.

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