bigrig 0.5.0 → 0.6.0

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
  SHA1:
3
- metadata.gz: 7efe9f59950d19fdb1cdf53db16d27936f113506
4
- data.tar.gz: 0b7009c17a3ac7afb42c453dce0c07a2a2002806
3
+ metadata.gz: 0cf7a6ed2dd2713e0fd26254356a17536be2e1b8
4
+ data.tar.gz: 65598d447d8baacc214190c42ea01a6447cab882
5
5
  SHA512:
6
- metadata.gz: efc06d73bb0ef865abbe7a66b37194ea77f946cf2833c3206cb4c8f9655d64e90e355041f6bfe6c53ba483fa58314e9ce1326404d9f2e0b605fabec04a03c166
7
- data.tar.gz: dce81ac7df035ba0e1135e6ecc532253772fd302b5e602c1334a37a5b8148d1364538b1b9a1181be51830e463e5f057556719d189c144a584ba042938cc6107a
6
+ metadata.gz: 112e51ae1834d5569e360284e14fbc460d7dfe6391ac536fe2e30158077c92dd854f6fc24fe38402ce9f20e44488dfc271f7109177bb7aa37a4c21052e792554
7
+ data.tar.gz: f162fc6323777c3cbdcc07c5a94f54ce23ba320d3cac971c3061c3e3b47c968bb53d7537ad6eb4e41a05c7b3a17fb0c8af4de5f4b10fe79120de4f80464b74db
data/CHANGELOG.md CHANGED
@@ -69,3 +69,7 @@ Add `volumes` attriute
69
69
  **BREAKING CHANGE**
70
70
  * removed wait_for from bigrig.json. We now wait for the script at
71
71
  `/bigrig-wait.sh`, if present
72
+
73
+ 0.6.0
74
+ =====
75
+ * Set container hostname based on container hostname
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bigrig (0.5.0)
4
+ bigrig (0.6.0)
5
5
  colorize (= 0.7.5)
6
6
  docker-api (= 1.21.4)
7
7
  filewatcher (= 0.4.0)
@@ -1,4 +1,5 @@
1
1
  require 'docker'
2
+ require 'socket'
2
3
 
3
4
  Excon.defaults[:ssl_verify_peer] = false
4
5
  Excon.defaults[:read_timeout] = 3600
@@ -106,6 +107,7 @@ module Bigrig
106
107
  def create_container(args)
