comap 1.0.0 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b23f9e291fe03872cb3ef03ff0f00f659d80aee08457bb1fdcd9cb4e7c0260a
4
- data.tar.gz: 7b959111f7c9eef215b443cd67b3496e9a16527d7cbc64eddbf37cc66a71f3dd
3
+ metadata.gz: e885917505c497f4477f19720189c8adff81b9b3b8870eb0f6cc225cb47d018d
4
+ data.tar.gz: f67e4ce666a834a5fa71626efcbabef15a8cf67ed3ee6ca92fe60cbaabc34048
5
5
  SHA512:
6
- metadata.gz: dcc368e24710b48e06ee5b7e66f478b45c84d604ce2e86b3b071847484d52d905968ce9719b9d43b2f4bd88c86cbf5bcd9ce80c1ebdccdc0738936e672d1cb9f
7
- data.tar.gz: 7581d6850ee0b40422698b9e9a4b6278c5fe60cdd8489742d2cc3137ded4b06cac28c1353086b01ee91f0edb14ef67681a05cd473276b376de257bc933550629
6
+ metadata.gz: 38334bf34297c0441894776f7866ad071ad0397e6913f5919f109ef9552a9e028f5c7992a830a2ed13042570de9a658f2c576ebdcfb378a461c9e41715f4c8c2
7
+ data.tar.gz: 4e46f655d3c12a12e66cbf5c503b1681738b7421b93a4850db9ea7505d29198be8df6af3efddb919570700ba4d894869c62b76c15b79276400f50a3daba1ba6a
@@ -1,56 +1,2 @@
1
- # Template chef 20180209
2
- image: sbernard/arch-kitchen-docker
3
-
4
- before_script:
5
- - bundle install
6
-
7
- variables:
8
- CHECKS_REPO: https://gitlab.com/samuel.bernard/checks/raw/master
9
-
10
- foodcritic:
11
- script:
12
- - bundle exec foodcritic -f any .
13
-
14
- rubocop:
15
- script:
16
- - bundle exec rubocop
17
-
18
- lines_length:
19
- script:
20
- - curl -s $CHECKS_REPO/check_lines_length.sh | bash
21
-
22
- git_history:
23
- script:
24
- - curl -s $CHECKS_REPO/check_git_history.sh | bash
25
-
26
- rspec:
27
- script:
28
- - bundle exec rspec
29
-
30
- kitchen:
31
- retry: 2
32
- tags:
33
- - docker
34
- before_script:
35
- - >
36
- curl -s $CHECKS_REPO/Gemfile_patches | while read line; do
37
- if ! cat Gemfile | grep "$line"; then
38
- echo "$line" >> Gemfile
39
- fi
40
- done
41
- - bundle install
42
- # Mount host kernel modules which may be needed by docker
43
- - mkdir -p /mnt/host
44
- - mount /dev/dm-0 /mnt/host
45
- - ln -s /mnt/host/lib/modules /lib/modules
46
- - if [ ! -e /var/run/docker.sock ]; then DOCKER_DRIVER=vfs dockerd & fi
47
- # On shared runner running coreos, we need to add privileged in driver
48
- # for centos and debian images. This may change in the future
49
- - 'if uname -r | grep "coreos" > /dev/null; then
50
- sed -i "/^driver:/a\\ \\ privileged: true" .kitchen.yml; fi'
51
- script:
52
- - >
53
- imgs="$(bundle exec kitchen diagnose | grep '^ image:' | \
54
- cut -d':' -f2 | uniq)";
55
- for image in $imgs; do docker pull $image; done
56
- - bundle exec kitchen test -c -d always
1
+ include:
2
+ - https://gitlab.com/chef-platform/test-cookbook/raw/master/.gitlab-ci.yml
@@ -76,13 +76,14 @@ suites:
76
76
  - /sys/fs/cgroup:/sys/fs/cgroup:ro
77
77
  - /lib/modules:/lib/modules:ro
78
78
  run_list:
79
+ - recipe[comap-test::prepare_docker]
79
80
  - recipe[docker-platform]
