-
-
Notifications
You must be signed in to change notification settings - Fork 852
refactor: consolidate ClickHouse configuration into single CLICKHOUSE… #2607
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
refactor: consolidate ClickHouse configuration into single CLICKHOUSE… #2607
Conversation
|
WalkthroughAdds CLICKHOUSE_URL to environment examples and replaces prior RUN_REPLICATION_CLICKHOUSE_URL references across app code, Docker, and Helm manifests. Updates the webapp environment schema by removing RUN_REPLICATION_CLICKHOUSE_URL and setting RUN_REPLICATION_ENABLED default to "1". Updates service initialization to check RUN_REPLICATION_ENABLED, returning early if not "1", and otherwise proceed with startup; signal handlers are attached unconditionally. Routes creating the replication service now use CLICKHOUSE_URL. Docker Compose and Helm templates remove the deprecated variable. Helm chart version is bumped from 4.0.4 to 4.0.5. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (8)
💤 Files with no reviewable changes (3)
🧰 Additional context used📓 Path-based instructions (5)**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
{packages/core,apps/webapp}/**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
apps/webapp/**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)
Files:
{apps/webapp/app/**/*.server.{ts,tsx},apps/webapp/app/routes/**/*.ts}📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)
Files:
apps/webapp/app/**/*.ts📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)
Files:
🧠 Learnings (3)📚 Learning: 2025-06-25T13:18:44.103Z
Applied to files:
📚 Learning: 2025-06-25T13:20:17.174Z
Applied to files:
📚 Learning: 2025-06-25T13:18:04.827Z
Applied to files:
🧬 Code graph analysis (2)apps/webapp/app/routes/admin.api.v1.runs-replication.create.ts (1)
apps/webapp/app/services/runsReplicationInstance.server.ts (4)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (22)
🔇 Additional comments (10)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Thanks @LeoKaynan but let's not touch the webapp here. We try to follow the same pattern as we do for redis so we can use different URLs for different services if needed.
It's fine to fix this for self-hosters if there are any bugs though!
One thing to consider is that people have been known to use old versions of the compose files. The clickhouse env vars are present in the latest version:
trigger.dev/hosting/docker/webapp/docker-compose.yml
Lines 64 to 69 in 63b6fc9
# ClickHouse configuration | |
CLICKHOUSE_URL: ${CLICKHOUSE_URL:-http://default:password@clickhouse:8123?secure=false} | |
CLICKHOUSE_LOG_LEVEL: ${CLICKHOUSE_LOG_LEVEL:-info} | |
# Run replication | |
RUN_REPLICATION_ENABLED: ${RUN_REPLICATION_ENABLED:-1} | |
RUN_REPLICATION_CLICKHOUSE_URL: ${RUN_REPLICATION_CLICKHOUSE_URL:-http://default:password@clickhouse:8123} |
If there are any helm issues it would be worth looking at this block:
trigger.dev/hosting/k8s/helm/templates/_helpers.tpl
Lines 420 to 435 in 63b6fc9
{{/* | |
ClickHouse URL for replication (without secure parameter) | |
*/}} | |
{{- define "trigger-v4.clickhouse.replication.url" -}} | |
{{- if .Values.clickhouse.deploy -}} | |
{{- $protocol := ternary "https" "http" .Values.clickhouse.secure -}} | |
{{ $protocol }}://{{ .Values.clickhouse.auth.username }}:{{ .Values.clickhouse.auth.password }}@{{ include "trigger-v4.clickhouse.hostname" . }}:8123 | |
{{- else if .Values.clickhouse.external.host -}} | |
{{- $protocol := ternary "https" "http" .Values.clickhouse.external.secure -}} | |
{{- if .Values.clickhouse.external.existingSecret -}} | |
{{ $protocol }}://{{ .Values.clickhouse.external.username }}:${CLICKHOUSE_PASSWORD}@{{ .Values.clickhouse.external.host }}:{{ .Values.clickhouse.external.httpPort | default 8123 }} | |
{{- else -}} | |
{{ $protocol }}://{{ .Values.clickhouse.external.username }}:{{ .Values.clickhouse.external.password }}@{{ .Values.clickhouse.external.host }}:{{ .Values.clickhouse.external.httpPort | default 8123 }} | |
{{- end -}} | |
{{- end -}} | |
{{- end }} |
Thanks for the feedback @nicktrn I understand now that the separation of URLs is intentional to follow the Redis pattern and allow flexibility for different services. I'll close this PR. The consolidation seemed like a simplification but I see the architectural reasoning behind keeping them separate for future scalability scenarios. Thanks for clarifying! 👍 You might have to be careful here, uses ClickHouse by default: RUN_REPLICATION_CLICKHOUSE_URL is optional. we need to update .env.example, can I open a PR for this? |
Summary
This PR consolidates redundant ClickHouse environment variables and improves the replication service initialization logic. ClickHouse remains required (as intended since PR #2264).
Root Cause: The dashboard always queried ClickHouse by default but did not show the runs because RUN_REPLICATION_CLICKHOUSE_URL should be defined.
Background & Context
PR #2035 - Original ClickHouse Implementation (May 2024)
CLICKHOUSE_URL
for all operationsPR #2264 - Bulk Actions 2.0 (July 2024)
NextRunListPresenter
)CLICKHOUSE_URL
required - correct strategic decisionCurrent State
At some point,
RUN_REPLICATION_CLICKHOUSE_URL
was introduced as a duplicate, creating unnecessary complexity.Changes
1. Remove Redundant
RUN_REPLICATION_CLICKHOUSE_URL
CLICKHOUSE_URL
(original feat: replicate task runs to clickhouse to power dashboard improvements #2035 design)Benefits:
✅ Checklist
Testing
I performed several tasks
Changelog
Screenshots
💯