Skip to content

fix: replace bash -c with sh -c for Alpine compatibility (#22)#25

Open
NeritonDias wants to merge 30 commits intoEvolutionAPI:developfrom
NeritonDias:fix/alpine-bash-compatibility
Open

fix: replace bash -c with sh -c for Alpine compatibility (#22)#25
NeritonDias wants to merge 30 commits intoEvolutionAPI:developfrom
NeritonDias:fix/alpine-bash-compatibility

Conversation

@NeritonDias
Copy link
Copy Markdown

@NeritonDias NeritonDias commented Apr 18, 2026

Summary

The Docker images for evo-auth and evo-crm services are built on Alpine Linux (ruby:3.4.4-alpine3.21), which does not ship with bash. Using bash -c "..." in container commands fails at runtime with:

docker/entrypoints/rails.sh: exec: line 34: bash: not found
exit code 127

The rails.sh entrypoint ends with exec "$@", which tries to execute the command passed via docker-compose command:. When that command starts with bash, the exec fails because bash is not installed in the Alpine image.

All affected commands are simple && chains fully compatible with POSIX sh, so the fix is a straight swap of bash -c for sh -c.

Files Changed

File Changes
docker-compose.yml evo-auth, evo-auth-sidekiq commands
docker-compose.prod-test.yaml evo_auth, evo_auth_sidekiq, evo_crm commands
docker-compose.swarm.yaml evo_auth command
setup.sh db seed commands for evo-auth and evo-crm
Makefile seed-auth and seed-crm targets

Root Cause

  1. Dockerfile uses FROM ruby:3.4.4-alpine3.21 — Alpine ships /bin/sh (BusyBox), not /bin/bash
  2. docker-compose files pass bash -c "..." as the container command
  3. docker/entrypoints/rails.sh line 34 runs exec "$@" which expands to exec bash -c "..."
  4. bash binary doesn't exist in the container → exit code 127

Fixes

Closes #22

Test Plan

  • make setup completes successfully without bash: not found errors
  • make seed-auth runs and seeds the Auth service
  • make seed-crm runs and seeds the CRM service
  • docker compose up starts evo-auth and evo-auth-sidekiq correctly
  • docker compose -f docker-compose.prod-test.yaml up still works
  • All commands execute identically under sh (all are POSIX-compatible &&/||/; chains)

Summary by Sourcery

Replace bash-based container commands with POSIX sh for compatibility with Alpine-based images.

Bug Fixes:

  • Ensure evo-auth and evo-crm containers start correctly on Alpine images by using sh instead of bash in docker-compose commands.
  • Fix seeding commands for Auth and CRM services in setup script and Makefile to run under sh in Alpine containers.

Enhancements:

  • Align Docker Compose and helper scripts to use POSIX-compliant shell commands across environments.

DavidsonGomes and others added 30 commits March 19, 2026 17:44
…Files

- Deleted the tech specification document for OSS community infrastructure setup.
- Updated files manifest with new hashes for YAML and configuration files.
- Modified IDE configuration for Claude Code with updated last modified date.
- Revised manifest.yaml to reflect the latest installation and module update timestamps.
- Updated memory and BMM module configuration files with new generation dates.
- Adjusted core module configuration file with the latest generation date.
- Updated submodule references for evo-ai-frontend-community and evo-auth-service-community to latest commits.
…ferences

- Introduced a new service `evo-bot-runtime` in `docker-compose.yml` for the Go/Gin bot, configured to listen on port 8080 with health checks and dependencies on Redis and the AI processor.
- Updated submodule references for `evo-ai-core-service-community`, `evo-ai-crm-community`, `evo-ai-frontend-community`, `evo-ai-processor-community`, and `evo-auth-service-community` to their latest commits.
The submodule was registered in .gitmodules but never staged,
so it appeared as untracked. This properly adds it to the tree.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tend-community, and evo-auth-service-community
- Updated .env.example to include BOT_RUNTIME_URL and BOT_RUNTIME_POSTBACK_BASE_URL.
- Created GitHub Actions workflow for building and publishing the gateway image.
- Updated README.md to reflect the addition of the bot runtime service.
- Added docker-compose.swarm.yaml for deploying the stack in Docker Swarm.
- Updated docker-compose.yml to include bot runtime configuration.
- Added Dockerfile and nginx.conf for the Nginx API gateway.
- Updated setup.sh to include bot runtime service URLs in the setup output.
…and update nginx configuration for dynamic service resolution
…col and add stop grace period for Sidekiq service
…tend runtime

The evo-crm container healthcheck ran curl -f against /auth/sign_in, a
legacy Chatwoot endpoint that no longer exists, so the CRM was perpetually
marked unhealthy. Any dependent container with a service_healthy condition
(notably evo-frontend) then refused to start, freezing make start in a
"Waiting" loop. Repointed the healthcheck at /health/live, which the Rails
app already exposes and returns 200.

The evo-frontend Dockerfile builds the Vite bundle with VITE_*_PLACEHOLDER
literals and replaces them at container start via docker-entrypoint.sh
using sed on the envs at runtime. The compose file only passed those
values as build args, so the runtime envs were empty, the sed was a no-op,
and the bundle shipped with raw VITE_AUTH_API_URL_PLACEHOLDER strings.
Axios then treated the baseURL as a relative path, POSTs to /auth/sign_in
hit the nginx static SPA, and login returned HTTP 405. Added an
environment: block that mirrors the build args and also includes VITE_WS_URL
(which the actionCableService reads and had no build-time default).

Bumps submodule pointers for the four repos touched in this change set.
…ok-config-and-channel-tooltips

fix(compose): repair crm healthcheck and inject VITE_* envs into frontend runtime
The Docker images for evo-auth and evo-crm services are built on
Alpine Linux (ruby:3.4.4-alpine3.21), which does not ship with bash.
Using 'bash -c "..."' in container commands fails at runtime with:

  docker/entrypoints/rails.sh: exec: line 34: bash: not found
  exit code 127

The rails.sh entrypoint ends with 'exec "$@"', which tries to execute
the command passed via docker-compose 'command:'. When that command
starts with 'bash', the exec fails because bash is not installed in
the Alpine image.

All commands are simple && chains fully compatible with POSIX sh,
so the fix is a straight swap of 'bash -c' for 'sh -c' in:

- docker-compose.yml (evo-auth, evo-auth-sidekiq)
- docker-compose.prod-test.yaml (evo_auth, evo_auth_sidekiq, evo_crm)
- docker-compose.swarm.yaml (evo_auth)
- setup.sh (db seed commands for evo-auth and evo-crm)
- Makefile (seed-auth and seed-crm targets)

Fixes EvolutionAPI#22
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Apr 18, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Replaces all uses of bash -c with sh -c in Docker Compose definitions, setup scripts, and Make targets to ensure compatibility with Alpine-based Ruby images that only provide /bin/sh while keeping the executed Rails and Sidekiq commands unchanged.

Sequence diagram for container startup before and after replacing bash with sh

sequenceDiagram
    actor Dev
    participant Makefile as Makefile_target
    participant Docker as docker_compose
    participant Container as Rails_container
    participant Entrypoint as rails_sh_entrypoint
    participant Shell as shell

    Dev->>Makefile: run seed-auth / docker compose up
    Makefile->>Docker: docker compose run evo-auth cmd
    note over Docker: command: bash -c "bundle exec rails ..." (before)
    Docker->>Container: start container with CMD
    Container->>Entrypoint: run rails.sh
    Entrypoint->>Entrypoint: exec "$@"
    Entrypoint->>Shell: exec bash -c "bundle exec rails ..."
    Shell-->>Entrypoint: bash not found (exit 127)
    Entrypoint-->>Container: process exits
    Container-->>Docker: container stops with error

    Dev->>Makefile: run seed-auth / docker compose up (after)
    Makefile->>Docker: docker compose run evo-auth cmd
    note over Docker: command: sh -c "bundle exec rails ..." (after)
    Docker->>Container: start container with CMD
    Container->>Entrypoint: run rails.sh
    Entrypoint->>Entrypoint: exec "$@"
    Entrypoint->>Shell: exec sh -c "bundle exec rails ..."
    Shell->>Shell: run bundle exec rails db:prepare
    Shell->>Shell: run bundle exec rails db:seed or rails s / sidekiq
    Shell-->>Entrypoint: commands complete
    Entrypoint-->>Container: process stays running (services healthy)
Loading

Flow diagram for seeding services using sh -c via Makefile and setup script

flowchart LR
    Dev["Developer runs make setup / make seed-auth / make seed-crm"] --> Makefile["Makefile targets seed-auth and seed-crm"]
    Makefile -->|docker compose run --rm evo-auth sh -c 'bundle exec rails db:prepare && bundle exec rails db:seed'| DockerAuth["docker compose run evo-auth"]
    Makefile -->|docker compose run --rm evo-crm sh -c 'bundle exec rails db:prepare && bundle exec rails db:seed'| DockerCrm["docker compose run evo-crm"]

    Dev --> SetupSh["setup.sh script"]
    SetupSh -->|docker compose run --rm evo-auth sh -c 'bundle exec rails db:prepare && bundle exec rails db:seed'| DockerAuth
    SetupSh -->|docker compose run --rm evo-crm sh -c 'bundle exec rails db:prepare && bundle exec rails db:seed'| DockerCrm

    DockerAuth --> EntrypointAuth["evo-auth rails.sh entrypoint"]
    DockerCrm --> EntrypointCrm["evo-crm rails.sh entrypoint"]

    EntrypointAuth --> ExecAuth["exec sh -c ..."]
    EntrypointCrm --> ExecCrm["exec sh -c ..."]

    ExecAuth --> AuthPrepare["bundle exec rails db:prepare"]
    AuthPrepare --> AuthSeed["bundle exec rails db:seed"]
    AuthSeed --> AuthDone["Auth database seeded"]

    ExecCrm --> CrmPrepare["bundle exec rails db:prepare"]
    CrmPrepare --> CrmSeed["bundle exec rails db:seed"]
    CrmSeed --> CrmDone["CRM database seeded"]
Loading

File-Level Changes

Change Details Files
Switch container start commands from bash to POSIX sh for Alpine-based evo_auth/evo_crm images.
  • Update evo_auth service command to use sh -c for running bundle install, DB prepare, and Rails server.
  • Update evo_auth_sidekiq service command to use sh -c for running bundle install and Sidekiq worker.
  • Update evo_crm service command to use sh -c for running DB prepare and Rails server.
  • Ensure chained Rails commands remain POSIX-compliant (&&, `
Align local seeding workflows with Alpine images by using sh in docker-compose run invocations.
  • Change Auth service seeding command to run via sh -c instead of bash -c.
  • Change CRM service seeding command to run via sh -c instead of bash -c.
  • Keep all Rails db:prepare and db:seed command chains identical aside from the shell used.
Makefile
setup.sh

Possibly linked issues

  • #N/A: Yes. The PR replaces bash -c with sh -c in make/setup seeding and compose commands fixing the reported bash-not-found error.

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 reviewed your changes and they look great!


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.

@NeritonDias NeritonDias force-pushed the fix/alpine-bash-compatibility branch from 0525fc8 to 4c6778b Compare April 18, 2026 20:48
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.

3 participants