80
81
  - recipe[comap-test::build_comap]
81
82
  - recipe[comap-test::launch_comap]
82
83
  attributes:
83
84
  docker-platform:
84
85
  config:
85
- storage-driver: vfs
86
+ storage-driver: overlay2
86
87
  data_bag:
87
88
  item: docker-platform-kitchen
88
89
  swarm:
@@ -106,12 +107,13 @@ suites:
106
107
  - /sys/fs/cgroup:/sys/fs/cgroup:ro
107
108
  - /lib/modules:/lib/modules:ro
108
109
  run_list:
110
+ - recipe[comap-test::prepare_docker]
109
111
  - recipe[docker-platform]
110
112
  - recipe[comap-test::build_comap]
111
113
  attributes:
112
114
  docker-platform:
113
115
  config:
114
- storage-driver: vfs
116
+ storage-driver: overlay2
115
117
  data_bag:
116
118
  item: docker-platform-kitchen
117
119
  swarm:
@@ -1,6 +1,29 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 1.1.0
5
+ -----
6
+
7
+ Main:
8
+
9
+ - feat: enable compression with Rack::Deflater
10
+ - fix: handle spaces in labels
11
+ - feat: handle service in global mode
12
+
13
+ Tests:
14
+
15
+ - test: include .gitlab-ci.yml from test-cookbook
16
+ - test: use a tmpfs for internal /var/lib/docker
17
+ - test: build comap image with network host
18
+ - test: update test dependencies
19
+
20
+ Misc:
21
+
22
+ - chore: set generic maintainer & helpdesk email
23
+ - doc: fix default port in README
24
+ - style(rubocop): fix expand\_path offense
25
+ - doc: use doc in git message instead of docs
26
+
4
27
  1.0.0
5
28
  -----
6
29
 
@@ -35,7 +35,7 @@ Allowed <type> values:
35
35
 
36
36
  - feat (new feature for the user, not a new feature for build script)
37
37
  - fix (bug fix for the user, not a fix to a build script)
38
- - docs (changes to the documentation)
38
+ - doc (changes to the documentation)
39
39
  - style (formatting, missing semi colons, etc; no production code change)
40
40
  - refactor (refactoring production code, eg. renaming a variable)
41
41
  - test (adding missing tests, refactoring tests; no production code change)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- comap (1.0.0)
4
+ comap (1.1.0)
5
5
  faraday (~> 0.13)
6
6
  json (~> 2.0)
7
7
  thin (~> 1.7)
@@ -12,57 +12,42 @@ GEM
12
12
  addressable (2.5.2)
13
13
  public_suffix (>= 2.0.2, < 4.0)
14
14
  ast (2.4.0)
15
- backports (3.11.1)
16
- berkshelf (6.3.1)
17
- buff-config (~> 2.0)
18
- buff-extensions (~> 2.0)
19
- chef (>= 12.7.2)
15
+ backports (3.11.3)
16
+ berkshelf (7.0.4)
17
+ chef (>= 13.6.52)
18
+ chef-config
20
19
  cleanroom (~> 1.0)
21
20
  concurrent-ruby (~> 1.0)
22
- faraday (~> 0.9)
23
- httpclient (~> 2.7)
24
- minitar (~> 0.5, >= 0.5.4)
21
+ minitar (>= 0.6)
25
22
  mixlib-archive (~> 0.4)
23
+ mixlib-config (>= 2.2.5)
26
24
  mixlib-shellout (~> 2.0)
27
25
  octokit (~> 4.0)
28
26
  retryable (~> 2.0)
29
- ridley (~> 5.0)
30
27
  solve (~> 4.0)
31
- thor (~> 0.19, < 0.19.2)
32
- buff-config (2.0.0)
33
- buff-extensions (~> 2.0)
34
- varia_model (~> 0.6)
35
- buff-extensions (2.0.0)
36
- buff-ignore (1.2.0)
37
- buff-ruby_engine (1.0.0)
38
- buff-shell_out (1.1.0)
39
- buff-ruby_engine (~> 1.0)
28
+ thor (>= 0.20)
40
29
  builder (3.2.3)
