ventriloquist 0.0.1 → 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/.gitignore +1 -1
- data/.rspec +2 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +118 -0
- data/Guardfile +5 -0
- data/LICENSE.txt +1 -1
- data/README.md +191 -9
- data/Rakefile +2 -0
- data/development/Vagrantfile +50 -0
- data/lib/ventriloquist/cap/debian/git_install.rb +18 -0
- data/lib/ventriloquist/cap/debian/go_install.rb +34 -0
- data/lib/ventriloquist/cap/debian/install_build_tools.rb +18 -0
- data/lib/ventriloquist/cap/debian/mercurial_install.rb +18 -0
- data/lib/ventriloquist/cap/debian/mysql_install_client.rb +18 -0
- data/lib/ventriloquist/cap/debian/mysql_install_headers.rb +18 -0
- data/lib/ventriloquist/cap/debian/nodejs_install.rb +21 -0
- data/lib/ventriloquist/cap/debian/pg_install_client.rb +18 -0
- data/lib/ventriloquist/cap/debian/pg_install_headers.rb +18 -0
- data/lib/ventriloquist/cap/debian/phantomjs_install.rb +24 -0
- data/lib/ventriloquist/cap/debian/ventriloquist_containers_upstart.rb +33 -0
- data/lib/ventriloquist/cap/linux/download.rb +26 -0
- data/lib/ventriloquist/cap/linux/make.rb +14 -0
- data/lib/ventriloquist/cap/linux/mysql_configure_client.rb +18 -0
- data/lib/ventriloquist/cap/linux/pg_export_pghost.rb +18 -0
- data/lib/ventriloquist/cap/linux/rvm_install.rb +17 -0
- data/lib/ventriloquist/cap/linux/rvm_install_ruby.rb +18 -0
- data/lib/ventriloquist/cap/linux/untar.rb +14 -0
- data/lib/ventriloquist/config.rb +12 -0
- data/lib/ventriloquist/errors.rb +8 -0
- data/lib/ventriloquist/platform.rb +11 -0
- data/lib/ventriloquist/platforms/go.rb +13 -0
- data/lib/ventriloquist/platforms/nodejs.rb +11 -0
- data/lib/ventriloquist/platforms/phantomjs.rb +12 -0
- data/lib/ventriloquist/platforms/ruby.rb +15 -0
- data/lib/ventriloquist/platforms_builder.rb +56 -0
- data/lib/ventriloquist/plugin.rb +119 -0
- data/lib/ventriloquist/provisioner.rb +59 -0
- data/lib/ventriloquist/service.rb +23 -0
- data/lib/ventriloquist/services/mysql.rb +39 -0
- data/lib/ventriloquist/services/postgresql.rb +39 -0
- data/lib/ventriloquist/services/redis.rb +31 -0
- data/lib/ventriloquist/services_builder.rb +66 -0
- data/lib/ventriloquist/version.rb +4 -2
- data/lib/ventriloquist.rb +1 -5
- data/locales/en.yml +1 -0
- data/services/base/Dockerfile +15 -0
- data/services/build-all.sh +20 -0
- data/services/elasticsearch/Dockerfile +12 -0
- data/services/memcached/Dockerfile +17 -0
- data/services/mysql/Dockerfile +20 -0
- data/services/mysql/config/bin/add-mysql-user +19 -0
- data/services/openjdk7/Dockerfile +9 -0
- data/services/postgresql/9.1/Dockerfile +20 -0
- data/services/postgresql/9.1/config/bin/prepare-postgres +27 -0
- data/services/postgresql/9.1/config/bin/start-postgres +6 -0
- data/services/postgresql/9.1/config/etc/postgresql/9.1/main/pg_hba.conf +3 -0
- data/services/postgresql/9.2/Dockerfile +15 -0
- data/services/postgresql/9.2/config/bin/prepare-postgres +25 -0
- data/services/postgresql/9.2/config/bin/start-postgres +6 -0
- data/services/postgresql/9.2/config/etc/postgresql/9.2/main/postgresql.conf +573 -0
- data/services/redis/Dockerfile +11 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/unit/platforms_builder_spec.rb +50 -0
- data/spec/unit/service_spec.rb +38 -0
- data/spec/unit/services_builder_spec.rb +54 -0
- data/tasks/spec.rake +9 -0
- data/ventriloquist.gemspec +16 -13
- metadata +88 -9
@@ -0,0 +1,33 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Cap
|
4
|
+
module Debian
|
5
|
+
module VentriloquistContainersUpstart
|
6
|
+
def self.ventriloquist_containers_upstart(machine)
|
7
|
+
machine.communicate.tap do |comm|
|
8
|
+
if ! comm.test('test -f /etc/init/ventriloquist.conf')
|
9
|
+
machine.env.ui.info('Configuring Ventriloquist services upstart')
|
10
|
+
machine.communicate.sudo '
|
11
|
+
cat<<EOF > /etc/init/ventriloquist.conf
|
12
|
+
description "Restart configured Ventriloquist services after reboot"
|
13
|
+
|
14
|
+
start on (started docker)
|
15
|
+
|
16
|
+
script
|
17
|
+
if [ -d /var/lib/ventriloquist/cids ]; then
|
18
|
+
sleep 1 # Give Docker some time
|
19
|
+
for cidfile in \$(ls /var/lib/ventriloquist/cids/*); do
|
20
|
+
docker start \$(cat \$cidfile)
|
21
|
+
done
|
22
|
+
fi
|
23
|
+
end script
|
24
|
+
respawn
|
25
|
+
EOF'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Cap
|
4
|
+
module Linux
|
5
|
+
module Download
|
6
|
+
# FIXME: Use vagrant downloader and upload to guest machine
|
7
|
+
def self.download(machine, src, destination)
|
8
|
+
machine.communicate.tap do |comm|
|
9
|
+
if comm.test('which wget')
|
10
|
+
machine.env.ui.info("Downloading #{src} to #{destination}")
|
11
|
+
comm.execute("wget #{src} -O #{destination}")
|
12
|
+
|
13
|
+
elsif comm.test('which curl')
|
14
|
+
machine.env.ui.info("Downloading #{src} to #{destination}")
|
15
|
+
comm.execute("curl #{src} -o #{destination}")
|
16
|
+
|
17
|
+
else
|
18
|
+
raise 'Unable to download file for guest VM!'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Cap
|
4
|
+
module Linux
|
5
|
+
module Make
|
6
|
+
def self.make(machine, workdir, target = 'all')
|
7
|
+
machine.env.ui.info("Running `make #{target}` on #{workdir}")
|
8
|
+
machine.communicate.execute("cd #{workdir} && make #{target}")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Cap
|
4
|
+
module Linux
|
5
|
+
module MySqlConfigureClient
|
6
|
+
def self.mysql_configure_client(machine)
|
7
|
+
machine.communicate.tap do |comm|
|
8
|
+
if ! comm.test('grep -q client $HOME/.my.cnf 2>/dev/null')
|
9
|
+
machine.env.ui.info('Setting default MySQL configs')
|
10
|
+
comm.execute('echo -e "[client]\nprotocol=tcp\npassword=vagrant" >> $HOME/.my.cnf')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Cap
|
4
|
+
module Linux
|
5
|
+
module PgExportPghost
|
6
|
+
def self.pg_export_pghost(machine)
|
7
|
+
machine.communicate.tap do |comm|
|
8
|
+
if ! comm.test('grep -q PGHOST /etc/profile.d/ventriloquist.sh 2>/dev/null')
|
9
|
+
machine.env.ui.info('Setting default PGHOST')
|
10
|
+
comm.sudo('echo "export PGHOST=localhost" >> /etc/profile.d/ventriloquist.sh')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Cap
|
4
|
+
module Linux
|
5
|
+
module RvmInstall
|
6
|
+
def self.rvm_install(machine)
|
7
|
+
if ! machine.communicate.test('test -d $HOME/.rvm')
|
8
|
+
machine.env.ui.info('Installing RVM')
|
9
|
+
machine.communicate.execute('\curl -L https://get.rvm.io | bash -s stable --autolibs=enabled')
|
10
|
+
#machine.communicate.execute('rvm requirements')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Cap
|
4
|
+
module Linux
|
5
|
+
module RvmInstallRuby
|
6
|
+
def self.rvm_install_ruby(machine, version)
|
7
|
+
if ! machine.communicate.test("rvm list | grep #{version}")
|
8
|
+
machine.env.ui.info("Installing Ruby #{version}")
|
9
|
+
machine.communicate.execute("rvm install #{version}")
|
10
|
+
# FIXME: THIS IS DEBIAN SPECIFIC
|
11
|
+
machine.communicate.sudo("apt-get install -y libxslt1-dev")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Cap
|
4
|
+
module Linux
|
5
|
+
module Untar
|
6
|
+
def self.untar(machine, src, workdir)
|
7
|
+
machine.env.ui.info("Extracting #{src} to #{workdir}")
|
8
|
+
machine.communicate.execute("cd #{workdir} && tar xvfz #{src}")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Platforms
|
4
|
+
class Go < Platform
|
5
|
+
def provision(machine)
|
6
|
+
@config[:version] = '1.1.2' if @config[:version] == 'latest'
|
7
|
+
machine.guest.capability(:mercurial_install)
|
8
|
+
machine.guest.capability(:go_install, @config[:version])
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Platforms
|
4
|
+
class PhantomJS < Platform
|
5
|
+
def provision(machine)
|
6
|
+
@config[:version] = '1.9.1' if config[:version] == 'latest'
|
7
|
+
machine.guest.capability(:phantomjs_install, @config[:version])
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Platforms
|
4
|
+
class Ruby < Platform
|
5
|
+
def provision(machine)
|
6
|
+
@config[:version] = '2.0.0' if @config[:version] == 'latest'
|
7
|
+
machine.guest.tap do |guest|
|
8
|
+
guest.capability(:rvm_install)
|
9
|
+
guest.capability(:rvm_install_ruby, @config[:version])
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require_relative 'platform'
|
2
|
+
require_relative 'platforms/ruby'
|
3
|
+
require_relative 'platforms/nodejs'
|
4
|
+
require_relative 'platforms/phantomjs'
|
5
|
+
require_relative 'platforms/go'
|
6
|
+
|
7
|
+
module VagrantPlugins
|
8
|
+
module Ventriloquist
|
9
|
+
class PlatformsBuilder
|
10
|
+
MAPPING = {
|
11
|
+
'ruby' => Platforms::Ruby,
|
12
|
+
'nodejs' => Platforms::NodeJS,
|
13
|
+
'phantomjs' => Platforms::PhantomJS,
|
14
|
+
'go' => Platforms::Go,
|
15
|
+
}
|
16
|
+
|
17
|
+
def initialize(platforms, mapping = MAPPING)
|
18
|
+
@platforms = platforms.flatten
|
19
|
+
@mapping = mapping
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.build(platforms)
|
23
|
+
new(platforms).build
|
24
|
+
end
|
25
|
+
|
26
|
+
def build
|
27
|
+
@platforms.each_with_object([]) do |cfg, built_platforms|
|
28
|
+
case cfg
|
29
|
+
when Hash
|
30
|
+
built_platforms.concat build_platforms(cfg)
|
31
|
+
when String, Symbol
|
32
|
+
built_platforms << create_platform_provisioner(cfg, {})
|
33
|
+
else
|
34
|
+
raise "Unknown cfg type: #{cfg.class}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def build_platforms(cfg_hash)
|
42
|
+
cfg_hash.map do |name, config|
|
43
|
+
create_platform_provisioner(name, config)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def create_platform_provisioner(name, config)
|
48
|
+
name, version = name.to_s.split(':')
|
49
|
+
config[:version] ||= (version || 'latest')
|
50
|
+
|
51
|
+
klass = @mapping.fetch(name.to_s)
|
52
|
+
klass.new(name, config)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
require "vagrant"
|
2
|
+
|
3
|
+
Vagrant.require_plugin "vocker"
|
4
|
+
|
5
|
+
require_relative "version"
|
6
|
+
|
7
|
+
I18n.load_path << File.expand_path(File.dirname(__FILE__) + '/../../locales/en.yml')
|
8
|
+
I18n.reload!
|
9
|
+
|
10
|
+
module VagrantPlugins
|
11
|
+
module Ventriloquist
|
12
|
+
class Plugin < Vagrant.plugin("2")
|
13
|
+
name "Ventriloquist"
|
14
|
+
description <<-DESC
|
15
|
+
Vagrant development environments made easy
|
16
|
+
DESC
|
17
|
+
|
18
|
+
provisioner(:ventriloquist) do
|
19
|
+
require_relative "provisioner"
|
20
|
+
Provisioner
|
21
|
+
end
|
22
|
+
|
23
|
+
config(:ventriloquist, :provisioner) do
|
24
|
+
require_relative "config"
|
25
|
+
Config
|
26
|
+
end
|
27
|
+
|
28
|
+
guest_capability("debian", "pg_install_client") do
|
29
|
+
require_relative "cap/debian/pg_install_client"
|
30
|
+
Cap::Debian::PgInstallClient
|
31
|
+
end
|
32
|
+
|
33
|
+
guest_capability("debian", "pg_install_headers") do
|
34
|
+
require_relative "cap/debian/pg_install_headers"
|
35
|
+
Cap::Debian::PgInstallHeaders
|
36
|
+
end
|
37
|
+
|
38
|
+
guest_capability("linux", "pg_export_pghost") do
|
39
|
+
require_relative "cap/linux/pg_export_pghost"
|
40
|
+
Cap::Linux::PgExportPghost
|
41
|
+
end
|
42
|
+
|
43
|
+
guest_capability("debian", "mysql_install_client") do
|
44
|
+
require_relative "cap/debian/mysql_install_client"
|
45
|
+
Cap::Debian::MySqlInstallClient
|
46
|
+
end
|
47
|
+
|
48
|
+
guest_capability("debian", "mysql_install_headers") do
|
49
|
+
require_relative "cap/debian/mysql_install_headers"
|
50
|
+
Cap::Debian::MySqlInstallHeaders
|
51
|
+
end
|
52
|
+
|
53
|
+
guest_capability("linux", "mysql_configure_client") do
|
54
|
+
require_relative "cap/linux/mysql_configure_client"
|
55
|
+
Cap::Linux::MySqlConfigureClient
|
56
|
+
end
|
57
|
+
|
58
|
+
guest_capability("debian", "git_install") do
|
59
|
+
require_relative "cap/debian/git_install"
|
60
|
+
Cap::Debian::GitInstall
|
61
|
+
end
|
62
|
+
|
63
|
+
guest_capability("debian", "mercurial_install") do
|
64
|
+
require_relative "cap/debian/mercurial_install"
|
65
|
+
Cap::Debian::MercurialInstall
|
66
|
+
end
|
67
|
+
|
68
|
+
guest_capability("linux", "make") do
|
69
|
+
require_relative "cap/linux/make"
|
70
|
+
Cap::Linux::Make
|
71
|
+
end
|
72
|
+
|
73
|
+
guest_capability("debian", "install_build_tools") do
|
74
|
+
require_relative "cap/debian/install_build_tools"
|
75
|
+
Cap::Debian::InstallBuildTools
|
76
|
+
end
|
77
|
+
|
78
|
+
guest_capability("debian", "ventriloquist_containers_upstart") do
|
79
|
+
require_relative "cap/debian/ventriloquist_containers_upstart"
|
80
|
+
Cap::Debian::VentriloquistContainersUpstart
|
81
|
+
end
|
82
|
+
|
83
|
+
guest_capability("linux", "download") do
|
84
|
+
require_relative "cap/linux/download"
|
85
|
+
Cap::Linux::Download
|
86
|
+
end
|
87
|
+
|
88
|
+
guest_capability("linux", "untar") do
|
89
|
+
require_relative "cap/linux/untar"
|
90
|
+
Cap::Linux::Untar
|
91
|
+
end
|
92
|
+
|
93
|
+
guest_capability("debian", "nodejs_install") do
|
94
|
+
require_relative "cap/debian/nodejs_install"
|
95
|
+
Cap::Debian::NodejsInstall
|
96
|
+
end
|
97
|
+
|
98
|
+
guest_capability("linux", "rvm_install") do
|
99
|
+
require_relative "cap/linux/rvm_install"
|
100
|
+
Cap::Linux::RvmInstall
|
101
|
+
end
|
102
|
+
|
103
|
+
guest_capability("debian", "phantomjs_install") do
|
104
|
+
require_relative "cap/debian/phantomjs_install"
|
105
|
+
Cap::Debian::PhantomjsInstall
|
106
|
+
end
|
107
|
+
|
108
|
+
guest_capability("debian", "go_install") do
|
109
|
+
require_relative "cap/debian/go_install"
|
110
|
+
Cap::Debian::GoInstall
|
111
|
+
end
|
112
|
+
|
113
|
+
guest_capability("linux", "rvm_install_ruby") do
|
114
|
+
require_relative "cap/linux/rvm_install_ruby"
|
115
|
+
Cap::Linux::RvmInstallRuby
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require "vocker/docker_client"
|
2
|
+
require "vocker/docker_installer"
|
3
|
+
|
4
|
+
require_relative "errors"
|
5
|
+
require_relative "services_builder"
|
6
|
+
require_relative "platforms_builder"
|
7
|
+
|
8
|
+
module VagrantPlugins
|
9
|
+
module Ventriloquist
|
10
|
+
# TODO: Improve handling of vagrant-lxc specifics (like checking for apparmor
|
11
|
+
# profile stuff + autocorrection)
|
12
|
+
class Provisioner < Vagrant.plugin("2", :provisioner)
|
13
|
+
def initialize(machine, config, installer = nil, client = nil)
|
14
|
+
super(machine, config)
|
15
|
+
@installer = installer || Vocker::DockerInstaller.new(@machine)
|
16
|
+
@client = client || Vocker::DockerClient.new(@machine)
|
17
|
+
end
|
18
|
+
|
19
|
+
def provision
|
20
|
+
@logger = Log4r::Logger.new("vagrant::provisioners::ventriloquist")
|
21
|
+
|
22
|
+
provision_services
|
23
|
+
provision_platforms
|
24
|
+
end
|
25
|
+
|
26
|
+
protected
|
27
|
+
|
28
|
+
def provision_services
|
29
|
+
return if config.services.empty?
|
30
|
+
|
31
|
+
@logger.info("Checking for Docker installation...")
|
32
|
+
@installer.ensure_installed
|
33
|
+
|
34
|
+
if @machine.guest.capability?(:ventriloquist_containers_upstart)
|
35
|
+
@machine.guest.capability(:ventriloquist_containers_upstart)
|
36
|
+
end
|
37
|
+
|
38
|
+
unless @client.daemon_running?
|
39
|
+
raise Vocker::Errors::DockerNotRunning
|
40
|
+
end
|
41
|
+
|
42
|
+
ServicesBuilder.build(config.services, @client).each do |service|
|
43
|
+
service.provision(@machine)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def provision_platforms
|
48
|
+
return if config.platforms.empty?
|
49
|
+
|
50
|
+
# Install git so we can install "stuff" from sources
|
51
|
+
@machine.guest.capability(:git_install)
|
52
|
+
|
53
|
+
PlatformsBuilder.build(config.platforms).each do |platform|
|
54
|
+
platform.provision(@machine)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
class Service
|
4
|
+
CONTAINER_IDS_PATH = '/var/lib/ventriloquist/cids'
|
5
|
+
|
6
|
+
attr_reader :name, :config, :docker_client
|
7
|
+
|
8
|
+
def initialize(name, config, docker_client)
|
9
|
+
@name, @config, @docker_client = name, config, docker_client
|
10
|
+
end
|
11
|
+
|
12
|
+
def provision(machine)
|
13
|
+
machine.env.ui.info("Starting #{@name} service")
|
14
|
+
machine.communicate.sudo("mkdir -p #{CONTAINER_IDS_PATH}")
|
15
|
+
# Reduce network latency, see https://groups.google.com/d/msg/docker-user/Z3zQuRawIsE/2AEkl30WpTQJ
|
16
|
+
# for more info
|
17
|
+
@config[:dns] = '127.0.0.1'
|
18
|
+
@config[:cidfile] = "#{CONTAINER_IDS_PATH}/#{@name}"
|
19
|
+
@docker_client.run_container(@config)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Services
|
4
|
+
class MySql < Service
|
5
|
+
def provision(machine)
|
6
|
+
super
|
7
|
+
|
8
|
+
@machine = machine
|
9
|
+
|
10
|
+
install_client
|
11
|
+
install_headers
|
12
|
+
configure_client
|
13
|
+
end
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
def install_client
|
18
|
+
if @machine.guest.capability?(:mysql_install_client)
|
19
|
+
@machine.guest.capability(:mysql_install_client)
|
20
|
+
else
|
21
|
+
@machine.env.ui.warn 'Unable to install the MySQL client'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def install_headers
|
26
|
+
if @machine.guest.capability?(:mysql_install_headers)
|
27
|
+
@machine.guest.capability(:mysql_install_headers)
|
28
|
+
else
|
29
|
+
@machine.env.ui.warn 'Unable to install MySQL header files'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def configure_client
|
34
|
+
@machine.guest.capability(:mysql_configure_client)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Services
|
4
|
+
class PostgreSQL < Service
|
5
|
+
def provision(machine)
|
6
|
+
super
|
7
|
+
|
8
|
+
@machine = machine
|
9
|
+
|
10
|
+
install_client
|
11
|
+
install_headers
|
12
|
+
export_host
|
13
|
+
end
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
def install_client
|
18
|
+
if @machine.guest.capability?(:pg_install_client)
|
19
|
+
@machine.guest.capability(:pg_install_client)
|
20
|
+
else
|
21
|
+
@machine.env.ui.warn 'Unable to install the PostgreSQL client'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def install_headers
|
26
|
+
if @machine.guest.capability?(:pg_install_headers)
|
27
|
+
@machine.guest.capability(:pg_install_headers)
|
28
|
+
else
|
29
|
+
@machine.env.ui.warn 'Unable to install PostgreSQL header files'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def export_host
|
34
|
+
@machine.guest.capability(:pg_export_pghost)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Services
|
4
|
+
class Redis < Service
|
5
|
+
def provision(machine)
|
6
|
+
super
|
7
|
+
install_client(machine)
|
8
|
+
end
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
# TODO: Use the same version as the configured service
|
13
|
+
def install_client(machine)
|
14
|
+
return if machine.communicate.test('which redis-cli > /dev/null')
|
15
|
+
|
16
|
+
machine.guest.tap do |guest|
|
17
|
+
guest.capability(:install_build_tools)
|
18
|
+
guest.capability(:download, 'http://download.redis.io/redis-stable.tar.gz', '/tmp/redis-stable.tar.gz')
|
19
|
+
guest.capability(:untar, '/tmp/redis-stable.tar.gz', '/tmp')
|
20
|
+
guest.capability(:make, '/tmp/redis-stable', 'redis-cli')
|
21
|
+
end
|
22
|
+
|
23
|
+
machine.communicate.tap do |comm|
|
24
|
+
comm.sudo('cp /tmp/redis-stable/src/redis-cli /usr/local/bin')
|
25
|
+
comm.execute('rm -rf /tmp/redis-stable*')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|