Page MenuHomeDevCentral

D2873.id7321.diff
No OneTemporary

D2873.id7321.diff

diff --git a/pillar/paas/docker/docker-002/sentry.sls b/pillar/paas/docker/docker-002/sentry.sls
--- a/pillar/paas/docker/docker-002/sentry.sls
+++ b/pillar/paas/docker/docker-002/sentry.sls
@@ -15,6 +15,7 @@
- library/redis:3.2-alpine
- library/sentry
- tianon/exim4
+ - yandex/clickhouse-server:20.3.9.70
docker_containers:
@@ -60,6 +61,16 @@
- ingest-events
- ingest-replay-recordings
+ #
+ # ClickHouse
+ #
+ clickhouse:
+ sentry_clickhouse:
+ version: 20.3.9.70
+ network: sentry
+ config: sentry.xml
+ max_memory_ratio: 0.2
+
#
# Services maintained by Sentry
#
diff --git a/roles/paas-docker/containers/clickhouse.sls b/roles/paas-docker/containers/clickhouse.sls
new file mode 100644
--- /dev/null
+++ b/roles/paas-docker/containers/clickhouse.sls
@@ -0,0 +1,70 @@
+# -------------------------------------------------------------
+# Salt — Provision Docker engine
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% set has_selinux = salt['grains.get']('selinux:enabled', False) %}
+
+{% for instance, container in pillar['docker_containers']['clickhouse'].items() %}
+{% set image = salt['paas_docker.get_image']("yandex/clickhouse-server", container) %}
+
+# -------------------------------------------------------------
+# Data directory
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+/srv/clickhouse/{{ instance }}:
+ file.directory:
+ - makedirs: True
+
+{% for subdir in ['lib', 'log'] %}
+/srv/clickhouse/{{ instance }}/{{ subdir }}:
+ file.directory:
+ - user: 101
+ - group: 101
+{% endfor %}
+
+/srv/clickhouse/{{ instance }}/{{ container['config'] }}:
+ file.managed:
+ - source: salt://roles/paas-docker/containers/files/clickhouse/{{ instance }}/{{ container['config'] }}
+ - user: 101
+ - group: 101
+
+{% if has_selinux %}
+selinux_context_{{ instance }}_clickhouse_data:
+ selinux.fcontext_policy_present:
+ - name: /srv/clickhouse/{{ instance }}
+ - sel_type: container_file_t
+
+selinux_context_{{ instance }}_clickhouse_data_applied:
+ selinux.fcontext_policy_applied:
+ - name: /srv/clickhouse/{{ instance }}
+{% endif %}
+
+# -------------------------------------------------------------
+# Container
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{{ instance }}:
+ docker_container.running:
+ - detach: True
+ - interactive: True
+ - image: {{ image }}
+ - binds:
+ - /srv/clickhouse/{{ instance }}/lib:/var/lib/clickhouse
+ - /srv/clickhouse/{{ instance }}/log:/var/log/clickhouse-server
+ - /srv/clickhouse/{{ instance }}/{{ container['config'] }}:/etc/clickhouse-server/config.d/{{ container['config'] }}
+ - environment:
+ # Should be increased if search returns incomplete results
+ MAX_MEMORY_USAGE_RATIO: {{ container['max_memory_ratio'] | default(0.3) }}
+ - ulimits:
+ - nofile=262144:262144
+ - healthcheck:
+ Test: http_proxy='' wget -nv -t1 --spider 'http://localhost:8123/' || exit 1
+ Interval: 30000000000
+{% if 'network' in container %}
+ - networks:
+ - {{ container['network'] }}
+{% endif %}
+{% endfor %}
diff --git a/roles/paas-docker/containers/files/clickhouse/sentry_clickhouse/sentry.xml b/roles/paas-docker/containers/files/clickhouse/sentry_clickhouse/sentry.xml
new file mode 100644
--- /dev/null
+++ b/roles/paas-docker/containers/files/clickhouse/sentry_clickhouse/sentry.xml
@@ -0,0 +1,32 @@
+<!--
+#
+# ClickHouse configuration - Sentry
+#
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Forked from: getsentry/self-hosted/master/clickhouse/config.xml
+# Source file: roles/paas-docker/containers/files/clickhouse/sentry_clickhouse/sentry.xml
+# _____________________________________________________________
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+-->
+
+<yandex>
+ <max_server_memory_usage_to_ram_ratio>
+ <include from_env="MAX_MEMORY_USAGE_RATIO"/>
+ </max_server_memory_usage_to_ram_ratio>
+
+ <logger>
+ <level>information</level>
+ <console>1</console>
+ </logger>
+
+ <merge_tree>
+ <enable_mixed_granularity_parts>1</enable_mixed_granularity_parts>
+ </merge_tree>
+</yandex>

File Metadata

Mime Type
text/plain
Expires
Tue, Oct 1, 08:33 (17 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2168088
Default Alt Text
D2873.id7321.diff (4 KB)

Event Timeline