aboutsummaryrefslogtreecommitdiff
path: root/personal_infra/puppet/modules/clickhouse/manifests/init.pp
blob: 0c5d60f03bd21bf3eedd342829fa9aebe4fb1dcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
class clickhouse {
  file {'/etc/yum.repos.d/clickhouse.repo':
    content => @(EOT)
      [clickhouse-stable]
      name=ClickHouse - Stable Repository
      baseurl=https://packages.clickhouse.com/rpm/stable/
      gpgkey=https://packages.clickhouse.com/rpm/stable/repodata/repomd.xml.key
      gpgcheck=0
      repo_gpgcheck=1
      enabled=1

      [clickhouse-lts]
      name=ClickHouse - LTS Repository
      baseurl=https://packages.clickhouse.com/rpm/lts/
      gpgkey=https://packages.clickhouse.com/rpm/lts/repodata/repomd.xml.key
      gpgcheck=0
      repo_gpgcheck=1
      enabled=0
      | EOT
    ,
  }
  ->
  package {['clickhouse-server', 'clickhouse-client']:}
  ->
  [File['/etc/clickhouse-server/config.d/network.xml'], File['/etc/clickhouse-server/config.d/logs.xml']]
  ~>
  service {['clickhouse-server']:
    ensure => running,
    enable => true,
  }

  file {'/etc/clickhouse-server/config.d/network.xml':
    content => @(EOT)
      <clickhouse>
        <listen_host>::</listen_host>
      </clickhouse>
      | EOT
    ,
  }

  file {'/etc/clickhouse-server/config.d/logs.xml':
    content => @(EOT)
      <clickhouse>
        <asynchronous_metric_log>
          <ttl>event_date + INTERVAL 3 DAY DELETE</ttl>
        </asynchronous_metric_log>
        <trace_log remove="1"/>
        <metric_log>
          <ttl>event_date + INTERVAL 3 DAY DELETE</ttl>
        </metric_log>
        <query_log>
          <ttl>event_date + INTERVAL 3 DAY DELETE</ttl>
        </query_log>
        <text_log>
          <ttl>event_date + INTERVAL 3 DAY DELETE</ttl>
        </text_log>
      </clickhouse>
    | EOT
    ,
  }
}