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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 622451e1fa3cb26754ad42f9aebbc3951dbca561
|
4
|
+
data.tar.gz: 0932280472ea91d43f57ce5a187c3f92bf80710d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: caeb20bb176e52a457af45a10807b2c9be4d25ce4dd45bba81fb150264b8e4d367b9558f07592aaabb36156a5a7e8525aac3f3e4f5205ae1f12a2055b29b9ec6
|
7
|
+
data.tar.gz: 190dac27b55fb95cc50a2f4aea6faf48cc7452b72827da819dfcfc2f72e18c1af48aaddd92347b667f407938a3c1bd1059d224736e5cd66e3c410e728b7bc550
|
data/.gitignore
CHANGED
data/.rspec
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
CHANGED
@@ -2,3 +2,19 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in ventriloquist.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
group :development, :test do
|
7
|
+
gem 'rake'
|
8
|
+
gem 'vagrant', github: 'mitchellh/vagrant', tag: 'v1.2.7'
|
9
|
+
gem 'rspec'
|
10
|
+
gem 'simplecov', require: false
|
11
|
+
gem 'bogus'
|
12
|
+
end
|
13
|
+
|
14
|
+
group :development do
|
15
|
+
gem 'vagrant-lxc', github: 'fgrehm/vagrant-lxc'
|
16
|
+
gem 'vagrant-pristine', github: 'fgrehm/vagrant-pristine'
|
17
|
+
gem 'vagrant-global-status', github: 'fgrehm/vagrant-global-status'
|
18
|
+
gem 'vagrant-cachier', github: 'fgrehm/vagrant-cachier'
|
19
|
+
gem 'guard-rspec'
|
20
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/fgrehm/vagrant-cachier.git
|
3
|
+
revision: f8484f73434f640b790300085002b084c8a96d6b
|
4
|
+
specs:
|
5
|
+
vagrant-cachier (0.3.3.dev)
|
6
|
+
|
7
|
+
GIT
|
8
|
+
remote: git://github.com/fgrehm/vagrant-global-status.git
|
9
|
+
revision: a0295400a0e47756cbcb8f97ed9f4449b1fb6b56
|
10
|
+
specs:
|
11
|
+
vagrant-global-status (0.1.1)
|
12
|
+
|
13
|
+
GIT
|
14
|
+
remote: git://github.com/fgrehm/vagrant-lxc.git
|
15
|
+
revision: 2c32f1caa6bb6fff1e2d0daefe3f1f675b99474c
|
16
|
+
specs:
|
17
|
+
vagrant-lxc (0.5.1.dev)
|
18
|
+
|
19
|
+
GIT
|
20
|
+
remote: git://github.com/fgrehm/vagrant-pristine.git
|
21
|
+
revision: 5c400d7850fc5f98d9601b59f4c3bd74818650de
|
22
|
+
specs:
|
23
|
+
vagrant-pristine (0.2.0)
|
24
|
+
|
25
|
+
GIT
|
26
|
+
remote: git://github.com/mitchellh/vagrant.git
|
27
|
+
revision: 7ec0ee1d00a916f80b109a298bab08e391945243
|
28
|
+
tag: v1.2.7
|
29
|
+
specs:
|
30
|
+
vagrant (1.2.7)
|
31
|
+
childprocess (~> 0.3.7)
|
32
|
+
erubis (~> 2.7.0)
|
33
|
+
i18n (~> 0.6.0)
|
34
|
+
log4r (~> 1.1.9)
|
35
|
+
net-scp (~> 1.1.0)
|
36
|
+
net-ssh (~> 2.6.6)
|
37
|
+
|
38
|
+
PATH
|
39
|
+
remote: .
|
40
|
+
specs:
|
41
|
+
ventriloquist (0.1.0)
|
42
|
+
vocker (~> 0.3.0)
|
43
|
+
|
44
|
+
GEM
|
45
|
+
remote: https://rubygems.org/
|
46
|
+
specs:
|
47
|
+
bogus (0.1.4)
|
48
|
+
dependor (>= 0.0.4)
|
49
|
+
childprocess (0.3.9)
|
50
|
+
ffi (~> 1.0, >= 1.0.11)
|
51
|
+
coderay (1.0.9)
|
52
|
+
dependor (1.0.1)
|
53
|
+
diff-lcs (1.2.4)
|
54
|
+
erubis (2.7.0)
|
55
|
+
ffi (1.9.0)
|
56
|
+
formatador (0.2.4)
|
57
|
+
guard (1.8.2)
|
58
|
+
formatador (>= 0.2.4)
|
59
|
+
listen (>= 1.0.0)
|
60
|
+
lumberjack (>= 1.0.2)
|
61
|
+
pry (>= 0.9.10)
|
62
|
+
thor (>= 0.14.6)
|
63
|
+
guard-rspec (3.0.2)
|
64
|
+
guard (>= 1.8)
|
65
|
+
rspec (~> 2.13)
|
66
|
+
i18n (0.6.5)
|
67
|
+
listen (1.3.1)
|
68
|
+
rb-fsevent (>= 0.9.3)
|
69
|
+
rb-inotify (>= 0.9)
|
70
|
+
rb-kqueue (>= 0.2)
|
71
|
+
log4r (1.1.10)
|
72
|
+
lumberjack (1.0.4)
|
73
|
+
method_source (0.8.2)
|
74
|
+
multi_json (1.7.9)
|
75
|
+
net-scp (1.1.2)
|
76
|
+
net-ssh (>= 2.6.5)
|
77
|
+
net-ssh (2.6.8)
|
78
|
+
pry (0.9.12.2)
|
79
|
+
coderay (~> 1.0.5)
|
80
|
+
method_source (~> 0.8)
|
81
|
+
slop (~> 3.4)
|
82
|
+
rake (10.1.0)
|
83
|
+
rb-fsevent (0.9.3)
|
84
|
+
rb-inotify (0.9.1)
|
85
|
+
ffi (>= 0.5.0)
|
86
|
+
rb-kqueue (0.2.0)
|
87
|
+
ffi (>= 0.5.0)
|
88
|
+
rspec (2.14.1)
|
89
|
+
rspec-core (~> 2.14.0)
|
90
|
+
rspec-expectations (~> 2.14.0)
|
91
|
+
rspec-mocks (~> 2.14.0)
|
92
|
+
rspec-core (2.14.5)
|
93
|
+
rspec-expectations (2.14.2)
|
94
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
95
|
+
rspec-mocks (2.14.3)
|
96
|
+
simplecov (0.7.1)
|
97
|
+
multi_json (~> 1.0)
|
98
|
+
simplecov-html (~> 0.7.1)
|
99
|
+
simplecov-html (0.7.1)
|
100
|
+
slop (3.4.6)
|
101
|
+
thor (0.18.1)
|
102
|
+
vocker (0.3.0)
|
103
|
+
|
104
|
+
PLATFORMS
|
105
|
+
ruby
|
106
|
+
|
107
|
+
DEPENDENCIES
|
108
|
+
bogus
|
109
|
+
guard-rspec
|
110
|
+
rake
|
111
|
+
rspec
|
112
|
+
simplecov
|
113
|
+
vagrant!
|
114
|
+
vagrant-cachier!
|
115
|
+
vagrant-global-status!
|
116
|
+
vagrant-lxc!
|
117
|
+
vagrant-pristine!
|
118
|
+
ventriloquist!
|
data/Guardfile
ADDED
data/LICENSE.txt
CHANGED
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,24 +1,206 @@
|
|
1
1
|
# Ventriloquist
|
2
2
|
|
3
|
-
|
3
|
+
> **ven·tril·o·quist**: _(noun)_ a person who can speak or utter sounds so that
|
4
|
+
they seem to come from somewhere else, esp. an entertainer who makes their voice
|
5
|
+
appear to come from a dummy of a person or animal.
|
4
6
|
|
5
|
-
|
7
|
+
Ventriloquist combines [Vagrant](http://www.vagrantup.com/) and [Docker](http://www.docker.io/)
|
8
|
+
to give **developers** the ability to configure portable and disposable development
|
9
|
+
VMs with ease. It lowers the entry barrier of building a sane working environment without
|
10
|
+
the need to learn tools like [Puppet](http://puppetlabs.com/puppet/what-is-puppet)
|
11
|
+
or [Chef](http://www.opscode.com/chef/).
|
12
|
+
|
13
|
+
Its core is made of a Vagrant plugin that uses a set of opinionated Docker
|
14
|
+
images + some [guest capabilities](http://docs.vagrantup.com/v2/plugins/guest-capabilities.html)
|
15
|
+
to provision VMs with services and programming language environments, think of
|
16
|
+
it as a "Heroku for Vagrant" where a Dyno is your Vagrant machine and Docker
|
17
|
+
services are its addons.
|
18
|
+
|
19
|
+
To give you an idea, this is what it takes to configure a Vagrant VM ready
|
20
|
+
for development on [Discourse](http://www.discourse.org/):
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
Vagrant.configure("2") do |config|
|
24
|
+
config.vm.box = "quantal64"
|
25
|
+
config.vm.provision :ventriloquist do |env|
|
26
|
+
env.services = %w( redis pg:9.1 )
|
27
|
+
env.platforms = %w( nodejs ruby:1.9.3 )
|
28
|
+
end
|
29
|
+
end
|
30
|
+
```
|
31
|
+
|
32
|
+
|
33
|
+
## Project Goals
|
34
|
+
|
35
|
+
* Multi purpose, "zero-conf" development environments that fits into a gist.
|
36
|
+
* Production parity for those that have no control of their production machines,
|
37
|
+
like if you are deploying to Heroku or another PaaS.
|
38
|
+
* Be the easiest tool for building other tools development environments.
|
39
|
+
* Be a learning playground for hackers, making it easy to learn new programming
|
40
|
+
languages / tools.
|
41
|
+
|
42
|
+
|
43
|
+
## Status
|
44
|
+
|
45
|
+
Early development, the feature set and configuration format might change rapidly
|
46
|
+
and has only been tested on the following Ubuntu 13.04 Vagrant VMs using Docker
|
47
|
+
0.6.1 and Vagrant 1.2.7 / 1.3.0:
|
6
48
|
|
7
|
-
|
49
|
+
* http://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-amd64-vagrant-disk1.box
|
50
|
+
* http://bit.ly/vagrant-lxc-raring64-2013-07-12 (yes! LXC inception :)
|
8
51
|
|
9
|
-
|
52
|
+
_Please note that in order to use the plugin on [vagrant-lxc](https://github.com/fgrehm/vagrant-lxc)
|
53
|
+
containers you need some extra steps described below_
|
10
54
|
|
11
|
-
|
55
|
+
On its current state is a "somewhat stable experiment" as I've been using a setup with the
|
56
|
+
plugin without issues for more than a week now.
|
12
57
|
|
13
|
-
$ bundle
|
14
58
|
|
15
|
-
|
59
|
+
## Installation
|
60
|
+
|
61
|
+
Make sure you have Vagrant 1.2+ and run:
|
62
|
+
|
63
|
+
```
|
64
|
+
vagrant plugin install ventriloquist
|
65
|
+
```
|
16
66
|
|
17
|
-
$ gem install ventriloquist
|
18
67
|
|
19
68
|
## Usage
|
20
69
|
|
21
|
-
|
70
|
+
Just add the provisioner block to your Vagrantfile and `vagrant up` it:
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
Vagrant.configure("2") do |config|
|
74
|
+
config.vm.provision :ventriloquist do |env|
|
75
|
+
# Pick the services you need to have around
|
76
|
+
env.services << %w( redis pg:9.1 memcached elasticsearch )
|
77
|
+
# Configure your development environment
|
78
|
+
env.platforms << %w( nodejs ruby:2.0.0 go )
|
79
|
+
end
|
80
|
+
end
|
81
|
+
```
|
82
|
+
|
83
|
+
|
84
|
+
## Available services
|
85
|
+
|
86
|
+
The `services` parameter passed in on the Vagrantfile are the ones built with the
|
87
|
+
Dockerfiles available under [_/services_](services) that are configured to require
|
88
|
+
no additional configuration for usage with the default `vagrant` user that usually
|
89
|
+
comes with Vagrant boxes and will always be available from `localhost` using the
|
90
|
+
default service port (like 5432 for PostgreSQL).
|
91
|
+
|
92
|
+
Some extra steps might be required to simplify the connection with the configured
|
93
|
+
services. As an example, besides running the associated Docker image, setting up
|
94
|
+
PostgreSQL will involve installing the `postgresql-client` package and adding an
|
95
|
+
`export PGHOST=localhost` to the guest's `/etc/profiles.d/ventriloquist.sh` so that
|
96
|
+
the `psql` client works without any extra params.
|
97
|
+
|
98
|
+
Please note that all of the builtin images are available on the Docker registry
|
99
|
+
with the `fgrehm/ventriloquist-` prefix that is ommited on the table below:
|
100
|
+
|
101
|
+
| Name | Provides | Notes |
|
102
|
+
| ------------- | -------------- | ----- |
|
103
|
+
| elasticsearch | 0.90.3 | Runs on port 9200 |
|
104
|
+
| memcached | 1.4.14 | Runs on port 11211 |
|
105
|
+
| pg | PostgreSQL 9.2 | Runs on port 5432 and adds an `export PGHOST=localhost` to the guest's `/etc/profile.d/ventriloquist`. It will also install the `postgresql-client` and `libpq-dev` packages on the guest. |
|
106
|
+
| pg:9.1 | PostgreSQL 9.1 | Same as above |
|
107
|
+
| mysql | 5.5 | Runs on port 3306 and creates a `/home/vagrant/.my.conf`. It will also install the `mysql-client` and `libmysqlclient-dev` packages on the guest. |
|
108
|
+
| redis | 2.4.15 | Runs on port 6379 and installs / compiles the `redis-cli` excutable |
|
109
|
+
|
110
|
+
Since services are just Docker images, you can build your own image, push to the
|
111
|
+
registry and use it on your Vagrantfile, you'll just need to specify its fully
|
112
|
+
qualified name and the corresponding Ventriloquist service:
|
113
|
+
|
114
|
+
```ruby
|
115
|
+
Vagrant.configure("2") do |config|
|
116
|
+
config.vm.provision :ventriloquist do |env|
|
117
|
+
env.services << {
|
118
|
+
redis: { image: 'username/redis' },
|
119
|
+
pg: { image: 'otheruser/pg', tag: 'latest' }
|
120
|
+
}
|
121
|
+
end
|
122
|
+
end
|
123
|
+
```
|
124
|
+
|
125
|
+
|
126
|
+
## Available platforms
|
127
|
+
|
128
|
+
In order to configure the VM for usage with the programming language that your
|
129
|
+
app is written on, the plugin leverages Vagrant's [guest capabilities](http://docs.vagrantup.com/v2/plugins/guest-capabilities.html)
|
130
|
+
to deal with distribution specifics. Right now things should work just fine on
|
131
|
+
Ubuntu VMs and you'll be warned in case you specify a something that is not supported
|
132
|
+
on your guest machine.
|
133
|
+
|
134
|
+
Unless you specify the version to use (like in `ruby:1.9.3` from the Discourse
|
135
|
+
example above), the latest version of the available platforms will be installed.
|
136
|
+
For example, if you omit the Ruby version you want to use, Ventriloquist will
|
137
|
+
install 2.0.0 with the latest path level.
|
138
|
+
|
139
|
+
So far I've only set up the stuff I need to work but feel free to submit a Pull
|
140
|
+
Request with the scripts required to set things for other platforms:
|
141
|
+
|
142
|
+
| Name | Provides |
|
143
|
+
| --------- | ---------------- |
|
144
|
+
| ruby | rvm + Ruby 2.0.0 |
|
145
|
+
| go | 1.1.2 |
|
146
|
+
| nodejs | Currently limited to the latest version available at https://launchpad.net/~chris-lea/+archive/node.js (0.10.17 as of this writing) |
|
147
|
+
| phantomjs | 1.9.1 |
|
148
|
+
|
149
|
+
|
150
|
+
## Ideas for improvements
|
151
|
+
|
152
|
+
* Use a Docker container as the dev environment within the Vagrant VM, maybe using
|
153
|
+
[Buildstep](https://github.com/progrium/buildstep) or something like it to
|
154
|
+
configure it.
|
155
|
+
* Allow services configuration from the Vagrantfile (like setting the max memory
|
156
|
+
used by memcached for example)
|
157
|
+
* Saner defaults for services (none of the provided services have memory / connection
|
158
|
+
limits or the like)
|
159
|
+
* Make use of Docker data volumes for services to avoid loosing data
|
160
|
+
* Introduce "profiles" - `heroku:free` for example would limit postgresql / memcached
|
161
|
+
/ etc resources (like max memory / connections) to what people will get there.
|
162
|
+
* Support for installing "random" tools / packages from within the Vagrantfile
|
163
|
+
(like git / sqlite3 / heroku toolbelt / ruby gems / npm packages)
|
164
|
+
* Leverage [vagrant-cachier](https://github.com/fgrehm/vagrant-cachier) during
|
165
|
+
provisioning
|
166
|
+
* Convert provisioning code to a set of bash scripts so that it can be reused
|
167
|
+
outside of Vagrant environments as well (maybe use them for building [Packer](http://www.packer.io/)
|
168
|
+
images)
|
169
|
+
|
170
|
+
|
171
|
+
### Usage with [vagrant-lxc](https://github.com/fgrehm/vagrant-lxc)
|
172
|
+
|
173
|
+
If you are on a Linux machine, you can use vagrant-lxc to avoid messing up with
|
174
|
+
your working environment. While developing this plugin I was able to recreate
|
175
|
+
containers that were capable of using Docker without issues multiple times on
|
176
|
+
an up to date Ubuntu 13.04 host and guest.
|
177
|
+
|
178
|
+
In order to allow a vagrant-lxc container to boot nested Docker containers you'll
|
179
|
+
just need to `apt-get install apparmor-utils && aa-complain /usr/bin/lxc-start`
|
180
|
+
and add the code below to your Vagrantfile:
|
181
|
+
|
182
|
+
```ruby
|
183
|
+
Vagrant.configure("2") do |config|
|
184
|
+
config.vm.provider :lxc do |lxc|
|
185
|
+
lxc.customize 'aa_profile', 'unconfined'
|
186
|
+
end
|
187
|
+
|
188
|
+
config.vm.provision :shell, inline: %[
|
189
|
+
if ! [ -f /etc/default/lxc ]; then
|
190
|
+
cat <<STR > /etc/default/lxc
|
191
|
+
LXC_AUTO="false"
|
192
|
+
USE_LXC_BRIDGE="false"
|
193
|
+
STR
|
194
|
+
fi
|
195
|
+
]
|
196
|
+
end
|
197
|
+
```
|
198
|
+
|
199
|
+
The LXC networking configs are only required if you are on an Ubuntu host as
|
200
|
+
it automatically creates the `lxcbr0` bridge for you on the host machine and
|
201
|
+
if you don't do that the vagrant-lxc container will end up crashing as it
|
202
|
+
will collide with the host's `lxcbr0`.
|
203
|
+
|
22
204
|
|
23
205
|
## Contributing
|
24
206
|
|
data/Rakefile
CHANGED
@@ -0,0 +1,50 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
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
|
+
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
|
+
config.vm.network :forwarded_port, guest: 8080, host: 8080
|
16
|
+
|
17
|
+
config.cache.auto_detect = true
|
18
|
+
|
19
|
+
config.vm.provider :virtualbox do |_, override|
|
20
|
+
override.vm.box_url = 'http://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-amd64-vagrant-disk1.box'
|
21
|
+
end
|
22
|
+
|
23
|
+
config.vm.provider :lxc do |lxc, override|
|
24
|
+
# Required to boot nested containers
|
25
|
+
lxc.customize 'aa_profile', 'unconfined'
|
26
|
+
override.vm.box_url = 'http://bit.ly/vagrant-lxc-raring64-2013-07-12'
|
27
|
+
end
|
28
|
+
|
29
|
+
# Required to boot nested containers
|
30
|
+
config.vm.provision :shell, inline: %[
|
31
|
+
if ! [ -f /etc/default/lxc ]; then
|
32
|
+
cat <<STR > /etc/default/lxc
|
33
|
+
LXC_AUTO="false"
|
34
|
+
USE_LXC_BRIDGE="false"
|
35
|
+
STR
|
36
|
+
fi
|
37
|
+
]
|
38
|
+
|
39
|
+
config.vm.provision :ventriloquist do |env|
|
40
|
+
env.services << {
|
41
|
+
redis: { image: 'fgrehm/ventriloquist-redis', tag: 'latest' },
|
42
|
+
memcached: { image: 'fgrehm/ventriloquist-memcached', tag: 'latest' },
|
43
|
+
elasticsearch: { image: 'fgrehm/ventriloquist-elasticsearch', tag: 'latest' }
|
44
|
+
}
|
45
|
+
env.services << ['pg:9.1', 'mysql']
|
46
|
+
|
47
|
+
env.platforms << { ruby: { version: '2.0.0' } }
|
48
|
+
env.platforms << %w( nodejs phantomjs go:1.1.2 )
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Cap
|
4
|
+
module Debian
|
5
|
+
module GitInstall
|
6
|
+
def self.git_install(machine)
|
7
|
+
machine.communicate.tap do |comm|
|
8
|
+
if ! comm.test('which git > /dev/null')
|
9
|
+
machine.env.ui.info('Installing git')
|
10
|
+
comm.sudo('apt-get install -y git')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Cap
|
4
|
+
module Debian
|
5
|
+
module GoInstall
|
6
|
+
def self.go_install(machine, version)
|
7
|
+
return if machine.communicate.test('which go > /dev/null')
|
8
|
+
|
9
|
+
src = "https://go.googlecode.com/files/go#{version}.linux-amd64.tar.gz"
|
10
|
+
bin_path = "/usr/local/go/bin"
|
11
|
+
go_path = "$HOME/go"
|
12
|
+
|
13
|
+
machine.env.ui.info("Installing go #{version}")
|
14
|
+
machine.communicate.tap do |comm|
|
15
|
+
comm.sudo('apt-get install curl -y -q')
|
16
|
+
# TODO: Use download + untar capability
|
17
|
+
comm.execute("cd /usr/local && curl #{src} | sudo tar xzfv -")
|
18
|
+
|
19
|
+
if ! comm.test("grep -q '#{bin_path}' /etc/profile.d/ventriloquist.sh 2>/dev/null")
|
20
|
+
comm.sudo("echo 'export PATH=$PATH:#{bin_path}' >> /etc/profile.d/ventriloquist.sh")
|
21
|
+
end
|
22
|
+
|
23
|
+
comm.execute("mkdir -p #{go_path}") if ! comm.test("test -d #{go_path}")
|
24
|
+
|
25
|
+
if ! comm.test("grep -q '#{go_path}' /etc/profile.d/ventriloquist.sh 2>/dev/null")
|
26
|
+
comm.sudo("echo 'export GOPATH=#{go_path}' >> /etc/profile.d/ventriloquist.sh")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Cap
|
4
|
+
module Debian
|
5
|
+
module InstallBuildTools
|
6
|
+
def self.install_build_tools(machine)
|
7
|
+
machine.communicate.tap do |comm|
|
8
|
+
if ! comm.test('dpkg -l | grep build-essential')
|
9
|
+
machine.env.ui.info('Installing build tools')
|
10
|
+
comm.sudo('apt-get install -y build-essential')
|
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 Debian
|
5
|
+
module MercurialInstall
|
6
|
+
def self.mercurial_install(machine)
|
7
|
+
machine.communicate.tap do |comm|
|
8
|
+
if ! comm.test('which hg > /dev/null')
|
9
|
+
machine.env.ui.info('Installing mercurial')
|
10
|
+
comm.sudo('apt-get install -y mercurial')
|
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 Debian
|
5
|
+
module MySqlInstallClient
|
6
|
+
def self.mysql_install_client(machine)
|
7
|
+
machine.communicate.tap do |comm|
|
8
|
+
if ! comm.test('which mysql > /dev/null')
|
9
|
+
machine.env.ui.info('Installing MySQL client')
|
10
|
+
comm.sudo('apt-get install -y mysql-client')
|
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 Debian
|
5
|
+
module MySqlInstallHeaders
|
6
|
+
def self.mysql_install_headers(machine)
|
7
|
+
machine.communicate.tap do |comm|
|
8
|
+
if ! comm.test('dpkg -l | grep libmysqlclient-dev')
|
9
|
+
machine.env.ui.info('Installing MySQL headers')
|
10
|
+
comm.sudo('apt-get install -y libmysqlclient-dev')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Cap
|
4
|
+
module Debian
|
5
|
+
module NodejsInstall
|
6
|
+
def self.nodejs_install(machine)
|
7
|
+
return if machine.communicate.test('which nodejs > /dev/null')
|
8
|
+
|
9
|
+
machine.env.ui.info('Installing nodejs')
|
10
|
+
machine.communicate.tap do |comm|
|
11
|
+
comm.sudo('apt-get install -y software-properties-common')
|
12
|
+
comm.sudo('add-apt-repository -y ppa:chris-lea/node.js')
|
13
|
+
comm.sudo('apt-get update')
|
14
|
+
comm.sudo("apt-get install -y nodejs")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Cap
|
4
|
+
module Debian
|
5
|
+
module PgInstallClient
|
6
|
+
def self.pg_install_client(machine)
|
7
|
+
machine.communicate.tap do |comm|
|
8
|
+
if ! comm.test('which psql > /dev/null')
|
9
|
+
machine.env.ui.info('Installing PostgreSQL client')
|
10
|
+
comm.sudo('apt-get install -y postgresql-client')
|
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 Debian
|
5
|
+
module PgInstallHeaders
|
6
|
+
def self.pg_install_headers(machine)
|
7
|
+
machine.communicate.tap do |comm|
|
8
|
+
if ! comm.test('dpkg -l | grep libpq-dev')
|
9
|
+
machine.env.ui.info('Installing PostgreSQL headers')
|
10
|
+
comm.sudo('apt-get install -y libpq-dev')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Ventriloquist
|
3
|
+
module Cap
|
4
|
+
module Debian
|
5
|
+
module PhantomjsInstall
|
6
|
+
def self.phantomjs_install(machine, version)
|
7
|
+
return if machine.communicate.test('which phantomjs > /dev/null')
|
8
|
+
|
9
|
+
src = "https://phantomjs.googlecode.com/files/phantomjs-#{version}-linux-x86_64.tar.bz2"
|
10
|
+
executable = "/usr/local/share/phantomjs-#{version}-linux-x86_64/bin/phantomjs"
|
11
|
+
|
12
|
+
machine.env.ui.info("Installing phantomjs #{version}")
|
13
|
+
machine.communicate.tap do |comm|
|
14
|
+
comm.sudo('apt-get install -y fontconfig libfreetype6 curl -y -q')
|
15
|
+
# TODO: Use download + untar capability
|
16
|
+
comm.execute("cd /usr/local/share && curl #{src} | sudo tar xjfv -")
|
17
|
+
comm.sudo("ln -s #{executable} /usr/local/bin/phantomjs")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|