open-dock 0.0.15 → 0.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 +4 -4
- data/README.md +16 -2
- data/lib/open-dock/commands/ship_host.rb +10 -5
- data/lib/open-dock/commands/unship_host.rb +10 -3
- data/lib/open-dock/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5eee642a498a4d4faa1e00a618afa1b993dfb75a
|
4
|
+
data.tar.gz: c7a61dc4ad766ebf27b14500296bd9461ccbd300
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6ca4d9d727cb99c000deb9062b9d433480bebfca123a1f9d8d746e8a8f2eb10de79834f89e8d9df995e6fd1ff925fe6ea0aab857905221a5b03ab0f49e0c185
|
7
|
+
data.tar.gz: 9586f5989f25bf6fe874b98d929afb2a3e3284257ac34d3a2015ca4b63fffe480bee4443a757c2b32dc5685d3e89521c739752403d65d6ede7c0e4547739257b
|
data/README.md
CHANGED
@@ -124,6 +124,7 @@ In this file we can configure all containers to run in the host provided in the
|
|
124
124
|
|
125
125
|
```yml
|
126
126
|
www:
|
127
|
+
hostname: lebrijo.com
|
127
128
|
image: jlebrijo/prun
|
128
129
|
ports:
|
129
130
|
- '2222:22'
|
@@ -139,15 +140,24 @@ www:
|
|
139
140
|
# POST-CONDITIONS: execute after build the container:
|
140
141
|
post-conditions:
|
141
142
|
- sshpass -p 'J3mw?$_6' ssh-copy-id -o 'StrictHostKeyChecking no' -i ~/.ssh/id_rsa.pub root@lebrijo.com -p 2222
|
142
|
-
- ssh root@lebrijo.com -p 2222 "echo 'root:
|
143
|
+
- ssh root@lebrijo.com -p 2222 "echo 'root:Kxxxxx1' | chpasswd"
|
143
144
|
|
144
145
|
# here you can create other containers
|
145
146
|
# db:
|
147
|
+
# hostname: db.lebrijo.com
|
146
148
|
# image: ubuntu/postgresql
|
147
149
|
```
|
148
150
|
|
149
151
|
`ops ship example.com` will create all containers configured on 'containers/example.com.yml' file
|
150
152
|
|
153
|
+
### Shipping your local Docker
|
154
|
+
|
155
|
+
You can create a file `containers/localhost.yml` where you can define containers. And launch them on your workstation:
|
156
|
+
|
157
|
+
```
|
158
|
+
ops ship localhost
|
159
|
+
```
|
160
|
+
|
151
161
|
## TODO: Configure Containers (are nodes, with Chef)
|
152
162
|
|
153
163
|
Configuration with chef commands
|
@@ -228,4 +238,8 @@ Or integrate it within your Chef infrastructure project. Just add the gem to you
|
|
228
238
|
|
229
239
|
* Added Google Cloud as provider
|
230
240
|
* Now providers files are called underscored: digital_ocean, google_cloud ....
|
231
|
-
* In hosts YAML files we should include which provider will be built (i.e. provider: digital_ocean)
|
241
|
+
* In hosts YAML files we should include which provider will be built (i.e. provider: digital_ocean)
|
242
|
+
|
243
|
+
### v0.1.0
|
244
|
+
|
245
|
+
* Launch local containers with `containers/localhost.yml` and `ops ship localhost`
|
@@ -5,7 +5,7 @@ command :ship do |c|
|
|
5
5
|
c.example "Create a container called 'www' in the host example.com. This is described in '#{Ops::CONTAINERS_DIR}/example.com.yml' like:\n # www:\n # detach: true\n # image: jlebrijo/prun\n # ports:\n # - '2222:22'\n # - '80:80'", 'ops ship example.com'
|
6
6
|
c.action do |args, options|
|
7
7
|
host = args[0]
|
8
|
-
user = Ops::get_user_for(host)
|
8
|
+
user = Ops::get_user_for(host) unless host == "localhost"
|
9
9
|
|
10
10
|
Docker::containers_for(host).each do |container_name, config|
|
11
11
|
ports = config["ports"].map{|port| "-p #{port}"}.join(" ")
|
@@ -14,10 +14,15 @@ command :ship do |c|
|
|
14
14
|
options << "--#{option}=#{value}"
|
15
15
|
end
|
16
16
|
say "Container '#{container_name}' loading on #{host}, please wait ....\n"
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
command = "docker run #{options.join(" ")} --name #{container_name} #{ports} #{config["image"]} #{config["command"]}"
|
18
|
+
if host == "localhost"
|
19
|
+
system command
|
20
|
+
else
|
21
|
+
Net::SSH.start(host, user) do |ssh|
|
22
|
+
|
23
|
+
say "Docker CMD: #{command}\n"
|
24
|
+
ssh.exec command
|
25
|
+
end
|
21
26
|
end
|
22
27
|
sleep 5
|
23
28
|
config["post-conditions"].each { |c| system c }
|
@@ -5,11 +5,18 @@ command :unship do |c|
|
|
5
5
|
c.example "", 'ops unship example.com'
|
6
6
|
c.action do |args, options|
|
7
7
|
host = args[0]
|
8
|
-
user = Ops::get_user_for(host)
|
9
8
|
|
10
|
-
|
9
|
+
if host == "localhost"
|
11
10
|
Docker::containers_for(host).each do |container_name, config|
|
12
|
-
|
11
|
+
system "docker rm -f #{container_name}"
|
12
|
+
end
|
13
|
+
else
|
14
|
+
user = Ops::get_user_for(host)
|
15
|
+
|
16
|
+
Net::SSH.start(host, user) do |ssh|
|
17
|
+
Docker::containers_for(host).each do |container_name, config|
|
18
|
+
ssh.exec "docker rm -f #{container_name}"
|
19
|
+
end
|
13
20
|
end
|
14
21
|
end
|
15
22
|
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.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Lebrijo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
version: '0'
|
149
149
|
requirements: []
|
150
150
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.4.
|
151
|
+
rubygems_version: 2.4.5
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: Encapsulates Provision and Configuration Operations commands needed for complex
|