107
108
  Docker::Container.create(
108
109
  'Env' => (args[:env] || {}).map { |n, v| "#{n}=#{v}" },
110
+ 'Hostname' => "#{Socket.gethostname}-DOCKER-#{args[:name]}",
109
111
  'Image' => args[:image_id],
110
112
  'name' => args[:name],
111
113
  'ExposedPorts' => exposed_ports(args[:ports])
@@ -1,3 +1,3 @@
1
1
  module Bigrig
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'
3
3
  end
@@ -292,6 +292,11 @@ module Bigrig
292
292
 
293
293
  # strip the leading '/' from the json name
294
294
  let(:container_name) { container.json['Name'][1..-1] }
295
+ let(:container_hostname) { container.json['Config']['Hostname'] }
296
+
297
+ before do
298
+ allow(Socket).to receive(:gethostname).and_return 'hostname'
299
+ end
295
300
 
296
301
  after { Docker::Container.get(name).kill!.delete }
297
302
 
@@ -299,6 +304,10 @@ module Bigrig
299
304
  expect(running?).to be true
300
305
  expect(container_name).to eq name
301
306
  end
307
+
308
+ it 'sets the hostname', :vcr do
309
+ expect(container_hostname).to eq 'hostname-DOCKER-and_a_name'
310
+ end
302
311
  end
303
312
 
304
313
  context 'and a name and ports' do
@@ -0,0 +1,178 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: "<DOCKER_HOST>/v1.16/containers/create?name=and_a_name"
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"Env":[],"Hostname":"hostname-DOCKER-and_a_name","Image":"hawknewton/show-env","ExposedPorts":{}}'
9
+ headers:
10
+ User-Agent:
11
+ - Swipely/Docker-API 1.21.4
12
+ Content-Type:
13
+ - application/json
14
+ response:
15
+ status:
16
+ code: 201
17
+ message:
18
+ headers:
19
+ Content-Type:
20
+ - application/json
21
+ Date:
22
+ - Fri, 12 Jun 2015 00:42:49 GMT
23
+ Content-Length:
24
+ - '90'
25
+ body:
26
+ encoding: UTF-8
27
+ string: |
28
+ {"Id":"47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc","Warnings":null}
29
+ http_version:
30
+ recorded_at: Fri, 12 Jun 2015 00:42:49 GMT
31
+ - request:
32
+ method: post
33
+ uri: "<DOCKER_HOST>/v1.16/containers/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc/start"
34
+ body:
35
+ encoding: UTF-8
36
+ string: '{"Links":null,"ExtraHosts":[],"PortBindings":{},"VolumesFrom":null,"Binds":null}'
37
+ headers:
38
+ User-Agent:
39
+ - Swipely/Docker-API 1.21.4
40
+ Content-Type:
41
+ - application/json
42
+ response:
43
+ status:
44
+ code: 204
45
+ message:
46
+ headers:
47
+ Date:
48
+ - Fri, 12 Jun 2015 00:42:49 GMT
49
+ body:
50
+ encoding: UTF-8
51
+ string: ''
52
+ http_version:
53
+ recorded_at: Fri, 12 Jun 2015 00:42:49 GMT
54
+ - request:
55
+ method: get
56
+ uri: "<DOCKER_HOST>/v1.16/containers/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc/json"
57
+ body:
58
+ encoding: US-ASCII
59
+ string: ''
60
+ headers:
61
+ User-Agent:
62
+ - Swipely/Docker-API 1.21.4
63
+ Content-Type:
64
+ - text/plain
65
+ response:
66
+ status:
67
+ code: 200
68
+ message:
69
+ headers:
70
+ Content-Type:
71
+ - application/json
72
+ Date:
73
+ - Fri, 12 Jun 2015 00:42:49 GMT
74
+ body:
75
+ encoding: UTF-8
76
+ string: |
77
+ {"AppArmorProfile":"","Args":["-c","ruby /code/server.rb"],"Config":{"AttachStderr":false,"AttachStdin":false,"AttachStdout":false,"Cmd":null,"CpuShares":0,"Cpuset":"","Domainname":"","Entrypoint":["/bin/sh","-c","ruby /code/server.rb"],"Env":["PATH=/usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","RUBY_MAJOR=2.1","RUBY_VERSION=2.1.3","GEM_HOME=/usr/local/bundle","BUNDLE_APP_CONFIG=/usr/local/bundle"],"ExposedPorts":{"80/tcp":{}},"Hostname":"hostname-DOCKER-and_a_name","Image":"hawknewton/show-env","Labels":{},"MacAddress":"","Memory":0,"MemorySwap":0,"NetworkDisabled":false,"OnBuild":null,"OpenStdin":false,"PortSpecs":null,"StdinOnce":false,"Tty":false,"User":"","Volumes":null,"WorkingDir":""},"Created":"2015-06-12T00:42:49.330021216Z","Driver":"aufs","ExecDriver":"native-0.2","ExecIDs":null,"HostConfig":{"Binds":null,"CapAdd":null,"CapDrop":null,"CgroupParent":"","ContainerIDFile":"","CpuShares":0,"CpusetCpus":"","Devices":null,"Dns":null,"DnsSearch":null,"ExtraHosts":[],"IpcMode":"","Links":null,"LogConfig":{"Config":null,"Type":"json-file"},"LxcConf":null,"Memory":0,"MemorySwap":0,"NetworkMode":"","PidMode":"","PortBindings":{},"Privileged":false,"PublishAllPorts":false,"ReadonlyRootfs":false,"RestartPolicy":{"MaximumRetryCount":0,"Name":""},"SecurityOpt":null,"Ulimits":null,"VolumesFrom":null},"HostnamePath":"/mnt/sda1/var/lib/docker/containers/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc/hostname","HostsPath":"/mnt/sda1/var/lib/docker/containers/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc/hosts","Id":"47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc","Image":"b9c5be3a918d80b0d898ed8eca3fc76f75c482b531238e539cb00f75bb4e12d2","LogPath":"/mnt/sda1/var/lib/docker/containers/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc-json.log","MountLabel":"","Name":"/and_a_name","NetworkSettings":{"Bridge":"docker0","Gateway":"172.17.42.1","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"IPAddress":"172.17.1.188","IPPrefixLen":16,"IPv6Gateway":"","LinkLocalIPv6Address":"fe80::42:acff:fe11:1bc","LinkLocalIPv6PrefixLen":64,"MacAddress":"02:42:ac:11:01:bc","PortMapping":null,"Ports":{"80/tcp":null}},"Path":"/bin/sh","ProcessLabel":"","ResolvConfPath":"/mnt/sda1/var/lib/docker/containers/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc/resolv.conf","RestartCount":0,"State":{"Dead":false,"Error":"","ExitCode":0,"FinishedAt":"0001-01-01T00:00:00Z","OOMKilled":false,"Paused":false,"Pid":13813,"Restarting":false,"Running":true,"StartedAt":"2015-06-12T00:42:49.716092538Z"},"Volumes":{},"VolumesRW":{}}
78
+ http_version:
79
+ recorded_at: Fri, 12 Jun 2015 00:42:49 GMT
80
+ - request:
81
+ method: get
82
+ uri: "<DOCKER_HOST>/v1.16/containers/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc/json"
83
+ body:
84
+ encoding: US-ASCII
85
+ string: ''
86
+ headers:
87
+ User-Agent:
88
+ - Swipely/Docker-API 1.21.4
89
+ Content-Type:
90
+ - text/plain
91
+ response:
92
+ status:
93
+ code: 200
94
+ message:
95
+ headers:
96
+ Content-Type:
97
+ - application/json
98
+ Date:
99
+ - Fri, 12 Jun 2015 00:42:49 GMT
100
+ body:
101
+ encoding: UTF-8
102
+ string: |
103
+ {"AppArmorProfile":"","Args":["-c","ruby /code/server.rb"],"Config":{"AttachStderr":false,"AttachStdin":false,"AttachStdout":false,"Cmd":null,"CpuShares":0,"Cpuset":"","Domainname":"","Entrypoint":["/bin/sh","-c","ruby /code/server.rb"],"Env":["PATH=/usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","RUBY_MAJOR=2.1","RUBY_VERSION=2.1.3","GEM_HOME=/usr/local/bundle","BUNDLE_APP_CONFIG=/usr/local/bundle"],"ExposedPorts":{"80/tcp":{}},"Hostname":"hostname-DOCKER-and_a_name","Image":"hawknewton/show-env","Labels":{},"MacAddress":"","Memory":0,"MemorySwap":0,"NetworkDisabled":false,"OnBuild":null,"OpenStdin":false,"PortSpecs":null,"StdinOnce":false,"Tty":false,"User":"","Volumes":null,"WorkingDir":""},"Created":"2015-06-12T00:42:49.330021216Z","Driver":"aufs","ExecDriver":"native-0.2","ExecIDs":null,"HostConfig":{"Binds":null,"CapAdd":null,"CapDrop":null,"CgroupParent":"","ContainerIDFile":"","CpuShares":0,"CpusetCpus":"","Devices":null,"Dns":null,"DnsSearch":null,"ExtraHosts":[],"IpcMode":"","Links":null,"LogConfig":{"Config":null,"Type":"json-file"},"LxcConf":null,"Memory":0,"MemorySwap":0,"NetworkMode":"","PidMode":"","PortBindings":{},"Privileged":false,"PublishAllPorts":false,"ReadonlyRootfs":false,"RestartPolicy":{"MaximumRetryCount":0,"Name":""},"SecurityOpt":null,"Ulimits":null,"VolumesFrom":null},"HostnamePath":"/mnt/sda1/var/lib/docker/containers/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc/hostname","HostsPath":"/mnt/sda1/var/lib/docker/containers/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc/hosts","Id":"47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc","Image":"b9c5be3a918d80b0d898ed8eca3fc76f75c482b531238e539cb00f75bb4e12d2","LogPath":"/mnt/sda1/var/lib/docker/containers/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc-json.log","MountLabel":"","Name":"/and_a_name","NetworkSettings":{"Bridge":"docker0","Gateway":"172.17.42.1","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"IPAddress":"172.17.1.188","IPPrefixLen":16,"IPv6Gateway":"","LinkLocalIPv6Address":"fe80::42:acff:fe11:1bc","LinkLocalIPv6PrefixLen":64,"MacAddress":"02:42:ac:11:01:bc","PortMapping":null,"Ports":{"80/tcp":null}},"Path":"/bin/sh","ProcessLabel":"","ResolvConfPath":"/mnt/sda1/var/lib/docker/containers/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc/resolv.conf","RestartCount":0,"State":{"Dead":false,"Error":"","ExitCode":0,"FinishedAt":"0001-01-01T00:00:00Z","OOMKilled":false,"Paused":false,"Pid":13813,"Restarting":false,"Running":true,"StartedAt":"2015-06-12T00:42:49.716092538Z"},"Volumes":{},"VolumesRW":{}}
104
+ http_version:
105
+ recorded_at: Fri, 12 Jun 2015 00:42:49 GMT
106
+ - request:
107
+ method: get
108
+ uri: "<DOCKER_HOST>/v1.16/containers/and_a_name/json"
109
+ body:
110
+ encoding: US-ASCII
111
+ string: ''
112
+ headers:
113
+ User-Agent:
114
+ - Swipely/Docker-API 1.21.4
115
+ Content-Type:
116
+ - text/plain
117
+ response:
118
+ status:
119
+ code: 200
120
+ message:
121
+ headers:
122
+ Content-Type:
123
+ - application/json
124
+ Date:
125
+ - Fri, 12 Jun 2015 00:42:49 GMT
126
+ body:
127
+ encoding: UTF-8
128
+ string: |
129
+ {"AppArmorProfile":"","Args":["-c","ruby /code/server.rb"],"Config":{"AttachStderr":false,"AttachStdin":false,"AttachStdout":false,"Cmd":null,"CpuShares":0,"Cpuset":"","Domainname":"","Entrypoint":["/bin/sh","-c","ruby /code/server.rb"],"Env":["PATH=/usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","RUBY_MAJOR=2.1","RUBY_VERSION=2.1.3","GEM_HOME=/usr/local/bundle","BUNDLE_APP_CONFIG=/usr/local/bundle"],"ExposedPorts":{"80/tcp":{}},"Hostname":"hostname-DOCKER-and_a_name","Image":"hawknewton/show-env","Labels":{},"MacAddress":"","Memory":0,"MemorySwap":0,"NetworkDisabled":false,"OnBuild":null,"OpenStdin":false,"PortSpecs":null,"StdinOnce":false,"Tty":false,"User":"","Volumes":null,"WorkingDir":""},"Created":"2015-06-12T00:42:49.330021216Z","Driver":"aufs","ExecDriver":"native-0.2","ExecIDs":null,"HostConfig":{"Binds":null,"CapAdd":null,"CapDrop":null,"CgroupParent":"","ContainerIDFile":"","CpuShares":0,"CpusetCpus":"","Devices":null,"Dns":null,"DnsSearch":null,"ExtraHosts":[],"IpcMode":"","Links":null,"LogConfig":{"Config":null,"Type":"json-file"},"LxcConf":null,"Memory":0,"MemorySwap":0,"NetworkMode":"","PidMode":"","PortBindings":{},"Privileged":false,"PublishAllPorts":false,"ReadonlyRootfs":false,"RestartPolicy":{"MaximumRetryCount":0,"Name":""},"SecurityOpt":null,"Ulimits":null,"VolumesFrom":null},"HostnamePath":"/mnt/sda1/var/lib/docker/containers/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc/hostname","HostsPath":"/mnt/sda1/var/lib/docker/containers/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc/hosts","Id":"47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc","Image":"b9c5be3a918d80b0d898ed8eca3fc76f75c482b531238e539cb00f75bb4e12d2","LogPath":"/mnt/sda1/var/lib/docker/containers/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc-json.log","MountLabel":"","Name":"/and_a_name","NetworkSettings":{"Bridge":"docker0","Gateway":"172.17.42.1","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"IPAddress":"172.17.1.188","IPPrefixLen":16,"IPv6Gateway":"","LinkLocalIPv6Address":"fe80::42:acff:fe11:1bc","LinkLocalIPv6PrefixLen":64,"MacAddress":"02:42:ac:11:01:bc","PortMapping":null,"Ports":{"80/tcp":null}},"Path":"/bin/sh","ProcessLabel":"","ResolvConfPath":"/mnt/sda1/var/lib/docker/containers/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc/resolv.conf","RestartCount":0,"State":{"Dead":false,"Error":"","ExitCode":0,"FinishedAt":"0001-01-01T00:00:00Z","OOMKilled":false,"Paused":false,"Pid":13813,"Restarting":false,"Running":true,"StartedAt":"2015-06-12T00:42:49.716092538Z"},"Volumes":{},"VolumesRW":{}}
130
+ http_version:
131
+ recorded_at: Fri, 12 Jun 2015 00:42:49 GMT
132
+ - request:
133
+ method: post
134
+ uri: "<DOCKER_HOST>/v1.16/containers/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc/kill"
135
+ body:
136
+ encoding: US-ASCII
137
+ string: ''
138
+ headers:
139
+ User-Agent:
140
+ - Swipely/Docker-API 1.21.4
141
+ Content-Type:
142
+ - text/plain
143
+ response:
144
+ status:
145
+ code: 204
146
+ message:
147
+ headers:
148
+ Date:
149
+ - Fri, 12 Jun 2015 00:42:50 GMT
150
+ body:
151
+ encoding: UTF-8
152
+ string: ''
153
+ http_version:
154
+ recorded_at: Fri, 12 Jun 2015 00:42:49 GMT
155
+ - request:
156
+ method: delete
157
+ uri: "<DOCKER_HOST>/v1.16/containers/47d3cc66c2563f000ba865e12c368f33da54101544e0f13749bc0168698b54cc"
158
+ body:
159
+ encoding: US-ASCII
160
+ string: ''
161
+ headers:
162
+ User-Agent:
163
+ - Swipely/Docker-API 1.21.4
164
+ Content-Type:
165
+ - text/plain
166
+ response:
167
+ status:
168
+ code: 204
169
+ message:
170
+ headers:
171
+ Date:
172
+ - Fri, 12 Jun 2015 00:42:50 GMT
173
+ body:
174
+ encoding: UTF-8
175
+ string: ''
176
+ http_version:
177
+ recorded_at: Fri, 12 Jun 2015 00:42:50 GMT
178
+ recorded_with: VCR 2.9.3
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bigrig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hawk Newton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-05 00:00:00.000000000 Z
11
+ date: 2015-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -290,6 +290,7 @@ files:
290
290
  - spec/vcr/Bigrig_DockerAdapter/_remove_container/when_the_container_is_running/raises_a_ContainerRunningError.yml
291
291
  - spec/vcr/Bigrig_DockerAdapter/_remove_image/when_the_image_doesnt_exist/raises_an_error.yml
292
292
  - spec/vcr/Bigrig_DockerAdapter/_remove_image/when_the_image_exists/removes_the_image.yml
293
+ - spec/vcr/Bigrig_DockerAdapter/_run/given_an_image_id_that_exists/and_a_name/sets_the_hostname.yml
293
294
  - spec/vcr/Bigrig_DockerAdapter/_run/given_an_image_id_that_exists/and_a_name/starts_the_container_with_the_right_name.yml
294
295
  - spec/vcr/Bigrig_DockerAdapter/_run/given_an_image_id_that_exists/and_a_name_and_env_variables/starts_the_container_with_env_set.yml
295
296
  - spec/vcr/Bigrig_DockerAdapter/_run/given_an_image_id_that_exists/and_a_name_and_ports/starts_the_container_with_ports_exposed.yml