terrafying-components 1.12.7 → 1.12.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5acb423052587aa0f912b103c54a7fa279b0c879811290cc1d84d5f9306af187
4
- data.tar.gz: e40ba1c34f00923bfb696ae3c7c783f37203b3c2dfacd549d123a0940e8f0fbc
3
+ metadata.gz: 54520cd03f620415fec047fba8561400088b58aeec4d1941590362b7d6d1b066
4
+ data.tar.gz: 0607b8d938affc570cf680437ec2de165854071c7d07691ad23d3fcb1f773ceb
5
5
  SHA512:
6
- metadata.gz: e434ec5f3ff0a5869739d57ee1d242c0639324dcf9e3d97cccdfa6a7617770643bccbd9edc4ada515082380b410356c6654e43bdb985e9b8e5f16fb27443225f
7
- data.tar.gz: bbc439049928cd659664a3ada6475bf394fafbf193d272c58d66e639f64c6b1294566d5ad7a4992ab243f48befa0d3c4163da4375971f45864873766acabccc2
6
+ metadata.gz: '084e2781ba5cc42c461e5115d9e01abd45f41a015d2e21898c69454081a9cde755f55485f9d50aa533040ba474b1aed692abf11953771175731c402749097e6d'
7
+ data.tar.gz: 5ee69ea538baf10b3713ff6feb2e9a39c1579a19a6183c336ca2d36aa2f9e3625dd7e0d11da06e671205788be4a86aac49c6d9723669d85207d8b6f4ac42cb5c
@@ -26,7 +26,9 @@ module Terrafying
26
26
  instances: 2,
27
27
  instance_type: 't3a.small',
28
28
  thanos_instance_type: 't3a.small',
29
- prometheus_tsdb_retention: '1d'
29
+ prometheus_tsdb_retention: '1d',
30
+ prometheus_data_dir: '/var/lib/prometheus',
31
+ prometheus_data_size: 20
30
32
  )
31
33
  super()
32
34
  @vpc = vpc
@@ -38,6 +40,8 @@ module Terrafying
38
40
  @prometheus_instance_type = instance_type
39
41
  @thanos_instance_type = thanos_instance_type
40
42
  @prometheus_tsdb_retention = prometheus_tsdb_retention
43
+ @prometheus_data_dir = prometheus_data_dir
44
+ @prometheus_data_size = prometheus_data_size
41
45
  end
42
46
 
43
47
  def find
@@ -92,6 +96,7 @@ module Terrafying
92
96
  instances: [{}] * @instances,
93
97
  units: [prometheus_unit, thanos_sidecar_unit],
94
98
  files: [prometheus_conf, thanos_bucket],
99
+ volumes: [prometheus_data_volume],
95
100
  tags: {
96
101
  prometheus_port: 9090,
97
102
  prometheus_path: '/metrics',
@@ -132,29 +137,42 @@ module Terrafying
132
137
  )
133
138
  end
134
139
 
140
+ def prometheus_data_volume
141
+
142
+ {
143
+ name: 'prometheus_data',
144
+ mount: @prometheus_data_dir,
145
+ device: '/dev/xvdl',
146
+ size: @prometheus_data_size,
147
+ }
148
+ end
149
+
135
150
  def prometheus_unit
136
151
  {
137
152
  name: 'prometheus.service',
138
153
  contents: <<~PROM_UNIT
139
154
  [Install]
140
155
  WantedBy=multi-user.target
141
- [Unit]
156
+
157
+ [Unit]
142
158
  Description=Prometheus Service
143
159
  After=docker.service
144
160
  Requires=docker.service
145
- [Service]
161
+
162
+ [Service]
146
163
  ExecStartPre=-/usr/bin/docker network create --driver bridge prom
147
164
  ExecStartPre=-/usr/bin/docker kill prometheus
148
165
  ExecStartPre=-/usr/bin/docker rm prometheus
149
166
  ExecStartPre=/usr/bin/docker pull quay.io/prometheus/prometheus:#{@prom_version}
150
167
  ExecStartPre=-/usr/bin/sed -i "s/{{HOST}}/%H/" /opt/prometheus/prometheus.yml
151
- ExecStartPre=/usr/bin/install -d -o nobody -g nobody -m 0755 /opt/prometheus/data
168
+ ExecStartPre=/usr/bin/install -d -o nobody -g nobody -m 0755 #{@prometheus_data_dir}
152
169
  ExecStart=/usr/bin/docker run --name prometheus \
153
170
  -p 9090:9090 \
154
171
  --network=prom \
155
172
  -v /opt/prometheus:/opt/prometheus \
173
+ -v #{@prometheus_data_dir}:/var/lib/prometheus \
156
174
  quay.io/prometheus/prometheus:#{@prom_version} \
157
- --storage.tsdb.path=/opt/prometheus/data \
175
+ --storage.tsdb.path=/var/lib/prometheus/tsdb \
158
176
  --storage.tsdb.retention.time=#{@prometheus_tsdb_retention} \
159
177
  --storage.tsdb.min-block-duration=2h \
160
178
  --storage.tsdb.max-block-duration=2h \
@@ -178,23 +196,25 @@ module Terrafying
178
196
  contents: <<~THANOS_SIDE
179
197
  [Install]
180
198
  WantedBy=multi-user.target
181
- [Unit]
199
+
200
+ [Unit]
182
201
  Description=Thanos Service
183
202
  After=docker.service prometheus.service
184
203
  Requires=docker.service prometheus.service
185
- [Service]
204
+
205
+ [Service]
186
206
  ExecStartPre=-/usr/bin/docker kill thanos
187
207
  ExecStartPre=-/usr/bin/docker rm thanos
188
208
  ExecStartPre=/usr/bin/docker pull improbable/thanos:#{@thanos_version}
189
209
  ExecStart=/usr/bin/docker run --name thanos \
190
210
  -p 10901-10902:10901-10902 \
191
- -v /opt/prometheus:/opt/prometheus \
211
+ -v #{@prometheus_data_dir}:/var/lib/prometheus \
192
212
  -v /opt/thanos:/opt/thanos \
193
213
  --network=prom \
194
214
  improbable/thanos:#{@thanos_version} \
195
215
  sidecar \
196
216
  --prometheus.url=http://prometheus:9090 \
197
- --tsdb.path=/opt/prometheus/data \
217
+ --tsdb.path=/var/lib/prometheus/tsdb \
198
218
  --objstore.config-file=/opt/thanos/bucket.yml \
199
219
  --log.level=warn
200
220
  Restart=always
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Terrafying
4
4
  module Components
5
- VERSION = '1.12.7'
5
+ VERSION = '1.12.8'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terrafying-components
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.7
4
+ version: 1.12.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - uSwitch Limited
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-06 00:00:00.000000000 Z
11
+ date: 2019-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler