ventriloquist 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -4
- data/CHANGELOG.md +31 -0
- data/DEVELOPMENT.md +37 -0
- data/Gemfile +13 -13
- data/Gemfile.lock +48 -50
- data/LICENSE.txt +1 -1
- data/README.md +65 -114
- data/development/Vagrantfile +20 -55
- data/lib/ventriloquist/cap/platforms/debian/elixir_install.rb +23 -16
- data/lib/ventriloquist/cap/platforms/debian/erlang_install.rb +13 -10
- data/lib/ventriloquist/cap/platforms/debian/go_install.rb +18 -3
- data/lib/ventriloquist/cap/platforms/debian/phantomjs_install.rb +22 -4
- data/lib/ventriloquist/cap/platforms/debian/python.rb +2 -0
- data/lib/ventriloquist/cap/platforms/linux/nvm_install_nodejs.rb +2 -0
- data/lib/ventriloquist/cap/platforms/linux/rvm_install_ruby.rb +2 -0
- data/lib/ventriloquist/cap/services/debian/ventriloquist_containers_upstart.rb +1 -1
- data/lib/ventriloquist/cap/utils/debian/prepare_container_for_docker.rb +35 -0
- data/lib/ventriloquist/cap/utils/linux/download.rb +24 -10
- data/lib/ventriloquist/cap/utils.rb +5 -0
- data/lib/ventriloquist/config.rb +1 -1
- data/lib/ventriloquist/platforms/elixir.rb +7 -2
- data/lib/ventriloquist/platforms/erlang.rb +3 -0
- data/lib/ventriloquist/platforms/go.rb +7 -2
- data/lib/ventriloquist/platforms/nodejs.rb +9 -2
- data/lib/ventriloquist/platforms/phantomjs.rb +7 -2
- data/lib/ventriloquist/platforms/python.rb +9 -2
- data/lib/ventriloquist/platforms/ruby.rb +9 -2
- data/lib/ventriloquist/platforms_builder.rb +7 -2
- data/lib/ventriloquist/plugin.rb +0 -4
- data/lib/ventriloquist/provisioner.rb +10 -5
- data/lib/ventriloquist/service.rb +4 -5
- data/lib/ventriloquist/services/elastic_search.rb +1 -1
- data/lib/ventriloquist/services/mail_catcher.rb +1 -1
- data/lib/ventriloquist/services/memcached.rb +1 -1
- data/lib/ventriloquist/services/mysql.rb +1 -1
- data/lib/ventriloquist/services/postgresql.rb +1 -1
- data/lib/ventriloquist/services/redis.rb +2 -2
- data/lib/ventriloquist/services/rethink_db.rb +1 -5
- data/lib/ventriloquist/services_builder.rb +10 -7
- data/lib/ventriloquist/version.rb +1 -1
- data/services/base/Dockerfile +19 -11
- data/services/build-all.sh +11 -11
- data/services/elasticsearch/Dockerfile +4 -1
- data/services/mailcatcher/Dockerfile +11 -1
- data/services/memcached/Dockerfile +9 -4
- data/services/mysql/5.5/Dockerfile +1 -0
- data/services/mysql/5.6/Dockerfile +8 -4
- data/services/openjdk7/Dockerfile +6 -1
- data/services/postgresql/9.1/Dockerfile +8 -5
- data/services/postgresql/9.1/config/bin/prepare-postgres +2 -0
- data/services/postgresql/9.2/Dockerfile +7 -5
- data/services/postgresql/9.2/config/bin/prepare-postgres +2 -0
- data/services/postgresql/9.3/Dockerfile +5 -5
- data/services/postgresql/9.3/config/bin/prepare-postgres +2 -0
- data/services/redis/Dockerfile +7 -4
- data/services/rethinkdb/Dockerfile +8 -1
- data/spec/spec_helper.rb +7 -9
- data/spec/unit/platforms_builder_spec.rb +5 -9
- data/spec/unit/service_spec.rb +14 -16
- data/spec/unit/services_builder_spec.rb +10 -20
- data/ventriloquist.gemspec +0 -2
- metadata +11 -23
data/development/Vagrantfile
CHANGED
@@ -1,71 +1,36 @@
|
|
1
1
|
# -*- mode: ruby -*-
|
2
2
|
# vi: set ft=ruby :
|
3
3
|
|
4
|
-
Vagrant.require_plugin 'vagrant-lxc'
|
5
|
-
Vagrant.require_plugin 'vagrant-cachier'
|
6
|
-
Vagrant.require_plugin 'vagrant-pristine'
|
7
|
-
Vagrant.require_plugin 'vagrant-global-status'
|
8
|
-
Vagrant.require_plugin 'ventriloquist'
|
9
|
-
|
10
4
|
Vagrant.configure("2") do |config|
|
11
|
-
config.vm.box = "raring64"
|
12
|
-
config.vm.synced_folder "../", "/vagrant", id: 'vagrant-root'
|
13
|
-
|
14
|
-
config.vm.network :private_network, ip: "192.168.123.123"
|
15
|
-
|
16
|
-
config.cache.auto_detect = true
|
17
|
-
|
18
|
-
config.vm.provider :virtualbox do |_, override|
|
19
|
-
override.vm.box_url = 'http://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-amd64-vagrant-disk1.box'
|
20
|
-
end
|
21
|
-
|
22
5
|
config.vm.provider :lxc do |lxc, override|
|
6
|
+
override.vm.box = 'fgrehm/raring64-lxc'
|
23
7
|
# Required to boot nested containers
|
24
8
|
lxc.customize 'aa_profile', 'unconfined'
|
25
|
-
override.vm.box_url = 'http://bit.ly/vagrant-lxc-raring64-2013-10-23'
|
26
9
|
end
|
27
10
|
|
28
|
-
|
29
|
-
# Disable default lxc bridge
|
30
|
-
config.vm.provision :shell, inline: %[
|
31
|
-
cat <<STR > /etc/default/lxc
|
32
|
-
LXC_AUTO="false"
|
33
|
-
USE_LXC_BRIDGE="false"
|
34
|
-
STR
|
35
|
-
]
|
11
|
+
config.vm.synced_folder "../", "/vagrant", id: 'vagrant-root'
|
36
12
|
|
37
|
-
config.
|
38
|
-
|
39
|
-
env.services << %w( redis memcached pg mailcatcher mysql rethinkdb )
|
40
|
-
env.platforms << %w( nodejs phantomjs go erlang elixir python:2.7.5 )
|
13
|
+
config.cache.scope = :machine
|
14
|
+
config.ssh.forward_agent = true
|
41
15
|
|
42
|
-
|
16
|
+
config.vm.provision :ventriloquist do |env|
|
17
|
+
# Test packages installation
|
18
|
+
env.packages << %w( htop telnet )
|
19
|
+
env.services << %w( redis-2.8 memcached-1.4 postgres-9.3 mailcatcher-0.5 mysql-5.6 rethinkdb-1.12 elasticsearch-1.1 )
|
43
20
|
env.services << {
|
44
|
-
'
|
45
|
-
|
46
|
-
# Check if container will get the built in elasticsearch configs
|
47
|
-
type: 'elasticsearch',
|
48
|
-
},
|
49
|
-
'pg-9.1' => {
|
50
|
-
image: 'fgrehm/ventriloquist-pg',
|
51
|
-
tag: '9.1' },
|
52
|
-
'es-2' => {
|
53
|
-
image: 'fgrehm/ventriloquist-elasticsearch',
|
54
|
-
tag: '0.90.3',
|
55
|
-
ports: [':9200']
|
56
|
-
} }
|
57
|
-
|
58
|
-
# Test hash usage
|
59
|
-
env.platforms << { ruby: { version: '2.0.0' } }
|
21
|
+
'mc' => { vimage: 'memcached-1.4', args: '-P' }
|
22
|
+
}
|
60
23
|
|
61
|
-
#
|
62
|
-
env.
|
24
|
+
# This will intentionally show some warnings
|
25
|
+
env.platforms << %w( phantomjs go erlang elixir python ruby nodejs )
|
63
26
|
end
|
64
27
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
28
|
+
config.vm.provision :ventriloquist do |env|
|
29
|
+
env.platforms << %w( phantomjs-1.9.2 go-1.2.1 erlang elixir-0.11.1 python-3.0.1 )
|
30
|
+
env.platforms << {
|
31
|
+
# The first version provided will be set as the default
|
32
|
+
nodejs: { versions: ['0.10', '0.9'] },
|
33
|
+
ruby: { versions: ['2.1.1', '2.1.0'] }
|
34
|
+
}
|
35
|
+
end
|
71
36
|
end
|
@@ -3,31 +3,38 @@ module VagrantPlugins
|
|
3
3
|
module Cap
|
4
4
|
module Debian
|
5
5
|
module ElixirInstall
|
6
|
-
|
6
|
+
ELIXIR_PRECOMPILED_1 = "https://github.com/elixir-lang/elixir/releases/download/vVERSION/Precompiled.zip"
|
7
|
+
ELIXIR_PRECOMPILED_2 = "https://github.com/elixir-lang/elixir/releases/download/vVERSION/vVERSION.zip"
|
7
8
|
|
8
9
|
def self.elixir_install(machine,version)
|
9
10
|
@version = version
|
10
11
|
|
11
12
|
machine.communicate.tap do |comm|
|
12
|
-
if
|
13
|
-
|
14
|
-
|
13
|
+
if comm.test('which iex > /dev/null')
|
14
|
+
machine.env.ui.info("Skipping Elixir installation")
|
15
|
+
return
|
16
|
+
end
|
17
|
+
|
18
|
+
bin_path = "/usr/local/elixir/bin"
|
19
|
+
srcs = [
|
20
|
+
ELIXIR_PRECOMPILED_1.gsub(/VERSION/, @version),
|
21
|
+
ELIXIR_PRECOMPILED_2.gsub(/VERSION/, @version)
|
22
|
+
]
|
15
23
|
|
16
|
-
|
24
|
+
machine.env.ui.info("Installing Elixir #{@version}")
|
17
25
|
|
18
|
-
|
26
|
+
path = download_path(comm)
|
19
27
|
|
20
|
-
|
21
|
-
|
22
|
-
|
28
|
+
unless comm.test("test -f #{path}")
|
29
|
+
machine.guest.capability(:download, srcs, path)
|
30
|
+
end
|
23
31
|
|
24
|
-
|
25
|
-
|
26
|
-
|
32
|
+
# TODO: Create unzip capability
|
33
|
+
comm.sudo('apt-get install -y unzip')
|
34
|
+
comm.sudo("unzip -o #{path} -d /usr/local/elixir")
|
27
35
|
|
28
|
-
|
29
|
-
|
30
|
-
end
|
36
|
+
if ! comm.test("grep -q '#{bin_path}' /etc/profile.d/ventriloquist.sh 2>/dev/null")
|
37
|
+
comm.sudo("echo 'export PATH=$PATH:#{bin_path}' >> /etc/profile.d/ventriloquist.sh")
|
31
38
|
end
|
32
39
|
end
|
33
40
|
end
|
@@ -35,7 +42,7 @@ module VagrantPlugins
|
|
35
42
|
private
|
36
43
|
|
37
44
|
def self.download_path(comm)
|
38
|
-
# If vagrant-cachier
|
45
|
+
# If vagrant-cachier cache bucket are available, drop it there
|
39
46
|
if comm.test("test -d /tmp/vagrant-cache")
|
40
47
|
"/tmp/vagrant-cache/elixir-v#{@version}.zip"
|
41
48
|
else
|
@@ -3,22 +3,25 @@ module VagrantPlugins
|
|
3
3
|
module Cap
|
4
4
|
module Debian
|
5
5
|
module ErlangInstall
|
6
|
-
ERLANG_SOLUTIONS_PKG = "
|
6
|
+
ERLANG_SOLUTIONS_PKG = "http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb"
|
7
7
|
|
8
8
|
def self.erlang_install(machine)
|
9
9
|
machine.communicate.tap do |comm|
|
10
|
-
if
|
11
|
-
machine.env.ui.info(
|
10
|
+
if comm.test('which erl > /dev/null')
|
11
|
+
machine.env.ui.info("Skipping Erlang installation")
|
12
|
+
return
|
13
|
+
end
|
12
14
|
|
13
|
-
|
14
|
-
unless comm.test("test -f #{path}")
|
15
|
-
machine.guest.capability(:download, ERLANG_SOLUTIONS_PKG, path)
|
16
|
-
end
|
17
|
-
comm.sudo("dpkg -i #{path}")
|
15
|
+
machine.env.ui.info('Installing Erlang')
|
18
16
|
|
19
|
-
|
20
|
-
|
17
|
+
path = download_path(comm)
|
18
|
+
unless comm.test("test -f #{path}")
|
19
|
+
machine.guest.capability(:download, ERLANG_SOLUTIONS_PKG, path)
|
21
20
|
end
|
21
|
+
comm.sudo("dpkg -i #{path}")
|
22
|
+
|
23
|
+
comm.sudo('apt-get update')
|
24
|
+
comm.sudo('apt-get -y install erlang')
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
@@ -4,7 +4,10 @@ module VagrantPlugins
|
|
4
4
|
module Debian
|
5
5
|
module GoInstall
|
6
6
|
def self.go_install(machine, version)
|
7
|
-
|
7
|
+
if machine.communicate.test('which go > /dev/null')
|
8
|
+
machine.env.ui.info("Skipping go installation")
|
9
|
+
return
|
10
|
+
end
|
8
11
|
|
9
12
|
src = "https://go.googlecode.com/files/go#{version}.linux-amd64.tar.gz"
|
10
13
|
bin_path = "/usr/local/go/bin"
|
@@ -13,8 +16,11 @@ module VagrantPlugins
|
|
13
16
|
machine.env.ui.info("Installing go #{version}")
|
14
17
|
machine.communicate.tap do |comm|
|
15
18
|
comm.sudo('apt-get install curl -y -q')
|
16
|
-
|
17
|
-
comm.
|
19
|
+
path = download_path(comm, version)
|
20
|
+
unless comm.test("test -f #{path}")
|
21
|
+
machine.guest.capability(:download, src, path)
|
22
|
+
end
|
23
|
+
comm.sudo("tar xzfv #{path} -C /usr/local")
|
18
24
|
|
19
25
|
if ! comm.test("grep -q '#{bin_path}' /etc/profile.d/ventriloquist.sh 2>/dev/null")
|
20
26
|
comm.sudo("echo 'export PATH=$PATH:#{bin_path}' >> /etc/profile.d/ventriloquist.sh")
|
@@ -27,6 +33,15 @@ module VagrantPlugins
|
|
27
33
|
end
|
28
34
|
end
|
29
35
|
end
|
36
|
+
|
37
|
+
def self.download_path(comm, version)
|
38
|
+
# If vagrant-cachier cache buckets are available, drop it there
|
39
|
+
if comm.test("test -d /tmp/vagrant-cache")
|
40
|
+
"/tmp/vagrant-cache/go-#{version}.tar.gz"
|
41
|
+
else
|
42
|
+
"/tmp/go-#{version}.tar.gz"
|
43
|
+
end
|
44
|
+
end
|
30
45
|
end
|
31
46
|
end
|
32
47
|
end
|
@@ -4,19 +4,37 @@ module VagrantPlugins
|
|
4
4
|
module Debian
|
5
5
|
module PhantomjsInstall
|
6
6
|
def self.phantomjs_install(machine, version)
|
7
|
-
|
7
|
+
if machine.communicate.test('which phantomjs > /dev/null')
|
8
|
+
machine.env.ui.info("Skipping phantomjs installation")
|
9
|
+
return
|
10
|
+
end
|
8
11
|
|
9
|
-
|
12
|
+
src_1 = "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-#{version}-linux-x86_64.tar.bz2"
|
13
|
+
src_2 = "https://phantomjs.googlecode.com/files/phantomjs-#{version}-linux-x86_64.tar.bz2"
|
10
14
|
executable = "/usr/local/share/phantomjs-#{version}-linux-x86_64/bin/phantomjs"
|
11
15
|
|
12
16
|
machine.env.ui.info("Installing phantomjs #{version}")
|
13
17
|
machine.communicate.tap do |comm|
|
14
18
|
comm.sudo('apt-get install -y fontconfig libfreetype6 curl -y -q')
|
15
|
-
|
16
|
-
comm.
|
19
|
+
path = download_path(comm, version)
|
20
|
+
unless comm.test("test -f #{path}")
|
21
|
+
machine.guest.capability(:download, [src_1, src_2], path)
|
22
|
+
end
|
23
|
+
comm.sudo("tar xjfv #{path} -C /usr/local/share")
|
17
24
|
comm.sudo("ln -s #{executable} /usr/local/bin/phantomjs")
|
18
25
|
end
|
19
26
|
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def self.download_path(comm, version)
|
31
|
+
# If vagrant-cachier cache buckets are available, drop it there
|
32
|
+
if comm.test("test -d /tmp/vagrant-cache")
|
33
|
+
"/tmp/vagrant-cache/phantomjs-#{version}.tar.bz2"
|
34
|
+
else
|
35
|
+
"/tmp/phantomjs-#{version}.tar.bz2"
|
36
|
+
end
|
37
|
+
end
|
20
38
|
end
|
21
39
|
end
|
22
40
|
end
|
@@ -26,6 +26,8 @@ module VagrantPlugins
|
|
26
26
|
machine.env.ui.info("Installing Python #{version}")
|
27
27
|
machine.communicate.execute("pyenv install #{version}")
|
28
28
|
machine.communicate.execute("pyenv global #{version}")
|
29
|
+
else
|
30
|
+
machine.env.ui.info("Skipping Python '#{version}' installation")
|
29
31
|
end
|
30
32
|
end
|
31
33
|
end
|
@@ -8,6 +8,8 @@ module VagrantPlugins
|
|
8
8
|
machine.env.ui.info("Installing NodeJS #{version}")
|
9
9
|
machine.communicate.execute("nvm install #{version}")
|
10
10
|
machine.communicate.execute("nvm alias default #{version}")
|
11
|
+
else
|
12
|
+
machine.env.ui.info("Skipping NodeJS '#{version}' installation")
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
@@ -8,6 +8,8 @@ module VagrantPlugins
|
|
8
8
|
machine.env.ui.info("Installing Ruby #{version}")
|
9
9
|
machine.communicate.sudo("rvm install #{version}")
|
10
10
|
machine.guest.capability(:install_packages, 'libxslt1-dev', silent: true)
|
11
|
+
else
|
12
|
+
machine.env.ui.info("Skipping Ruby #{version} installation")
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
@@ -7,7 +7,7 @@ module VagrantPlugins
|
|
7
7
|
machine.communicate.tap do |comm|
|
8
8
|
if ! comm.test('test -f /etc/init/ventriloquist.conf')
|
9
9
|
machine.env.ui.info('Configuring Ventriloquist services upstart')
|
10
|
-
|
10
|
+
comm.sudo '
|
11
11
|
cat<<EOF > /etc/init/ventriloquist.conf
|
12
12
|
description "Restart configured Ventriloquist services after reboot"
|
13
13
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Cap
|
4
|
+
module Debian
|
5
|
+
module PrepareContainerForDocker
|
6
|
+
def self.prepare_container_for_docker(machine)
|
7
|
+
machine.communicate.tap do |comm|
|
8
|
+
# Disable the default lxc bridge to prevent issues when starting the container
|
9
|
+
if ! comm.test('test -f /etc/default/lxc')
|
10
|
+
comm.sudo '
|
11
|
+
cat <<STR > /etc/default/lxc
|
12
|
+
LXC_AUTO="false"
|
13
|
+
USE_LXC_BRIDGE="false"
|
14
|
+
STR
|
15
|
+
apt-get update && \
|
16
|
+
apt-get install -y --force-yes lxc \
|
17
|
+
-o Dpkg::Options::="--force-confdef" \
|
18
|
+
-o Dpkg::Options::="--force-confold"'
|
19
|
+
end
|
20
|
+
|
21
|
+
# Switch to lxc execution driver as wasn't able to get libcontainer to work
|
22
|
+
if ! comm.test('$(grep -q "-e lxc" /etc/default/docker)')
|
23
|
+
comm.sudo '
|
24
|
+
cat <<STR >> /etc/default/docker
|
25
|
+
DOCKER_OPTS="-e lxc ${DOCKER_OPTS}"
|
26
|
+
STR
|
27
|
+
service docker restart'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -3,19 +3,19 @@ module VagrantPlugins
|
|
3
3
|
module Cap
|
4
4
|
module Linux
|
5
5
|
module Download
|
6
|
-
def self.download(machine,
|
6
|
+
def self.download(machine, srcs, destination)
|
7
7
|
machine.communicate.tap do |comm|
|
8
8
|
if comm.test('which wget')
|
9
|
-
download_with_wget(machine,
|
9
|
+
download_with_wget(machine, srcs, destination)
|
10
10
|
|
11
11
|
elsif comm.test('which curl')
|
12
|
-
download_with_curl(machine,
|
12
|
+
download_with_curl(machine, srcs, destination)
|
13
13
|
|
14
14
|
# If neither wget or curl could be found, try installing
|
15
15
|
# curl
|
16
16
|
elsif machine.capability?(:install_packages)
|
17
17
|
machine.guest.capability(:install_packages, 'curl')
|
18
|
-
download_with_curl(machine,
|
18
|
+
download_with_curl(machine, srcs, destination)
|
19
19
|
|
20
20
|
else
|
21
21
|
raise 'Unable to download file for guest VM!'
|
@@ -23,14 +23,28 @@ module VagrantPlugins
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
def self.download_with_wget(machine,
|
27
|
-
|
28
|
-
|
26
|
+
def self.download_with_wget(machine, srcs, destination)
|
27
|
+
Array(srcs).each_with_index do |src, idx|
|
28
|
+
machine.env.ui.info("Attempting to download '#{src}' to '#{destination}'")
|
29
|
+
begin
|
30
|
+
machine.communicate.execute("wget #{src} -O #{destination} || { rm -f #{destination} && exit 1; }")
|
31
|
+
break
|
32
|
+
rescue Vagrant::Errors::VagrantError => e
|
33
|
+
raise if idx + 1 == srcs.size
|
34
|
+
end
|
35
|
+
end
|
29
36
|
end
|
30
37
|
|
31
|
-
def self.download_with_curl(machine,
|
32
|
-
|
33
|
-
|
38
|
+
def self.download_with_curl(machine, srcs, destination)
|
39
|
+
Array(srcs).each_with_index do |src, idx|
|
40
|
+
machine.env.ui.info("Attempting to download '#{src}' to '#{destination}'")
|
41
|
+
begin
|
42
|
+
machine.communicate.execute("curl #{src} -o #{destination} || { rm -f #{destination} && exit 1; }")
|
43
|
+
break
|
44
|
+
rescue Vagrant::Errors::VagrantError => e
|
45
|
+
raise if idx + 1 == srcs.size
|
46
|
+
end
|
47
|
+
end
|
34
48
|
end
|
35
49
|
end
|
36
50
|
end
|
@@ -1,6 +1,11 @@
|
|
1
1
|
module VagrantPlugins
|
2
2
|
module Ventriloquist
|
3
3
|
class Plugin < Vagrant.plugin("2")
|
4
|
+
guest_capability("debian", "prepare_container_for_docker") do
|
5
|
+
require_relative "utils/debian/prepare_container_for_docker"
|
6
|
+
Cap::Debian::PrepareContainerForDocker
|
7
|
+
end
|
8
|
+
|
4
9
|
guest_capability("debian", "git_install") do
|
5
10
|
require_relative "utils/debian/git_install"
|
6
11
|
Cap::Debian::GitInstall
|
data/lib/ventriloquist/config.rb
CHANGED
@@ -3,10 +3,15 @@ module VagrantPlugins
|
|
3
3
|
module Platforms
|
4
4
|
class Elixir < Platform
|
5
5
|
def provision(machine)
|
6
|
-
|
6
|
+
if @config[:versions].empty?
|
7
|
+
machine.env.ui.warn('No elixir version specified, skipping installation')
|
8
|
+
return
|
9
|
+
elsif @config[:versions].size > 1
|
10
|
+
machine.env.ui.warn('Multiple versions specified for elixir, installing the first one configured')
|
11
|
+
end
|
7
12
|
machine.guest.tap do |guest|
|
8
13
|
guest.capability(:erlang_install)
|
9
|
-
guest.capability(:elixir_install, @config[:
|
14
|
+
guest.capability(:elixir_install, @config[:versions].first)
|
10
15
|
end
|
11
16
|
end
|
12
17
|
end
|
@@ -3,6 +3,9 @@ module VagrantPlugins
|
|
3
3
|
module Platforms
|
4
4
|
class Erlang < Platform
|
5
5
|
def provision(machine)
|
6
|
+
if ! @config[:versions].empty?
|
7
|
+
machine.env.ui.warn('Multiple versions of erlang were specified but the latest one will be installed')
|
8
|
+
end
|
6
9
|
machine.guest.capability(:erlang_install)
|
7
10
|
end
|
8
11
|
end
|
@@ -3,9 +3,14 @@ module VagrantPlugins
|
|
3
3
|
module Platforms
|
4
4
|
class Go < Platform
|
5
5
|
def provision(machine)
|
6
|
-
|
6
|
+
if @config[:versions].empty?
|
7
|
+
machine.env.ui.warn('No golang version specified, skipping installation')
|
8
|
+
return
|
9
|
+
elsif @config[:versions].size > 1
|
10
|
+
machine.env.ui.warn('Multiple versions specified for golang, installing the first one configured')
|
11
|
+
end
|
7
12
|
machine.guest.capability(:mercurial_install)
|
8
|
-
machine.guest.capability(:go_install, @config[:
|
13
|
+
machine.guest.capability(:go_install, @config[:versions].first)
|
9
14
|
end
|
10
15
|
end
|
11
16
|
end
|
@@ -3,11 +3,18 @@ module VagrantPlugins
|
|
3
3
|
module Platforms
|
4
4
|
class NodeJS < Platform
|
5
5
|
def provision(machine)
|
6
|
-
|
6
|
+
if @config[:versions].empty?
|
7
|
+
machine.env.ui.warn('No nodejs version was specified and only nvm will be installed')
|
8
|
+
end
|
9
|
+
|
7
10
|
machine.guest.tap do |guest|
|
8
11
|
guest.capability(:install_packages, 'curl', silent: true)
|
9
12
|
guest.capability(:nvm_install)
|
10
|
-
|
13
|
+
# Reverse array so that the first version specified is installed last
|
14
|
+
# and gets set as the default
|
15
|
+
@config[:versions].reverse.each do |version|
|
16
|
+
guest.capability(:nvm_install_nodejs, version)
|
17
|
+
end
|
11
18
|
end
|
12
19
|
end
|
13
20
|
end
|
@@ -3,8 +3,13 @@ module VagrantPlugins
|
|
3
3
|
module Platforms
|
4
4
|
class PhantomJS < Platform
|
5
5
|
def provision(machine)
|
6
|
-
@config[:
|
7
|
-
|
6
|
+
if @config[:versions].empty?
|
7
|
+
machine.env.ui.warn('No phantomjs version specified, skipping installation')
|
8
|
+
return
|
9
|
+
elsif @config[:versions].size > 1
|
10
|
+
machine.env.ui.warn('Multiple versions specified for phantomjs, installing the first one configured')
|
11
|
+
end
|
12
|
+
machine.guest.capability(:phantomjs_install, @config[:versions].first)
|
8
13
|
end
|
9
14
|
end
|
10
15
|
end
|
@@ -3,10 +3,17 @@ module VagrantPlugins
|
|
3
3
|
module Platforms
|
4
4
|
class Python < Platform
|
5
5
|
def provision(machine)
|
6
|
-
|
6
|
+
if @config[:versions].empty?
|
7
|
+
machine.env.ui.warn('No python version was specified and only pyenv will be installed')
|
8
|
+
end
|
9
|
+
|
7
10
|
machine.guest.tap do |guest|
|
8
11
|
guest.capability(:pyenv_install)
|
9
|
-
|
12
|
+
# Reverse array so that the first version specified is installed last
|
13
|
+
# and gets set as the default
|
14
|
+
@config[:versions].reverse.each do |version|
|
15
|
+
guest.capability(:pyenv_install_python, version)
|
16
|
+
end
|
10
17
|
end
|
11
18
|
end
|
12
19
|
end
|
@@ -3,11 +3,18 @@ module VagrantPlugins
|
|
3
3
|
module Platforms
|
4
4
|
class Ruby < Platform
|
5
5
|
def provision(machine)
|
6
|
-
|
6
|
+
if @config[:versions].empty?
|
7
|
+
machine.env.ui.warn('No ruby version was specified and only rvm will be installed')
|
8
|
+
end
|
9
|
+
|
7
10
|
machine.guest.tap do |guest|
|
8
11
|
guest.capability(:install_packages, 'curl', silent: true)
|
9
12
|
guest.capability(:rvm_install)
|
10
|
-
|
13
|
+
# Reverse array so that the first version specified is installed last
|
14
|
+
# and gets set as the default
|
15
|
+
@config[:versions].reverse.each do |version|
|
16
|
+
guest.capability(:rvm_install_ruby, version)
|
17
|
+
end
|
11
18
|
end
|
12
19
|
end
|
13
20
|
end
|
@@ -51,8 +51,13 @@ module VagrantPlugins
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def create_platform_provisioner(name, config)
|
54
|
-
name, version = name.to_s.split('
|
55
|
-
|
54
|
+
name, version = name.to_s.split('-')
|
55
|
+
|
56
|
+
if version
|
57
|
+
config[:versions] = [version]
|
58
|
+
else
|
59
|
+
config[:versions] = Array(config[:versions])
|
60
|
+
end
|
56
61
|
|
57
62
|
klass = @mapping.fetch(name.to_s)
|
58
63
|
klass.new(name, config)
|
data/lib/ventriloquist/plugin.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require "
|
2
|
-
require "
|
1
|
+
require Vagrant.source_root.join("plugins/provisioners/docker/client")
|
2
|
+
require Vagrant.source_root.join("plugins/provisioners/docker/installer")
|
3
3
|
|
4
4
|
require_relative "errors"
|
5
5
|
require_relative "services_builder"
|
@@ -12,8 +12,8 @@ module VagrantPlugins
|
|
12
12
|
class Provisioner < Vagrant.plugin("2", :provisioner)
|
13
13
|
def initialize(machine, config, installer = nil, client = nil)
|
14
14
|
super(machine, config)
|
15
|
-
@installer = installer ||
|
16
|
-
@client = client ||
|
15
|
+
@installer = installer || Docker::Installer.new(@machine, config.docker_version)
|
16
|
+
@client = client || Docker::Client.new(@machine)
|
17
17
|
end
|
18
18
|
|
19
19
|
def provision
|
@@ -46,8 +46,13 @@ module VagrantPlugins
|
|
46
46
|
@machine.guest.capability(:ventriloquist_containers_upstart)
|
47
47
|
end
|
48
48
|
|
49
|
+
if @machine.provider_name == :lxc && @machine.guest.capability?(:prepare_container_for_docker)
|
50
|
+
@logger.info("vagrant-lxc container detected, will install lxc and tweak Docker settings")
|
51
|
+
@machine.guest.capability(:prepare_container_for_docker)
|
52
|
+
end
|
53
|
+
|
49
54
|
unless @client.daemon_running?
|
50
|
-
raise
|
55
|
+
raise 'Docker client is not running'
|
51
56
|
end
|
52
57
|
|
53
58
|
ServicesBuilder.build(config.services, @client).each do |service|
|
@@ -17,11 +17,10 @@ module VagrantPlugins
|
|
17
17
|
else
|
18
18
|
machine.env.ui.info("Starting '#{@name}' service")
|
19
19
|
machine.communicate.sudo("mkdir -p #{CONTAINER_IDS_PATH}")
|
20
|
-
|
21
|
-
|
22
|
-
@config[:
|
23
|
-
@config[:
|
24
|
-
@config[:cidfile] = cidfile
|
20
|
+
@config[:cidfile] = cidfile
|
21
|
+
@config[:daemonize] = true
|
22
|
+
@config[:name] = @name
|
23
|
+
@config[:auto_assign_name] = true
|
25
24
|
@docker_client.run_container(@config)
|
26
25
|
end
|
27
26
|
end
|