fix: [plausible, clickhouse] close the /storybook code execution (Plausible 3.2.1) and apply ClickHouse low-memory settings #2

Merged
stephansainleger merged 2 commits from vlab/plausible-storybook-rce AGit into master 2026-11-05 08:25:41 +00:00
4 changed files with 44 additions and 22 deletions
Showing only changes of commit 7ffadbf2ff - Show all commits

View File

@@ -4,4 +4,23 @@
This charm is provided to work with plausible charm
* Usage
Configuration files come from
https://github.com/plausible/community-edition/ (=clickhouse/=).
* Usage
Added automatically by the =plausible= charm (=event-db= relation).
* Low memory settings
- =config.d/low-resources.xml=: server settings (=mark_cache_size=).
- =users.d/default-profile-low-resources-overrides.xml=: settings of the
=default= profile (=max_threads= 1, …). ClickHouse reads profiles
only from users configuration files: in =config.d= they were ignored.
Check that they apply:
#+begin_src sh
docker exec <container> clickhouse-client -q \
"SELECT name, value FROM system.settings WHERE name = 'max_threads'"
#+end_src

View File

@@ -9,6 +9,9 @@ charm-resources:
- /etc/clickhouse-server/config.d/logs.xml
- /etc/clickhouse-server/config.d/ipv4-only.xml
- /etc/clickhouse-server/config.d/low-resources.xml
## Profile settings are only read from users.d (they were ignored when
## they lived in config.d/low-resources.xml).
- /etc/clickhouse-server/users.d/default-profile-low-resources-overrides.xml
provides:
event-db:

View File

@@ -1,23 +1,4 @@
<!-- https://clickhouse.com/docs/en/operations/tips#using-less-than-16gb-of-ram -->
<clickhouse>
<!--
https://clickhouse.com/docs/en/operations/server-configuration-parameters/settings#mark_cache_size -->
<!-- https://clickhouse.com/docs/en/operations/server-configuration-parameters/settings#mark_cache_size -->
<mark_cache_size>524288000</mark_cache_size>
<profile>
<default>
<!-- https://clickhouse.com/docs/en/operations/settings/settings#max_threads -->
<max_threads>1</max_threads>
<!-- https://clickhouse.com/docs/en/operations/settings/settings#max_block_size -->
<max_block_size>8192</max_block_size>
<!-- https://clickhouse.com/docs/en/operations/settings/settings#max_download_threads -->
<max_download_threads>1</max_download_threads>
<!--
https://clickhouse.com/docs/en/operations/settings/settings#input_format_parallel_parsing -->
<input_format_parallel_parsing>0</input_format_parallel_parsing>
<!--
https://clickhouse.com/docs/en/operations/settings/settings#output_format_parallel_formatting -->
<output_format_parallel_formatting>0</output_format_parallel_formatting>
</default>
</profile>
</clickhouse>
</clickhouse>

View File

@@ -0,0 +1,19 @@
<!-- https://clickhouse.com/docs/en/operations/tips#using-less-than-16gb-of-ram -->
<clickhouse>
<profiles>
<default>
<!-- https://clickhouse.com/docs/en/operations/settings/settings#max_threads -->
<max_threads>1</max_threads>
<!-- https://clickhouse.com/docs/en/operations/settings/settings#max_block_size -->
<max_block_size>8192</max_block_size>
<!-- https://clickhouse.com/docs/en/operations/settings/settings#max_download_threads -->
<max_download_threads>1</max_download_threads>
<!--
https://clickhouse.com/docs/en/operations/settings/settings#input_format_parallel_parsing -->
<input_format_parallel_parsing>0</input_format_parallel_parsing>
<!--
https://clickhouse.com/docs/en/operations/settings/settings#output_format_parallel_formatting -->
<output_format_parallel_formatting>0</output_format_parallel_formatting>
</default>
</profiles>
</clickhouse>