open-dock 0.1.2 → 0.1.3
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/README.md +8 -4
- data/lib/open-dock/chef.rb +1 -1
- data/lib/open-dock/commands/configure_host.rb +2 -6
- data/lib/open-dock/commands/ssh_host.rb +23 -0
- data/lib/open-dock/docker.rb +6 -1
- data/lib/open-dock/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf46e7e6d4e8034a8e2b82180afa1923299c4c3d
|
4
|
+
data.tar.gz: 579744a86259e913c0c057cc0c13d73d7926167e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50b3e6ad6360886cd94a2e0c69aa9eb9524e22007dc0996a8d9c3ab5b6d48dbca8bac733601a4e7b4eba657adf18bc288fca29e883558b479b82632b2153b1ff
|
7
|
+
data.tar.gz: 29386d1973a2ef2752e0d059908e0c074af16cba1aa58f3395894ac05e96a3daf43f8353d9e0b8d807e48790c5563dbc3480c6ef7364c27b52cbb2d78e9e0eed
|
data/README.md
CHANGED
@@ -175,8 +175,7 @@ Configuration with chef commands
|
|
175
175
|
By convention:
|
176
176
|
|
177
177
|
* "root" is the user in all containers
|
178
|
-
* Each container configuration is defined in a Chef node: `nodes/[
|
179
|
-
* Then you have to create all container name records in your DNS provider: `[container_name].[host_name] CNAME [host_name].`
|
178
|
+
* Each container configuration is defined in a Chef node: `nodes/[host_name]/[container_name].json`
|
180
179
|
|
181
180
|
## Commands
|
182
181
|
|
@@ -191,7 +190,7 @@ Create/delete domain names, create/delete hosts and ship/unship hosts:
|
|
191
190
|
* `ops unship HOST_NAME`
|
192
191
|
* TODO: `ops reship HOST_NAME` unship/ship all containers from host.
|
193
192
|
* `ops configure HOST_NAME` configure all containers with chef.
|
194
|
-
*
|
193
|
+
* `ops ssh HOST_NAME [CONTAINER_NAME]` ssh connection to host or container
|
195
194
|
|
196
195
|
## Create your infrastructure project (/ops)
|
197
196
|
|
@@ -269,4 +268,9 @@ Create command `ops configure [host_name]` this will cook all containers. By con
|
|
269
268
|
|
270
269
|
### v0.1.2
|
271
270
|
|
272
|
-
* Delete post-conditions from containers files. By default host credentials are passed to conainers.
|
271
|
+
* Delete post-conditions from containers files. By default host credentials are passed to conainers.
|
272
|
+
|
273
|
+
### v0.1.3
|
274
|
+
|
275
|
+
* Chef containers configuration files goes to nodes/[host_name]/[container_name].json
|
276
|
+
* Create ssh connections commands: 'ops ssh [host_name] [container_name]'
|
data/lib/open-dock/chef.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Chef
|
2
2
|
def self.cook(user, container_name, host, ssh_port)
|
3
3
|
say "Container '#{container_name}' configuring on #{host}, please wait ....\n"
|
4
|
-
command = "knife solo cook #{user}@#{
|
4
|
+
command = "knife solo cook #{user}@#{host} -p #{ssh_port} nodes/#{host}/#{container_name}.json"
|
5
5
|
say "Chef CMD: #{command}\n"
|
6
6
|
system command
|
7
7
|
end
|
@@ -12,16 +12,12 @@ command :configure do |c|
|
|
12
12
|
|
13
13
|
if options.container == "all"
|
14
14
|
containers.each do |container_name, config|
|
15
|
-
ssh_port =
|
15
|
+
ssh_port = Docker::get_container_port config
|
16
16
|
Chef::cook(user,container_name, host, ssh_port)
|
17
17
|
end
|
18
18
|
else
|
19
|
-
ssh_port =
|
19
|
+
ssh_port = Docker::get_container_port containers[options.container]
|
20
20
|
Chef::cook(user, options.container, host, ssh_port)
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
24
|
-
def get_port(config)
|
25
|
-
config["ports"].select{|port| port.end_with? ":22"}[0].split(':')[0]
|
26
|
-
end
|
27
23
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
command :ssh do |c|
|
2
|
+
c.summary = 'Connects to a host or a container with SSH'
|
3
|
+
c.syntax = 'ops ssh [host_name] [container_name]'
|
4
|
+
c.description = "SSH connection to host or one of its containers if write [container_name]"
|
5
|
+
c.example "Connects to host:", 'ops ssh example.com'
|
6
|
+
c.example "Connects to a container:", 'ops ssh example.com www'
|
7
|
+
c.action do |args, options|
|
8
|
+
host = args[0]
|
9
|
+
user = Docker::DEFAULT_USER
|
10
|
+
|
11
|
+
if args.count == 1
|
12
|
+
ssh_port = 22
|
13
|
+
else
|
14
|
+
container = args[1]
|
15
|
+
containers = Docker::containers_for(host)
|
16
|
+
ssh_port = Docker::get_container_port containers[container]
|
17
|
+
end
|
18
|
+
command = "ssh #{user}@#{host} -p #{ssh_port}"
|
19
|
+
|
20
|
+
puts "CMD: #{command}"
|
21
|
+
exec command
|
22
|
+
end
|
23
|
+
end
|
data/lib/open-dock/docker.rb
CHANGED
@@ -19,7 +19,7 @@ module Docker
|
|
19
19
|
# Container folder
|
20
20
|
if sudo test -d "/var/lib/docker/aufs"; then
|
21
21
|
CONTAINERS_DIR=/var/lib/docker/aufs/mnt
|
22
|
-
elif sudo test -d "/var/lib/docker/
|
22
|
+
elif sudo test -d "/var/lib/docker/btrfs"; then
|
23
23
|
CONTAINERS_DIR=/var/lib/docker/btrfs/subvolumes
|
24
24
|
fi
|
25
25
|
|
@@ -38,4 +38,9 @@ module Docker
|
|
38
38
|
EOH
|
39
39
|
end
|
40
40
|
|
41
|
+
|
42
|
+
def self.get_container_port(container_config)
|
43
|
+
container_config["ports"].select{|port| port.end_with? ":22"}[0].split(':')[0]
|
44
|
+
end
|
45
|
+
|
41
46
|
end
|
data/lib/open-dock/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: open-dock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Lebrijo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- lib/open-dock/commands/list.rb
|
122
122
|
- lib/open-dock/commands/provision_host.rb
|
123
123
|
- lib/open-dock/commands/ship_host.rb
|
124
|
+
- lib/open-dock/commands/ssh_host.rb
|
124
125
|
- lib/open-dock/commands/unship_host.rb
|
125
126
|
- lib/open-dock/docker.rb
|
126
127
|
- lib/open-dock/ops.rb
|
@@ -150,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
151
|
version: '0'
|
151
152
|
requirements: []
|
152
153
|
rubyforge_project:
|
153
|
-
rubygems_version: 2.4.
|
154
|
+
rubygems_version: 2.4.2
|
154
155
|
signing_key:
|
155
156
|
specification_version: 4
|
156
157
|
summary: Encapsulates Provision and Configuration Operations commands needed for complex
|