41
- celluloid (0.16.0)
42
- timers (~> 4.0.0)
43
- celluloid-io (0.16.2)
44
- celluloid (>= 0.16.0)
45
- nio4r (>= 1.1.0)
46
- chef (13.7.16)
30
+ chef (14.2.0)
47
31
  addressable
48
32
  bundler (>= 1.10)
49
- chef-config (= 13.7.16)
33
+ chef-config (= 14.2.0)
50
34
  chef-zero (>= 13.0)
51
35
  diff-lcs (~> 1.2, >= 1.2.4)
52
36
  erubis (~> 2.7)
37
+ ffi (~> 1.9, >= 1.9.25)
53
38
  ffi-yajl (~> 2.2)
54
39
  highline (~> 1.6, >= 1.6.9)
55
40
  iniparse (~> 1.4)
56
41
  iso8601 (~> 0.9.1)
57
42
  mixlib-archive (~> 0.4)
58
- mixlib-authentication (~> 1.4)
43
+ mixlib-authentication (~> 2.1)
59
44
  mixlib-cli (~> 1.7)
60
- mixlib-log (~> 1.3)
45
+ mixlib-log (~> 2.0, >= 2.0.3)
61
46
  mixlib-shellout (~> 2.0)
62
47
  net-sftp (~> 2.1, >= 2.1.2)
63
- net-ssh (>= 2.9, < 5.0)
48
+ net-ssh (~> 4.2)
64
49
  net-ssh-multi (~> 1.2, >= 1.2.1)
65
- ohai (~> 13.0)
50
+ ohai (~> 14.0)
66
51
  plist (~> 3.2)
67
52
  proxifier (~> 1.0)
68
53
  rspec-core (~> 3.5)
@@ -73,16 +58,16 @@ GEM
73
58
  specinfra (~> 2.10)
74
59
  syslog-logger (~> 1.6)
75
60
  uuidtools (~> 2.1.5)
76
- chef-config (13.7.16)
61
+ chef-config (14.2.0)
77
62
  addressable
78
63
  fuzzyurl
79
64
  mixlib-config (~> 2.0)
80
65
  mixlib-shellout (~> 2.0)
81
66
  tomlrb (~> 1.2)
82
- chef-zero (13.1.0)
67
+ chef-zero (14.0.6)
83
68
  ffi-yajl (~> 2.2)
84
69
  hashie (>= 2.0, < 4.0)
85
- mixlib-log (~> 1.3)
70
+ mixlib-log (~> 2.0)
86
71
  rack (~> 2.0)
87
72
  uuidtools (~> 2.1)
88
73
  cleanroom (1.0.0)
@@ -97,13 +82,13 @@ GEM
97
82
  daemons (1.2.6)
98
83
  diff-lcs (1.3)
99
84
  erubis (2.7.0)
100
- eventmachine (1.2.5)
101
- faraday (0.14.0)
85
+ eventmachine (1.2.7)
86
+ faraday (0.15.2)
102
87
  multipart-post (>= 1.2, < 3)
103
- ffi (1.9.18)
88
+ ffi (1.9.25)
104
89
  ffi-yajl (2.3.1)
105
90
  libyajl2 (~> 1.2)
106
- foodcritic (12.3.0)
91
+ foodcritic (14.0.0)
107
92
  cucumber-core (>= 1.3)
108
93
  erubis
109
94
  ffi-yajl (~> 2.0)
@@ -112,7 +97,7 @@ GEM
112
97
  rufus-lru (~> 1.0)
113
98
  treetop (~> 1.4)
114
99
  fuzzyurl (0.9.0)
115
- gherkin (5.0.0)
100
+ gherkin (5.1.0)
116
101
  gssapi (1.2.0)
117
102
  ffi (>= 1.0.1)
118
103
  gyoku (1.3.1)
@@ -120,13 +105,13 @@ GEM
120
105
  hashdiff (0.3.7)
121
106
  hashie (3.5.7)
122
107
  highline (1.7.10)
