feat: add ClickHouse single tenant mode (ingestion only)#2949
Open
feat: add ClickHouse single tenant mode (ingestion only)#2949
Conversation
Add support for running Logflare in single tenant mode with ClickHouse as the backend for log ingestion. This follows the same virtual backend pattern used for PostgreSQL single tenant mode, where backend_id is nil and configuration is read from environment variables. Query/search functionality is intentionally excluded from this implementation.
Ziinc
requested changes
Nov 25, 2025
| ) | ||
|
|
||
| System.get_env("LOGFLARE_SINGLE_TENANT", "false") == "true" && | ||
| not is_nil(System.get_env("CLICKHOUSE_URL")) -> |
Contributor
There was a problem hiding this comment.
Suggested change
| not is_nil(System.get_env("CLICKHOUSE_URL")) -> | |
| not is_nil(System.get_env("CLICKHOUSE_BACKEND_URL")) -> |
| config :logflare, | ||
| :clickhouse_backend_adapter, | ||
| filter_nil_kv_pairs.( | ||
| url: System.get_env("CLICKHOUSE_URL"), |
Contributor
There was a problem hiding this comment.
Suggested change
| url: System.get_env("CLICKHOUSE_URL"), | |
| url: System.get_env("CLICKHOUSE_BACKEND_URL"), |
| :clickhouse_backend_adapter, | ||
| filter_nil_kv_pairs.( | ||
| url: System.get_env("CLICKHOUSE_URL"), | ||
| database: System.get_env("CLICKHOUSE_DATABASE"), |
Contributor
There was a problem hiding this comment.
Suggested change
| database: System.get_env("CLICKHOUSE_DATABASE"), | |
| database: System.get_env("CLICKHOUSE_BACKEND_DATABASE"), |
| filter_nil_kv_pairs.( | ||
| url: System.get_env("CLICKHOUSE_URL"), | ||
| database: System.get_env("CLICKHOUSE_DATABASE"), | ||
| username: System.get_env("CLICKHOUSE_USERNAME"), |
Contributor
There was a problem hiding this comment.
Suggested change
| username: System.get_env("CLICKHOUSE_USERNAME"), | |
| username: System.get_env("CLICKHOUSE_BACKEND_USERNAME"), |
| url: System.get_env("CLICKHOUSE_URL"), | ||
| database: System.get_env("CLICKHOUSE_DATABASE"), | ||
| username: System.get_env("CLICKHOUSE_USERNAME"), | ||
| password: System.get_env("CLICKHOUSE_PASSWORD") |
Contributor
There was a problem hiding this comment.
Suggested change
| password: System.get_env("CLICKHOUSE_PASSWORD") | |
| password: System.get_env("CLICKHOUSE_BACKEND_PASSWORD") |
| end | ||
|
|
||
| def clickhouse_conn_manager_children do | ||
| if SingleTenant.clickhouse_backend?() do |
Contributor
There was a problem hiding this comment.
This child spec shouldn't be needed as it should be supervised by QueryConnectionSup
|
|
||
| start.st.ch: ERL_NAME = st_ch | ||
| start.st.ch: PORT ?= 4000 | ||
| start.st.ch: ENV_FILE = .single_tenant_ch.env |
Contributor
There was a problem hiding this comment.
Will. Need a ch env file as well
Contributor
|
Also need to add self hosting documentation and new env vars to table |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add support for running Logflare in single tenant mode with ClickHouse as the backend. This follows the same virtual backend pattern used for PostgreSQL single tenant mode, where backend_id is nil and configuration is read from environment variables.
Query/search functionality is excluded from this implementation, as bigger changes are required to support them.