open-dock 0.1.7 → 0.1.8
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 +26 -3
- data/lib/open-dock/providers/google_cloud.rb +1 -1
- data/lib/open-dock/providers/vagrant.rb +57 -0
- data/lib/open-dock/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf6816945fadbf9f29bb522fc8927181a6d7b71d
|
4
|
+
data.tar.gz: f4227581bfcabb9e3521d005256125793c7906a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d199fed796f50fbd43c953612255f0120fb7920a36ef6ec95d63f1bc721730b51310091145e1fd2d25f0c2c428d8ca25647be2c0cefc237093e9c91f8e2eebf
|
7
|
+
data.tar.gz: e062ad3c3c9fb591db0f2d4ba8c32be5393e09524560c920d6b4daa333a45a6f5a53234b55702a40bab315de7932079a878899b1a0f5a6a9a0eec863cdd175b0
|
data/README.md
CHANGED
@@ -45,8 +45,6 @@ containers
|
|
45
45
|
|
46
46
|
`ops list` command will list all providers supported by this gem.
|
47
47
|
|
48
|
-
TODO: Create more providers (vagrant, aws, linode, gcloud, ...)
|
49
|
-
|
50
48
|
### Digital Ocean
|
51
49
|
|
52
50
|
Pre-requisites:
|
@@ -90,6 +88,25 @@ Helpful commands:
|
|
90
88
|
|
91
89
|
By default `user` to connect to host will be 'root' if not configured.
|
92
90
|
|
91
|
+
### Vagrant Host
|
92
|
+
|
93
|
+
With Vagrant we do not need provider file anymore. But obviously qyou need to have installed in your workstation:
|
94
|
+
|
95
|
+
* [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
|
96
|
+
* [Vagrant](https://www.vagrantup.com/downloads.html)
|
97
|
+
|
98
|
+
For a Vagrant host we can make the following file (ops/hosts/example.com.yml):
|
99
|
+
|
100
|
+
```yml
|
101
|
+
provider: vagrant
|
102
|
+
user: root # User to connect the host
|
103
|
+
memory: 2048
|
104
|
+
ip: 192.168.33.20
|
105
|
+
box: ubuntu/trusty64 ## Search on https://atlas.hashicorp.com
|
106
|
+
```
|
107
|
+
|
108
|
+
`ops create example.com` will create Vagrantfile, so you can suspend it `vagrant suspend` or manipulate with vagrant commands.
|
109
|
+
|
93
110
|
### Digital Ocean Host
|
94
111
|
|
95
112
|
For a Digital Ocean host we can make the following file (ops/hosts/example.com.yml):
|
@@ -212,6 +229,7 @@ Assuming SSHd installed in containers and hosts, you can
|
|
212
229
|
Create/delete domain names, create/delete hosts and ship/unship hosts:
|
213
230
|
|
214
231
|
* TODO: `ops init` initialize needed folders and example files
|
232
|
+
* TODO: `ops list` shows all providers for this gem. Create more providers (aws, linode, gcloud, ...)
|
215
233
|
* `ops create HOST_NAME` create the host defined by the name of the file in the 'ops/hosts' folder.
|
216
234
|
* `ops delete HOST_NAME`
|
217
235
|
* TODO: `ops recreate HOST_NAME` delete/create the host.
|
@@ -221,6 +239,7 @@ Create/delete domain names, create/delete hosts and ship/unship hosts:
|
|
221
239
|
* TODO: `ops reship HOST_NAME` unship/ship all containers from host.
|
222
240
|
* `ops configure HOST_NAME` configure all containers with chef.
|
223
241
|
* `ops ssh HOST_NAME [CONTAINER_NAME]` ssh connection to host or container
|
242
|
+
* TODO: `ops graph` creates a graphic with all hosts and nodes in the project
|
224
243
|
|
225
244
|
## Create your infrastructure project (/ops)
|
226
245
|
|
@@ -303,4 +322,8 @@ Create command `ops configure [host_name]` this will cook all containers. By con
|
|
303
322
|
### v0.1.3
|
304
323
|
|
305
324
|
* Chef containers configuration files goes to nodes/[host_name]/[container_name].json
|
306
|
-
* Create ssh connections commands: 'ops ssh [host_name] [container_name]'
|
325
|
+
* Create ssh connections commands: 'ops ssh [host_name] [container_name]'
|
326
|
+
|
327
|
+
### v0.1.8
|
328
|
+
|
329
|
+
* Including Vagrant provider
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'erubis'
|
2
|
+
|
3
|
+
class Vagrant < Provider
|
4
|
+
TEMPLATE = %{Vagrant.configure(2) do |config|
|
5
|
+
config.vm.box = "<%=box%>"
|
6
|
+
config.vm.hostname = "<%=name%>"
|
7
|
+
|
8
|
+
config.vm.network "private_network", ip: "<%=ip%>"
|
9
|
+
|
10
|
+
config.vm.provider "virtualbox" do |vb|
|
11
|
+
vb.name = config.vm.hostname
|
12
|
+
vb.memory = "<%=memory%>"
|
13
|
+
end
|
14
|
+
|
15
|
+
config.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "/tmp/id_rsa.pub"
|
16
|
+
config.vm.provision "shell", inline: <<-SHELL
|
17
|
+
# Copy host public key
|
18
|
+
sudo mv /tmp/id_rsa.pub /root/.ssh/authorized_keys
|
19
|
+
sudo chown root:root /root/.ssh/authorized_keys
|
20
|
+
# Install docker
|
21
|
+
wget -qO- https://get.docker.io/gpg | sudo apt-key add -
|
22
|
+
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
|
23
|
+
sudo apt-get update
|
24
|
+
sudo apt-get install lxc-docker -y
|
25
|
+
SHELL
|
26
|
+
end
|
27
|
+
}
|
28
|
+
def initialize
|
29
|
+
# Nothing
|
30
|
+
end
|
31
|
+
def create(config)
|
32
|
+
# Create Vagrantfile
|
33
|
+
erb= Erubis::Eruby.new(TEMPLATE)
|
34
|
+
out = erb.result(config)
|
35
|
+
File.write "Vagrantfile", out
|
36
|
+
# vagrant up
|
37
|
+
system "vagrant up"
|
38
|
+
end
|
39
|
+
|
40
|
+
def delete(host)
|
41
|
+
#vagrant destroy -f
|
42
|
+
system "vagrant destroy -f"
|
43
|
+
#Remove Vagrantfile
|
44
|
+
system "rm Vagrantfile"
|
45
|
+
end
|
46
|
+
|
47
|
+
def list_params
|
48
|
+
say "\nMemory: RAM memory in Megabytes"
|
49
|
+
say "\nIp: Every IP in the 192.168.0.0 range"
|
50
|
+
say "\nBoxes: Every box from https://atlas.hashicorp.com"
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
def create_connection(config)
|
55
|
+
# nothing
|
56
|
+
end
|
57
|
+
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.8
|
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-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- lib/open-dock/providers.rb
|
129
129
|
- lib/open-dock/providers/digital_ocean.rb
|
130
130
|
- lib/open-dock/providers/google_cloud.rb
|
131
|
+
- lib/open-dock/providers/vagrant.rb
|
131
132
|
- lib/open-dock/version.rb
|
132
133
|
- lib/tasks/.gitkeep
|
133
134
|
- open-dock.gemspec
|