123
- hitimes (1.2.6)
124
108
  httpclient (2.8.3)
125
109
  iniparse (1.4.4)
126
110
  ipaddress (0.8.3)
127
111
  iso8601 (0.9.1)
112
+ jaro_winkler (1.5.1)
128
113
  json (2.1.0)
129
- kitchen-docker_cli (0.18.0)
114
+ kitchen-docker_cli (0.19.0)
130
115
  test-kitchen (>= 1.3)
131
116
  libyajl2 (1.2.0)
132
117
  little-plugger (1.1.4)
@@ -135,19 +120,20 @@ GEM
135
120
  multi_json (~> 1.10)
136
121
  mini_portile2 (2.3.0)
137
122
  minitar (0.6.1)
138
- mixlib-archive (0.4.1)
123
+ mixlib-archive (0.4.8)
139
124
  mixlib-log
140
- mixlib-authentication (1.4.2)
125
+ mixlib-authentication (2.1.1)
141
126
  mixlib-cli (1.7.0)
142
- mixlib-config (2.2.4)
143
- mixlib-install (3.9.0)
127
+ mixlib-config (2.2.8)
128
+ tomlrb
129
+ mixlib-install (3.10.0)
144
130
  mixlib-shellout
145
131
  mixlib-versioning
146
132
  thor
147
- mixlib-log (1.7.1)
133
+ mixlib-log (2.0.4)
148
134
  mixlib-shellout (2.3.2)
149
135
  mixlib-versioning (1.2.2)
150
- molinillo (0.6.4)
136
+ molinillo (0.6.5)
151
137
  multi_json (1.13.1)
152
138
  multipart-post (2.0.0)
153
139
  net-scp (1.2.1)
@@ -161,54 +147,35 @@ GEM
161
147
  net-ssh (>= 2.6.5)
162
148
  net-ssh-gateway (>= 1.2.0)
163
149
  net-telnet (0.1.1)
164
- nio4r (2.2.0)
165
- nokogiri (1.8.2)
150
+ nokogiri (1.8.3)
166
151
  mini_portile2 (~> 2.3.0)
167
152
  nori (2.6.0)
168
- octokit (4.8.0)
153
+ octokit (4.9.0)
169
154
  sawyer (~> 0.8.0, >= 0.5.3)
170
- ohai (13.7.1)
171
- chef-config (>= 12.5.0.alpha.1, < 14)
155
+ ohai (14.2.0)
156
+ chef-config (>= 12.8, < 15)
172
157
  ffi (~> 1.9)
173
158
  ffi-yajl (~> 2.2)
174
159
  ipaddress
175
160
  mixlib-cli
176
161
  mixlib-config (~> 2.0)
177
- mixlib-log (>= 1.7.1, < 2.0)
162
+ mixlib-log (~> 2.0, >= 2.0.1)
178
163
  mixlib-shellout (~> 2.0)
179
164
  plist (~> 3.1)
180
165
  systemu (~> 2.6.4)
181
166
  wmi-lite (~> 1.0)
182
167
  parallel (1.12.1)
183
- parser (2.4.0.2)
184
- ast (~> 2.3)
168
+ parser (2.5.1.0)
169
+ ast (~> 2.4.0)
185
170
  plist (3.4.0)
186
171
  polyglot (0.3.5)
187
- powerpack (0.1.1)
172
+ powerpack (0.1.2)
188
173
  proxifier (1.0.3)
189
- public_suffix (3.0.1)
190
- rack (2.0.3)
174
+ public_suffix (3.0.2)
175
+ rack (2.0.5)
191
176
  rainbow (3.0.0)
192
- rake (12.3.0)
177
+ rake (12.3.1)
193
178
  retryable (2.0.4)
