terrafying-components 1.12.7 → 1.12.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/terrafying/components/prometheus.rb +29 -9
- data/lib/terrafying/components/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 54520cd03f620415fec047fba8561400088b58aeec4d1941590362b7d6d1b066
|
|
4
|
+
data.tar.gz: 0607b8d938affc570cf680437ec2de165854071c7d07691ad23d3fcb1f773ceb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
156
|
+
|
|
157
|
+
[Unit]
|
|
142
158
|
Description=Prometheus Service
|
|
143
159
|
After=docker.service
|
|
144
160
|
Requires=docker.service
|
|
145
|
-
|
|
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
|
|
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=/
|
|
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
|
-
|
|
199
|
+
|
|
200
|
+
[Unit]
|
|
182
201
|
Description=Thanos Service
|
|
183
202
|
After=docker.service prometheus.service
|
|
184
203
|
Requires=docker.service prometheus.service
|
|
185
|
-
|
|
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 /
|
|
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=/
|
|
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
|
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.
|
|
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-
|
|
11
|
+
date: 2019-06-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|