-
Notifications
You must be signed in to change notification settings - Fork 52
Community fixes: bot-runtime secret, configurable gateway upstreams, dynamic AI models #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6f19e8a
fix(compose): default BOT_RUNTIME_SECRET on evo-bot-runtime service
gomessguii 8b6fa89
feat(gateway): make upstream service names configurable via env
gomessguii a61cf6c
ci(gateway): build and publish image on pushes to develop
gomessguii 1f620a9
docs(gateway): document the configurable upstream env vars
gomessguii d049048
chore: remove dependabot config from the monorepo
gomessguii 1d0a5f3
feat: load AI models dynamically from the provider's API
gomessguii File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule evo-ai-core-service-community
updated
2 files
| +67 −0 | pkg/api_key/handler/api_key_handler.go | |
| +236 −0 | pkg/api_key/service/models_fetcher.go |
Submodule evo-ai-frontend-community
updated
4 files
| +60 −16 | src/components/ai_agents/ModelSelector.tsx | |
| +6 −0 | src/services/agents/agentService.ts | |
| +4 −4 | src/services/tours/tourService.ts | |
| +12 −0 | src/types/agents/agent.ts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,17 @@ | ||
| FROM nginx:alpine | ||
| COPY nginx.conf /etc/nginx/conf.d/default.conf | ||
|
|
||
| # Default upstream targets. Override any of these at deploy time when the | ||
| # backend service names in your stack differ from the defaults below. | ||
| ENV AUTH_UPSTREAM=evo_auth:3001 \ | ||
| CRM_UPSTREAM=evo_crm:3000 \ | ||
| CORE_UPSTREAM=evo_core:5555 \ | ||
| PROCESSOR_UPSTREAM=evo_processor:8000 \ | ||
| BOT_RUNTIME_UPSTREAM=evo_bot_runtime:8080 | ||
|
|
||
| # Limit envsubst to the upstream vars so nginx's own $variables (e.g. $host, | ||
| # $request_uri) are not touched at render time. | ||
| ENV NGINX_ENVSUBST_FILTER="^(AUTH|CRM|CORE|PROCESSOR|BOT_RUNTIME)_UPSTREAM$" | ||
|
|
||
| COPY default.conf.template /etc/nginx/templates/default.conf.template | ||
|
|
||
| EXPOSE 3030 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,97 @@ | ||||||||||
| # Evo CRM — API Gateway | ||||||||||
|
|
||||||||||
| Single-entrypoint nginx that dispatches incoming requests to the five | ||||||||||
| backend services by URL path. Packaged as | ||||||||||
| `evoapicloud/evo-crm-gateway` and meant to sit behind a TLS-terminating | ||||||||||
| reverse proxy (Traefik, Caddy, an ALB, etc.). | ||||||||||
|
|
||||||||||
| ## Routing | ||||||||||
|
|
||||||||||
| Targets are declared as nginx variables at the top of the rendered config: | ||||||||||
|
|
||||||||||
| | Variable | Receives requests for | | ||||||||||
| |---------------------------|------------------------------------------------------| | ||||||||||
| | `$auth_service` | `/oauth`, `/.well-known`, `/setup/*`, `/api/v1/auth`, `/api/v1/users`, `/api/v1/accounts`, `/platform/*`, `/api/v1/super_admin` (most) | | ||||||||||
| | `$crm_service` | `/cable`, `/webhooks/*`, `/rails/active_storage`, `/api/v1/accounts/:id/webhooks`, `/api/v1/super_admin/{whitelabel,app_configs,upload,agent_bots,installation_configs,account_users}`, catch-all for unmatched `/api/v1/*` and `/` | | ||||||||||
| | `$evoai_service` | `/api/v1/{agents,folders,mcp-servers,custom-mcp-servers,custom-tools}` | | ||||||||||
| | `$processor_service` | `/api/v1/{chat,a2a,sessions,tools,clients}`, `/api/v1/agents/:id/integrations`, `/api/v1/integrations/:provider/callback`, `/api/v1/custom-mcp-servers/discover-tools`, `/health`, `/ready` | | ||||||||||
| | `$bot_runtime_service` | `/api/v1/bot-runtime` | | ||||||||||
|
|
||||||||||
| Full path matrix is in [`default.conf.template`](./default.conf.template). | ||||||||||
|
|
||||||||||
| ## Configurable upstreams | ||||||||||
|
|
||||||||||
| Each of the five variables above is rendered at container start from an | ||||||||||
| environment variable. Defaults match the service names used by the | ||||||||||
| reference `docker-compose.yaml` and `docker-compose.swarm.yaml`. | ||||||||||
|
|
||||||||||
| | Env var | Default | Points to | | ||||||||||
| |-------------------------|-------------------------|-----------| | ||||||||||
| | `AUTH_UPSTREAM` | `evo_auth:3001` | `evo-auth-service-community` | | ||||||||||
| | `CRM_UPSTREAM` | `evo_crm:3000` | `evo-ai-crm-community` | | ||||||||||
| | `CORE_UPSTREAM` | `evo_core:5555` | `evo-ai-core-service-community` | | ||||||||||
| | `PROCESSOR_UPSTREAM` | `evo_processor:8000` | `evo-ai-processor-community` | | ||||||||||
| | `BOT_RUNTIME_UPSTREAM` | `evo_bot_runtime:8080` | `evo-bot-runtime` | | ||||||||||
|
|
||||||||||
| Format is always `host:port`, no scheme. The gateway concatenates `http://` | ||||||||||
| at the front when rendering. | ||||||||||
|
|
||||||||||
| ### When you need to override | ||||||||||
|
|
||||||||||
| If your deployment renames any of the backend services (e.g. applying a | ||||||||||
| `evocrm_` prefix, or shortening to `auth`/`crm`/…) the gateway cannot | ||||||||||
|
Comment on lines
+41
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (typo): Use "an" instead of "a" before Because
Suggested change
|
||||||||||
| resolve the default hostnames and every proxied request returns **502 Bad | ||||||||||
| Gateway**. Set the matching `*_UPSTREAM` env vars on the gateway service | ||||||||||
| to the service names you actually used. | ||||||||||
|
|
||||||||||
| ### Example — prefixed service names | ||||||||||
|
|
||||||||||
| Stack uses `evocrm_auth`, `evocrm_crm`, `evocrm_core`, `evocrm_processor`, | ||||||||||
| `evocrm_bot_runtime`: | ||||||||||
|
|
||||||||||
| ```yaml | ||||||||||
| services: | ||||||||||
| evocrm_gateway: | ||||||||||
| image: evoapicloud/evo-crm-gateway:latest | ||||||||||
| environment: | ||||||||||
| AUTH_UPSTREAM: evocrm_auth:3001 | ||||||||||
| CRM_UPSTREAM: evocrm_crm:3000 | ||||||||||
| CORE_UPSTREAM: evocrm_core:5555 | ||||||||||
| PROCESSOR_UPSTREAM: evocrm_processor:8000 | ||||||||||
| BOT_RUNTIME_UPSTREAM: evocrm_bot_runtime:8080 | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| ### Example — non-standard ports | ||||||||||
|
|
||||||||||
| If you expose the auth service on `4001` instead of `3001`: | ||||||||||
|
|
||||||||||
| ```yaml | ||||||||||
| environment: | ||||||||||
| AUTH_UPSTREAM: evo_auth:4001 | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| ## Verifying the rendered config | ||||||||||
|
|
||||||||||
| To confirm the variables were substituted correctly, inspect the rendered | ||||||||||
| file inside a running container: | ||||||||||
|
|
||||||||||
| ```bash | ||||||||||
| docker exec <gateway-container> \ | ||||||||||
| grep -E "set \$(auth|crm|evoai|processor|bot_runtime)_service" \ | ||||||||||
| /etc/nginx/conf.d/default.conf | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| You should see the expected hostnames. If any line still contains | ||||||||||
| `${VARNAME}` literally, the env var was not set and envsubst skipped it. | ||||||||||
|
|
||||||||||
| ## Build | ||||||||||
|
|
||||||||||
| ```bash | ||||||||||
| docker build -t evo-crm-gateway:local nginx/ | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| The image uses the stock `nginx:alpine` base and the image's built-in | ||||||||||
| template rendering — templates in `/etc/nginx/templates/*.template` are | ||||||||||
| processed by envsubst at container start. `NGINX_ENVSUBST_FILTER` is | ||||||||||
| restricted to the five `*_UPSTREAM` vars so the substitution pass does | ||||||||||
| not touch nginx's own runtime variables (`$host`, `$request_uri`, etc.). | ||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 issue (security): The default BOT_RUNTIME_SECRET value is predictable and might be unsafe if reused beyond local dev.
A hard-coded default secret is fine for local dev, but if this compose file is ever used in shared or production-like environments the value becomes trivial to guess. Consider requiring it to be explicitly set (
${BOT_RUNTIME_SECRET:?must_be_set}) or clearly marking this default as local-only and unsafe to use elsewhere.