194
- ridley (5.1.1)
195
- addressable
196
- buff-config (~> 2.0)
197
- buff-extensions (~> 2.0)
198
- buff-ignore (~> 1.2)
199
- buff-shell_out (~> 1.0)
200
- celluloid (~> 0.16.0)
201
- celluloid-io (~> 0.16.1)
202
- chef-config (>= 12.5.0)
203
- erubis
204
- faraday (~> 0.9)
205
- hashie (>= 2.0.2, < 4.0.0)
206
- httpclient (~> 2.7)
207
- json (>= 1.7.7)
208
- mixlib-authentication (>= 1.3.0)
209
- retryable (~> 2.0)
210
- semverse (~> 2.0)
211
- varia_model (~> 0.6)
212
179
  rspec (3.7.0)
213
180
  rspec-core (~> 3.7.0)
214
181
  rspec-expectations (~> 3.7.0)
@@ -224,13 +191,14 @@ GEM
224
191
  rspec-mocks (3.7.0)
225
192
  diff-lcs (>= 1.2.0, < 2.0)
226
193
  rspec-support (~> 3.7.0)
227
- rspec-support (3.7.0)
194
+ rspec-support (3.7.1)
228
195
  rspec_junit_formatter (0.2.3)
229
196
  builder (< 4)
230
197
  rspec-core (>= 2, < 4, != 2.12.0)
231
- rubocop (0.52.1)
198
+ rubocop (0.57.2)
199
+ jaro_winkler (~> 1.5.1)
232
200
  parallel (~> 1.10)
233
- parser (>= 2.4.0.2, < 3.0)
201
+ parser (>= 2.5)
234
202
  powerpack (~> 0.1)
235
203
  rainbow (>= 2.2.2, < 4.0)
236
204
  ruby-progressbar (~> 1.7)
@@ -253,38 +221,33 @@ GEM
253
221
  solve (4.0.0)
254
222
  molinillo (~> 0.6)
255
223
  semverse (>= 1.1, < 3.0)
256
- specinfra (2.73.1)
224
+ specinfra (2.73.4)
257
225
  net-scp
258
226
  net-ssh (>= 2.7, < 5.0)
259
227
  net-telnet
260
228
  sfl
261
229
  syslog-logger (1.6.8)
262
230
  systemu (2.6.5)
263
- test-kitchen (1.20.0)
231
+ test-kitchen (1.22.0)
264
232
  mixlib-install (~> 3.6)
265
233
  mixlib-shellout (>= 1.2, < 3.0)
266
234
  net-scp (~> 1.1)
267
235
  net-ssh (>= 2.9, < 5.0)
268
236
  net-ssh-gateway (~> 1.2)
269
- thor (~> 0.19, < 0.19.2)
237
+ thor (~> 0.19)
270
238
  winrm (~> 2.0)
271
239
  winrm-elevated (~> 1.0)
272
- winrm-fs (~> 1.1.0)
240
+ winrm-fs (~> 1.1)
273
241
  thin (1.7.2)
274
242
  daemons (~> 1.0, >= 1.0.9)
275
243
  eventmachine (~> 1.0, >= 1.0.4)
276
244
  rack (>= 1, < 3)
277
- thor (0.19.1)
278
- timers (4.0.4)
279
- hitimes
280
- tomlrb (1.2.6)
281
- treetop (1.6.9)
245
+ thor (0.20.0)
246
+ tomlrb (1.2.7)
247
+ treetop (1.6.10)
282
248
  polyglot (~> 0.3)
283
- unicode-display_width (1.3.0)
249
+ unicode-display_width (1.4.0)
284
250
  uuidtools (2.1.5)
285
- varia_model (0.6.0)
286
- buff-extensions (~> 2.0)
287
- hashie (>= 2.0.2, < 4.0.0)
288
251
  webmock (2.3.2)
289
252
  addressable (>= 2.3.6)
290
253
  crack (>= 0.3.2)
@@ -301,7 +264,7 @@ GEM
301
264
  winrm-elevated (1.1.0)
302
265
  winrm (~> 2.0)
303
266
  winrm-fs (~> 1.0)
304
- winrm-fs (1.1.1)
267
+ winrm-fs (1.2.0)
305
268
  erubis (~> 2.7)
306
269
  logging (>= 1.6.1, < 3.0)
307
270
  rubyzip (~> 1.1)
