Skip to content

fix(compose): set EVO_AUTH_BASE_URL on evo-processor (EVO-1683)#126

Merged
dpaes merged 1 commit into
developfrom
marcelo/evo-1683-processor-auth-url
Jun 22, 2026
Merged

fix(compose): set EVO_AUTH_BASE_URL on evo-processor (EVO-1683)#126
dpaes merged 1 commit into
developfrom
marcelo/evo-1683-processor-auth-url

Conversation

@marcelogorutuba

@marcelogorutuba marcelogorutuba commented Jun 22, 2026

Copy link
Copy Markdown
Member

Summary

  • Adiciona EVO_AUTH_BASE_URL: http://evo-auth:3001 no environment do serviço evo-processor
  • Adiciona evo-auth ao depends_on do evo-processor (condition: service_healthy) para garantir ordem de subida

Why

Processor caía no default localhost:3001 (de src/config/settings.py:51) e retornava 503 ERR_SERVICE_UNAVAILABLE ao validar bearer token, com log EvoAuth: Network error for POST /api/v1/auth/validate: All connection attempts failed. Cliente precisava aplicar workaround manual no compose.

Agora alinha com evo-core, que já consome o mesmo host via EVO_AUTH_BASE_URL (corrigindo nome de var citado erroneamente como EVO_AUTH_SERVICE_URL no commit body — quem usa essa variante é evo-crm/evo-crm-sidekiq).

Validation

  • docker compose config parseia OK
  • evo-processor em docker compose config:
    • EVO_AUTH_BASE_URL: http://evo-auth:3001
    • depends_on: [evo-auth, postgres, redis]
  • Container recreated + smoke manual: docker compose exec evo-processor env | grep EVO_AUTH_BASE_URLhttp://evo-auth:3001
  • Reachability: python -c "urllib.request.urlopen('http://evo-auth:3001/up')" → HTTP 200
  • Logs do processor: Token validation successful for user: admin@evo.local (zero All connection attempts failed)

Out of scope (deliberadamente)

  • evo-core também não tem depends_on: evo-auth. Tecnicamente o mesmo padrão, mas sem evidência de incidente reportado e Rails tem retry no boot que mascara a janela. Vira card próprio se aparecer relato.
  • Fix defensivo no settings.py default (issue §4, marcado como opcional). Fix primário no compose já destrava o cliente.

Changed Files

  • docker-compose.yml

Linked Issue

  • EVO-1683

Processor caía no default localhost:3001 e retornava 503 ao validar token,
pois o bloco environment não definia EVO_AUTH_BASE_URL e o serviço de auth
não estava em depends_on. Alinha com evo-core (EVO_AUTH_SERVICE_URL).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates evo-processor service in docker-compose to explicitly point at evo-auth via EVO_AUTH_BASE_URL and to wait for evo-auth’s healthcheck before starting, preventing it from defaulting to localhost and failing bearer token validation.

File-Level Changes

Change Details Files
Configure evo-processor to use evo-auth service URL instead of localhost and enforce startup ordering on evo-auth.
  • Add EVO_AUTH_BASE_URL environment variable pointing to http://evo-auth:3001 for evo-processor.
  • Extend evo-processor depends_on to include evo-auth with condition: service_healthy alongside postgres and redis.
docker-compose.yml

Possibly linked issues

  • #correções pra instalação via setup orion: PR implementa a correção pedida no issue, adicionando EVO_AUTH_BASE_URL ao serviço processor no docker-compose.

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="docker-compose.yml" line_range="240-237" />
<code_context>
         condition: service_healthy
       redis:
         condition: service_healthy
+      evo-auth:
+        condition: service_healthy
     healthcheck:
       test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
</code_context>
<issue_to_address>
**issue:** Double-check that the `evo-auth` service defines a compatible `healthcheck` since processor now depends on it.

Ensure `evo-auth`’s healthcheck only reports healthy once the auth API is actually ready to handle requests; otherwise the new `service_healthy` dependency may still allow flaky startup ordering.
</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 thread docker-compose.yml
- processor_logs:/app/logs
depends_on:
postgres:
condition: service_healthy

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: Double-check that the evo-auth service defines a compatible healthcheck since processor now depends on it.

Ensure evo-auth’s healthcheck only reports healthy once the auth API is actually ready to handle requests; otherwise the new service_healthy dependency may still allow flaky startup ordering.

@dpaes dpaes left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved — merging to develop.

XS docker-compose fix. Verified against the compose file (not just the diff):

  • Host evo-auth:3001 matches the actual auth service name (hyphen) and port — byte-identical to evo-core's existing EVO_AUTH_BASE_URL (line 199), which is known-good.
  • depends_on: evo-auth { condition: service_healthy } is valid because evo-auth defines a healthcheck (lines 67–72); same dependency pattern already used by evo-crm/evo-frontend.
  • No .env collision: Compose environment: precedence overrides env_file, and the value is a literal (no ${...} interpolation).

Documented scope deferrals (no depends_on: evo-auth on evo-core, optional settings.py:51 default left as-is) are reasonable — the in-container override already unblocks token validation.

@dpaes dpaes merged commit 4037987 into develop Jun 22, 2026
3 checks passed
@dpaes dpaes deleted the marcelo/evo-1683-processor-auth-url branch June 22, 2026 19:55
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.

2 participants