docs: improve setup instructions and add docker compose#4
docs: improve setup instructions and add docker compose#4oismaelash wants to merge 3 commits intoEvolutionAPI:mainfrom
Conversation
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.
Reviewer's GuideIntroduces 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 startupsequenceDiagram
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
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues, and left some high level feedback:
- The
sed -iusage instart.shassumes 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 -eor creating a temp file). - The
.envrewriting instart.shis tightly coupled to specificlocalhost:portstrings; if those defaults change in.env.examplethe 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>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| 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: |
There was a problem hiding this comment.
🚨 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.
| 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 |
There was a problem hiding this comment.
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.
…mage tag Remove explicit image tag for evolution-go service to rely on build context Standardize container names by removing project prefix (evolution-) Add POSTGRES_DB environment variable for postgres service
Introduce TELEMETRY_ENABLED environment variable to control telemetry collection. When disabled, middleware skips telemetry entirely. When enabled, common network errors (DNS lookup failures, connection refused) are silently ignored to avoid log spam in restricted environments.
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
Testing
Screenshots (if applicable)
Checklist
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:
Documentation: