open-dock 0.1.2 → 0.1.3

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: 6f95a46172f0a2194702ba0a6219e3b5c7a2102a
4
- data.tar.gz: 129b68d7a9c44cf0d89ce8718f0bd46196247c7d
3
+ metadata.gz: bf46e7e6d4e8034a8e2b82180afa1923299c4c3d
4
+ data.tar.gz: 579744a86259e913c0c057cc0c13d73d7926167e
5
5
  SHA512:
6
- metadata.gz: b3f5e9f131355747abb2abb46661fe5b5d381b8fdad3374b911f4e3e09bedf133b31806e5decd3048023d1b989c45772ed1b7f0c4c7fe0391a7687607aa165a5
7
- data.tar.gz: e1f4836d8cdc76ac7e456b75886f931fcf36c073d95560de9415ed7fb41eae243891f3fc3947cd4aa946a1ad619c97d183d9534b0ad889ea1c2e11a234532922
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/[container_name].[host_name].json`
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
- * TODO: `ops ssh [CONTAINER_NAME] HOST_NAME` ssh connection to host or container
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]'
@@ -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}@#{container_name}.#{host} -p #{ssh_port}"
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 = get_port config
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 = get_port containers[options.container]
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
@@ -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/aufs"; then
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
@@ -1,3 +1,3 @@
1
1
  module OpenDock
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
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.2
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-16 00:00:00.000000000 Z
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.5
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