new: [plausible] add charm
This commit is contained in:
7
clickhouse/README.org
Normal file
7
clickhouse/README.org
Normal file
@@ -0,0 +1,7 @@
|
||||
# -*- ispell-local-dictionary: "english" -*-
|
||||
|
||||
* Info
|
||||
|
||||
This charm is provided to work with plausible charm
|
||||
|
||||
* Usage
|
21
clickhouse/hooks/init
Executable file
21
clickhouse/hooks/init
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
## Init is run on host
|
||||
## For now it is run every time the script is launched, but
|
||||
## it should be launched only once after build.
|
||||
|
||||
## Accessible variables are:
|
||||
## - SERVICE_NAME Name of current service
|
||||
## - DOCKER_BASE_IMAGE Base image from which this service might be built if any
|
||||
## - SERVICE_DATASTORE Location on host of the DATASTORE of this service
|
||||
## - SERVICE_CONFIGSTORE Location on host of the CONFIGSTORE of this service
|
||||
|
||||
set -e
|
||||
|
||||
init-config-add "
|
||||
$SERVICE_NAME:
|
||||
environment:
|
||||
CLICKHOUSE_SKIP_USER_SETUP: 1
|
||||
healthcheck:
|
||||
test: [ \"CMD-SHELL\", \"wget --no-verbose --tries=1 -O - http://127.0.0.1:8123/ping || exit 1\" ]
|
||||
"
|
21
clickhouse/metadata.yml
Normal file
21
clickhouse/metadata.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
docker-image: docker.0k.io/clickhouse:24.12-alpine
|
||||
#docker-image: clickhouse/clickhouse-server:24.12-alpine
|
||||
|
||||
data-resources:
|
||||
- /var/lib/clickhouse
|
||||
- /var/log/clickhouse-server
|
||||
|
||||
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
|
||||
|
||||
provides:
|
||||
event-db:
|
||||
|
||||
uses:
|
||||
log-rotate:
|
||||
constraint: recommended
|
||||
auto: pair
|
||||
solves:
|
||||
disk-leak: "/var/log/clickhouse-server"
|
@@ -0,0 +1,3 @@
|
||||
<clickhouse>
|
||||
<listen_host>0.0.0.0</listen_host>
|
||||
</clickhouse>
|
28
clickhouse/resources/etc/clickhouse-server/config.d/logs.xml
Normal file
28
clickhouse/resources/etc/clickhouse-server/config.d/logs.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<clickhouse>
|
||||
<logger>
|
||||
<level>warning</level>
|
||||
<console>true</console>
|
||||
</logger>
|
||||
|
||||
<query_log replace="1">
|
||||
<database>system</database>
|
||||
<table>query_log</table>
|
||||
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
|
||||
<engine>
|
||||
ENGINE = MergeTree
|
||||
PARTITION BY event_date
|
||||
ORDER BY (event_time)
|
||||
TTL event_date + interval 30 day
|
||||
SETTINGS ttl_only_drop_parts=1
|
||||
</engine>
|
||||
</query_log>
|
||||
|
||||
<!-- Stops unnecessary logging -->
|
||||
<metric_log remove="remove" />
|
||||
<asynchronous_metric_log remove="remove" />
|
||||
<query_thread_log remove="remove" />
|
||||
<text_log remove="remove" />
|
||||
<trace_log remove="remove" />
|
||||
<session_log remove="remove" />
|
||||
<part_log remove="remove" />
|
||||
</clickhouse>
|
@@ -0,0 +1,23 @@
|
||||
<!-- 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 -->
|
||||
<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>
|
Reference in New Issue
Block a user