open-dock 0.1.13 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -8
- data/lib/open-dock/base.rb +1 -0
- data/lib/open-dock/chef.rb +22 -1
- data/lib/open-dock/commands/configure_host.rb +12 -7
- data/lib/open-dock/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36a07c0274e5f860e522cf5d0054df2ffeb496b7
|
4
|
+
data.tar.gz: 08f8407704c902e46499a44f1f2e152dd2a6e6d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9ed35d9f922d74eda160ec9b476c4339c760bcf4d637d5fc51c4f6248decba414c4ea664ad1cf29bf495d1fbfb3a1e2933edc1682f4cdd5bed3cab74358df80
|
7
|
+
data.tar.gz: 32c7f411787f744477db96524e0aeb3f86efa0595b3e06ec0ce300cb3d88b0edd60e9269fa86dc88fae09087acdd41f5e8c1901c6ea0a706dc8b9a8d7009f7f2
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# ![logo](logo.jpg)
|
2
2
|
|
3
3
|
Gem for orchestrating the creation of infrastructures of hosts and containers. You can manage CREATION (in any provider: DigitalOcean, Gcloud, vagrant for the moment), SHIPPING (with docker containers) and CONFIGURING (with Chef). All with 3 commands per host:
|
4
4
|
|
@@ -43,7 +43,7 @@ containers
|
|
43
43
|
example.com.yml
|
44
44
|
```
|
45
45
|
|
46
|
-
##
|
46
|
+
## Adding PROVIDER (/providers)
|
47
47
|
|
48
48
|
`ops list` command will list all providers supported by this gem.
|
49
49
|
|
@@ -79,7 +79,7 @@ google_project: "project_name"
|
|
79
79
|
google_key_location: "path_to_your_p12_file"
|
80
80
|
```
|
81
81
|
|
82
|
-
##
|
82
|
+
## Creating HOST (/hosts)
|
83
83
|
|
84
84
|
With these files you can configure your instances/servers/droplets/ships on every provider you have configured in the last point.
|
85
85
|
|
@@ -139,7 +139,7 @@ source_image: coreos-stable-444-5-0-v20141016
|
|
139
139
|
disk_size_gb: 10
|
140
140
|
```
|
141
141
|
|
142
|
-
##
|
142
|
+
## Shipping hosted CONTAINERS (/containers)
|
143
143
|
|
144
144
|
To use this command you need [Docker](https://docs.docker.com/installation/) installed in the server.
|
145
145
|
|
@@ -187,12 +187,13 @@ By convention:
|
|
187
187
|
|
188
188
|
* If [host_name] includes "localhost" string, it is assumed that containers are shipped as docker containers in local workstation
|
189
189
|
|
190
|
-
##
|
190
|
+
## Configuring Host (/nodes)
|
191
191
|
|
192
|
-
|
192
|
+
Configuration with Chef:
|
193
193
|
|
194
|
-
* Chef
|
195
|
-
*
|
194
|
+
* Install Chef and configure host from `nodes/[host_name].json` file
|
195
|
+
* Configure all containers in a Host from `nodes/[host_name]/*` containers.
|
196
|
+
* Configure specific container in a Host from `nodes/[host_name]/[container_name]` containers.
|
196
197
|
|
197
198
|
Configuration with chef commands
|
198
199
|
|
@@ -204,8 +205,12 @@ By convention:
|
|
204
205
|
|
205
206
|
* "root" is the user by default in all containers
|
206
207
|
* Each container configuration is defined in a Chef node: `nodes/[host_name]/[container_name].json`
|
208
|
+
* If there is only a json file, is assumed a non-docker host:
|
209
|
+
`nodes/[host_name].json`
|
207
210
|
|
208
211
|
```
|
212
|
+
# Just configure host from example.com.json
|
213
|
+
ops configure example.com
|
209
214
|
# Configure all containers in 'example.com' host
|
210
215
|
ops configure example.com
|
211
216
|
# Configure 'www' container in 'example.com' host
|
@@ -329,3 +334,7 @@ Create command `ops configure [host_name]` this will cook all containers. By con
|
|
329
334
|
### v0.1.8
|
330
335
|
|
331
336
|
* Including Vagrant provider
|
337
|
+
|
338
|
+
### v0.1.14
|
339
|
+
|
340
|
+
* Adding the posibility to configure non-docker hosts.
|
data/lib/open-dock/base.rb
CHANGED
data/lib/open-dock/chef.rb
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
module Chef
|
2
|
-
|
2
|
+
|
3
|
+
def self.install(user, host)
|
4
|
+
Net::SSH.start(host, user) do |ssh|
|
5
|
+
if ssh.exec!('which chef-client')
|
6
|
+
say 'Chef already installed'
|
7
|
+
else
|
8
|
+
say "Installing Chef, please wait ..."
|
9
|
+
ssh.exec! 'apt-get -y update; \
|
10
|
+
apt-get -y install curl build-essential libxml2-dev libxslt-dev git ; \
|
11
|
+
curl -L https://www.opscode.com/chef/install.sh | bash'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.cook(user, host)
|
17
|
+
say "Configuring #{host}, please wait ....\n"
|
18
|
+
command = "knife solo cook #{user}@#{host}"
|
19
|
+
say "Chef CMD: #{command}\n"
|
20
|
+
system command
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.cook_container(user, container_name, host, ssh_port)
|
3
24
|
say "Container '#{container_name}' configuring on #{host}, please wait ....\n"
|
4
25
|
command = "knife solo cook #{user}@#{host} -p #{ssh_port} nodes/#{host}/#{container_name}.json"
|
5
26
|
say "Chef CMD: #{command}\n"
|
@@ -10,14 +10,19 @@ command :configure do |c|
|
|
10
10
|
user = Ops::DEFAULT_USER
|
11
11
|
containers = Docker::containers_for(host)
|
12
12
|
|
13
|
-
if
|
14
|
-
|
15
|
-
|
16
|
-
Chef::cook(user,container_name, host, ssh_port)
|
17
|
-
end
|
13
|
+
if File.exists? "#{Ops::NODES_DIR}/#{host}.json" # Not a container ship
|
14
|
+
Chef::install(user, host)
|
15
|
+
Chef::cook(user, host)
|
18
16
|
else
|
19
|
-
|
20
|
-
|
17
|
+
if options.container == "all"
|
18
|
+
containers.each do |container_name, config|
|
19
|
+
ssh_port = Docker::get_container_port config
|
20
|
+
Chef::cook_container(user,container_name, host, ssh_port)
|
21
|
+
end
|
22
|
+
else
|
23
|
+
ssh_port = Docker::get_container_port containers[options.container]
|
24
|
+
Chef::cook_container(user, options.container, host, ssh_port)
|
25
|
+
end
|
21
26
|
end
|
22
27
|
end
|
23
28
|
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.14
|
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-
|
11
|
+
date: 2015-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|