@@ -324,4 +287,4 @@ DEPENDENCIES
324
287
  webmock (~> 2.0)
325
288
 
326
289
  BUNDLED WITH
327
- 1.16.1
290
+ 1.16.2
data/README.md CHANGED
@@ -15,7 +15,7 @@ services it follows.
15
15
  A *container* label is added to each metric with the original container name.
16
16
 
17
17
  Aggregated metrics intended to be fetched as a target by Prometheus are exposed
18
- on port 9417.
18
+ on port 9397.
19
19
 
20
20
  Installation
21
21
  ------------
@@ -17,7 +17,7 @@
17
17
 
18
18
  # coding:utf-8
19
19
 
20
- lib = File.expand_path('../lib', __FILE__)
20
+ lib = File.expand_path('lib', __dir__)
21
21
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
22
22
  require 'comap/version'
23
23
 
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.name = 'comap'
26
26
  spec.version = COMAP::VERSION
27
27
  spec.authors = ['Sylvain Arrambourg', 'Samuel Bernard']
28
- spec.email = ['sar@make.org']
28
+ spec.email = ['incoming+sre-gems/comap@incoming.gitlab.com']
29
29
  spec.license = 'Apache-2.0'
30
30
 
31
31
  spec.summary =
@@ -81,7 +81,14 @@ module COMAP
81
81
  end
82
82
  end
83
83
 
84
- # rubocop:disable Metrics/MethodLength
84
+ def app
85
+ config = @config
86
+ Rack::Builder.new do
87
+ use Rack::Deflater
88
+ run COMAP::App.new(config)
89
+ end
90
+ end
91
+
85
92
  def start(args = ARGV)
86
93
  @config = {
87
94
  docker_host: 'http://127.0.0.1',
@@ -92,9 +99,7 @@ module COMAP
92
99
  services: args
93
100
  }
94
101
  parse_opts
95
- app = COMAP::App.new(@config)
96
102
  Rack::Server.start(app: app, Host: '0.0.0.0', Port: 9397)
97
103
  end
98
104
  end
99
- # rubocop:enable Metrics/MethodLength
100
105
  end
@@ -21,7 +21,7 @@ require 'openssl'
21
21
  # Main module
22
22
  module COMAP
23
23
  # Rack App
24
- class App
24
+ class App # rubocop:disable Metrics/ClassLength
25
25
  # rubocop:disable Metrics/ParameterLists
26
26
  def initialize(
27
27
  docker_host: 'http://127.0.0.1',
@@ -85,13 +85,17 @@ module COMAP
85
85
 
86
86
  def add_label(line, label)
87
87
  replace = %(container="#{label}")
88
- line.sub(/ /, "{#{replace}} ").sub(/}{/, ',')
88
+ if line[/{.*?\}/].nil?
89
+ line.sub(/ /, "{#{replace}} ")
90
+ else
91
+ line.sub(/(\{(.*)\})/, "{\\2,#{replace}}")
92
+ end
89
93
  end
90
94
 
91
95
  def containers(service)
92
96
  running_tasks(service).map do |task|
93
97
  {
94
- 'slot' => task['Slot'],
98
+ 'slot' => task['Slot'] || task['NodeID'],
95
99
  'ip' => ip(task).split('/').first
96
100
  }
97
101
  end.uniq
@@ -17,5 +17,5 @@
17
17
 
18
18
  # Define version
19
19
  module COMAP
20
- VERSION = '1.0.0'
20
+ VERSION = '1.1.0'
21
21
  end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  name 'comap-test'
4
- maintainer 'Make.org'
5
- maintainer_email 'sre@make.org'
4
+ maintainer 'SRE Gems'
5
+ maintainer_email 'incoming+sre-gems/comap@incoming.gitlab.com'
6
6
  license 'Apache-2.0'
7
7
  description 'Integration tests for Comap'
8
8
  long_description 'Integration tests for Comap'
@@ -29,7 +29,7 @@ cookbook_file '/root/pkg/comap.gem' do
29
29
  end
30
30
 
31
31
  execute 'docker build comap' do
32
- command 'docker build . -t makeorg/comap-for-kitchen-test'
32
+ command 'docker build --network host . -t makeorg/comap-for-kitchen-test'
33
33
  cwd '/root'
34
34
  action :nothing
35
35
  end
@@ -30,7 +30,7 @@ metrics_content = <<~CONTENT
30
30
  metrics_sample_2_seconds 24
31
31
  CONTENT
32
32
 
33
- docker_platform_service 'metrics' do
33
+ docker_platform_service 'metrics-replicated' do
34
34
  options(
35
35
  mode: 'replicated',
36
36
  replicas: 2,
@@ -42,6 +42,17 @@ docker_platform_service 'metrics' do
42
42
  action :create
43
43
  end
44
44
 
45
+ docker_platform_service 'metrics-global' do
46
+ options(
47
+ mode: 'global',
48
+ network: 'kitchen',
49
+ publish: '5679:5678'
50
+ )
51
+ image 'hashicorp/http-echo'
52
+ command "-text '#{metrics_content.chomp("\n")}'"
53
+ action :create
54
+ end
55
+
45
56
  server = 'https://comap-swarm-manager-centos-7'
46
57
  ssl = {
47
58
  'client_cert' => '/run/secrets/cert.pem',
@@ -49,15 +60,20 @@ ssl = {
49
60
  'ca_file' => '/run/secrets/ca.pem'
50
61
  }
51
62
  ssl_opt = ssl.map { |k, v| "#{k}=#{v}" }.join(',')
52
-
53
- docker_platform_service 'comap' do
54
- options(
55
- mode: 'replicated',
56
- network: 'kitchen',
57
- publish: '9397:9397',
58
- secret: %w[cert.pem key.pem ca.pem]
59
- )
60
- image 'makeorg/comap-for-kitchen-test'
61
- command "-H #{server} -p 2376 -s #{ssl_opt} -n kitchen metrics:5678"
62
- action :create
63
+ {
64
+ 'replicated' => '9397',
65
+ 'global' => '9398'
66
+ }.each_pair do |mode, port|
67
+ docker_platform_service "comap-#{mode}" do
68
+ options(
69
+ mode: 'replicated',
70
+ network: 'kitchen',
71
+ publish: "#{port}:9397",
72
+ secret: %w[cert.pem key.pem ca.pem]
73
+ )
74
+ image 'makeorg/comap-for-kitchen-test'
75
+ command "-H #{server} -p 2376 -s #{ssl_opt} "\
76
+ "-n kitchen metrics-#{mode}:5678"
77
+ action :create
78
+ end
63
79
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2018 Make.org
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ # Create a tmpfs for a fast docker
19
+ execute 'create /var/lib/docker as tmpfs' do
20
+ command 'mkdir -p /var/lib/docker && '\
21
+ 'mount -t tmpfs -o size=1500M tmpfs /var/lib/docker'
22
+ creates '/var/lib/docker'
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Arrambourg
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-02-21 00:00:00.000000000 Z
12
+ date: 2018-07-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -125,7 +125,7 @@ dependencies:
125
125
  version: '1.7'
126
126
  description: Container Orchestrator Metrics Aggregator for Prometheus
127
127
  email:
128
- - sar@make.org
128
+ - incoming+sre-gems/comap@incoming.gitlab.com
129
129
  executables:
130
130
  - comap
131
131
  extensions: []
@@ -157,6 +157,7 @@ files:
157
157
  - metadata.rb
158
158
  - recipes/build_comap.rb
159
159
  - recipes/launch_comap.rb
160
+ - recipes/prepare_docker.rb
160
161
  homepage: https://gitlab.com/sre-gems/comap
161
162
  licenses:
162
163
  - Apache-2.0
@@ -177,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
178
  version: '0'
178
179
  requirements: []
179
180
  rubyforge_project:
180
- rubygems_version: 2.7.3
181
+ rubygems_version: 2.7.7
181
182
  signing_key:
182
183
  specification_version: 4
183
184
  summary: Container Orchestrator Metrics Aggregator for Prometheus