• This repository has been archived on 12/Jun/2018
  • Stars
    star
    360
  • Rank 117,262 (Top 3 %)
  • Language
    Ruby
  • License
    MIT License
  • Created almost 11 years ago
  • Updated about 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Development environments made easy

Ventriloquist

Build Status Gem Version Code Climate Gittip

ven·tril·o·quist: (noun) a person who can speak or utter sounds so that they seem to come from somewhere else, esp. an entertainer who makes their voice appear to come from a dummy of a person or animal.

Ventriloquist combines Vagrant and Docker to give developers the ability to configure portable and disposable development environments with ease. It lowers the entry barrier of building a sane working environment without the need to learn tools like Puppet or Chef.

Its core is made of a Vagrant plugin that uses a set of opinionated Docker images + some guest capabilities to provision VMs with services, programming language environments and OS packages, think of it as a "Heroku for Vagrant" where a Dyno is your Vagrant machine and Docker services are its addons.

To give you an idea, this is what it takes to configure a Vagrant VM ready for development on Discourse:

Vagrant.configure("2") do |config|
  config.vm.box = "quantal64"
  config.vm.provision :ventriloquist do |env|
    env.services  << %w( redis-2.8 postgres-9.1 mailcatcher-0.5 )
    env.platforms << %w( nodejs-0.10 ruby-1.9.3 )
  end
end

⚠️ This project is not being actively maintained ⚠️

More information on #63

Project Goals

  • Multi purpose, "zero-conf" development environments that fits into a gist.
  • Production parity for those that have no control of their production machines, like if you are deploying to Heroku or another PaaS.
  • Be the easiest tool for building other tools development environments, for prototyping and also to give a head start to those introducing Vagrant / Docker to legacy projects.

Installation

Make sure you have Vagrant 1.6+ and run:

vagrant plugin install ventriloquist

Usage

Add the provisioner block to your Vagrantfile and vagrant up it:

Vagrant.configure("2") do |config|
  config.vm.provision :ventriloquist do |env|
    # Pick the Docker version you want to use (defaults to 0.9.1)
    # or use :latest to install the latest version available
    env.docker_version = '0.9.1'

    # Pick the services you need to have around
    env.services << %w( redis-2.8 postgres-9.1 memcached-1.4 elasticsearch-1.1 )

    # Configure your development environment
    env.platforms << %w( nodejs-0.10 ruby-2.0.0 go-1.2 )

    # Install random packages
    env.packages << %w( imagemagick htop sqlite3 )
  end
end

If you are using the plugin on a VirtualBox machine, you need to make sure the VM has at least 1gb of RAM, so make sure you have something similar to the code below on your Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.provider "virtualbox" do |vb|
    vb.customize ["modifyvm", :id, "--memory", 1024]
  end
end

Available services

Name Notes
elasticsearch-1.1 Runs on port 9200
memcached-1.4 Runs on port 11211
postgres-9.3 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.
postgres-9.2 Same as above
postgres-9.1 Same as above
mysql-5.6 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.
mysql-5.5 Same as above
redis-2.8 Runs on port 6379 and installs / compiles the redis-cli excutable
mailcatcher-0.5 SMPT server runs on 1025 and web interface on 1080
rethinkdb-1.12 Uses the 28015 port for the client driver, 29015 for the intracluster connections and 8080 for the administrative web UI

The services parameter passed in on the Vagrantfile are the ones built with the Dockerfiles available under /services that are configured to require no additional configuration for usage with the default vagrant user that usually comes with Vagrant boxes. Apart from that they'll always be available from localhost using the default service port (like 5432 for PostgreSQL).

Some extra steps might be required to simplify the connection with the configured services. As an example, besides running the associated Docker image, setting up PostgreSQL will involve installing the postgresql-client package and adding an export PGHOST=localhost to the guest's /etc/profiles.d/ventriloquist.sh so that the psql client works without any extra params.

Please note that all of the builtin images are available as trusted builds on the Docker index with the fgrehm/ventriloquist- prefix that is ommited on the table above.

For fine grained control over how Ventriloquist runs images:

Vagrant.configure("2") do |config|
  config.vm.provision :ventriloquist do |env|
    env.services << {
      redis:    { image: 'username/redis' },
      postgres: { image: 'otheruser/postgres' }
    }

    # If you need more instances of a service, you'll need to give it a unique
    # name and fine tune it at will, for example:
    env.services << {
      # This is simple Vagrant Docker provisioner container
      api_db: { image: 'otheruser/postgres', args: '-p :5432' },

      # The 'vimage' saves you from typing in `image: 'fgrehm/ventriloquist-redis-2.8'`
      worker_redis: { vimage: 'redis-2.8', type: 'redis', args: '-P' },

      # The 'type' parameter tells Ventriloquist to configure the service with
      # its defaults and does some extra work (like installing additional packages)
      # if the service requires it
      worker_db: { image: 'your-user/your-postgres', type: 'postgres' },
    }
  end
end

See http://docs.vagrantup.com/v2/provisioning/docker.html for other arguments

Available platforms

Name Notes
ruby Uses rvm for installing rubies
go Downloads from https://code.google.com/p/go/downloads/list
nodejs Uses nvm for installing node versions
phantomjs Downloads from https://bitbucket.org/ariya/phantomjs/downloads or https://code.google.com/p/phantomjs/downloads/list
erlang The latest version available at https://packages.erlang-solutions.com/erlang/ (currently 17.0)
elixir Downloads from https://github.com/elixir-lang/elixir/releases
python Uses pyenv for installing python versions

In order to configure the VM for usage with the programming language that your app is written on, the plugin leverages Vagrant's guest capabilities to deal with distribution specifics. Right now things should work just fine on Ubuntu VMs and you'll be warned in case you specify a something that is not supported on your guest machine.

Platforms like ruby, nodejs and python also support installing multiple versions since we rely on tools that take care of that for us:

Vagrant.configure("2") do |config|
  config.vm.provision :ventriloquist do |env|
    env.platforms << {
      # The first version provided will be set as the default
      nodejs: { versions: ['0.10', '0.9']    },
      ruby:   { versions: ['2.1.1', '2.1.0'] }

      # The code above is the same as
      env.platforms << %w( nodejs-0.9 nodejs-0.10 ruby-2.1.1 ruby-2.1.0 )
    }
  end
end

NOTICE: Previous versions of the plugin allowed users to omit the platform version to be installed, but starting with 0.5.0 you need to set it explicitly on your Vagrantfile (ex: env.platforms << 'ruby' becomes env.platforms << 'ruby-2.1.1)

System packages

There are times that you just want to install some random set of packages on the guest machine and frequently you end up writing lots of inline shell scripts with apt-get update && apt-get install ...s all over the place. In order to avoid those long strings polluting your Vagrantfile you can use the packages parameter to save you a few keystrokes.

In other words:

Vagrant.configure("2") do |config|
  # This:
  config.vm.provision :shell, inline: %[
    apt-get update
    apt-get install -y --force-yes -q \
                    -o Dpkg::Options::='--force-confdef' \
                    -o Dpkg::Options::='--force-confold' \
                    htop sqlite3 curl lxc
  ]

  # Becomes this:
  config.vm.provision :ventriloquist do |env|
    env.packages << %w( htop sqlite3 curl lxc )
  end
end

Please note that once the package is instaled it won't ever be upgraded unless you run a apt-get upgrade or the equivalent.

Ideas for improvements

  • Use a Docker container as the dev environment within the Vagrant VM, maybe using Buildstep or something like it to configure it.
  • Support for installing "random" tools / packages from within the Vagrantfile (like git / sqlite3 / heroku toolbelt / ruby gems / npm packages)

Usage with vagrant-lxc

If you are on a Linux machine and want to use vagrant-lxc you'll need to enable container nesting by adding the code below to your Vagrantfile:

Vagrant.configure("2") do |config|
  # vagrant-lxc specific tweaks for getting docker to run inside the container
  config.vm.provider :lxc do |lxc|
    lxc.customize 'aa_profile', 'unconfined'
  end
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

More Repositories

1

vagrant-lxc

LXC provider for Vagrant
Ruby
1,208
star
2

vagrant-cachier

Caffeine reducer
Ruby
1,077
star
3

letter_opener_web

A web interface for browsing Ruby on Rails sent emails
HTML
708
star
4

devstep

Development environments powered by Docker and buildpacks
Shell
195
star
5

vagrant-notify

Vagrant plugin that redirects `notify-send` from guest to host machine and notifies provisioning status.
Ruby
181
star
6

docker-netbeans

NetBeans in a container
Shell
150
star
7

docker-eclipse

Eclipse IDE in a Docker container
Shell
146
star
8

vagrant-mssql-express

Vagrant environment with Windows 2008 R2 + SQL Server Express 2008
HTML
97
star
9

vocker

[DEPRECATED] Docker provisioner for Vagrant
Ruby
89
star
10

docker-provider

[DEPRECATED] Docker provider for Vagrant
Ruby
89
star
11

bindler

[DEPRECATED] Dead easy Vagrant plugins management
Ruby
87
star
12

vagrant-lxc-base-boxes

Scripts for building vagrant-lxc 1.0+ base boxes
Shell
68
star
13

notify-send-http

Trigger notify-send across the network using HTTP, useful for triggering notifications from local VMs / Containers into your own computer. It even supports notification icons!
Go
68
star
14

vagrant-global-status

[DEPRECATED] A proof of concept Vagrant plugin that keeps track of vagrant machines and provides a command for listing the status of all known machines.
Ruby
61
star
15

chef-dokku

Chef cookbook for Dokku
Ruby
50
star
16

docker-phantomjs2

Minimum Viable Docker Image for PhantomJS 2.0
JavaScript
46
star
17

vagrant-pristine

vagrant destroy && up
Ruby
44
star
18

rake-notes

rake notes task for non-Rails projects
Ruby
40
star
19

go-dockerpty

Pseudo-tty handler for docker Go client https://github.com/fsouza/go-dockerclient
Go
30
star
20

qmlunit

An easy-to-use Unit Testing framework for Qt Declarative UI - QML [unmaintained]
JavaScript
28
star
21

pucrs-unity3d-pool

A very basic Straight Pool Unity 3D game
C#
27
star
22

docker-easy-lb

Experimental automagic load balancing for Docker web apps in less than 100 lines of bash.
Shell
25
star
23

serf-docker-vagrant-hipache

Buzzwords everywhere
Shell
22
star
24

go-tour

My own Tour of Go - http://tour.golang.org/
Go
21
star
25

lmk

A CLI tool to draw your attention to a terminal when a command finishes running
Go
20
star
26

middleman-blog-drafts

An addon for middleman-blog that simplifies draft posts creation and publishing.
Ruby
20
star
27

squid3-ssl-docker

Shell
20
star
28

docker-android-studio

Android Studio in a container
Shell
18
star
29

rails-base-box

Base vagrant box for working with Rails
Puppet
16
star
30

dotfiles

Just my dotfiles
Shell
16
star
31

vagrant-lxc-vbox-hosts

vagrant-lxc ready VirtualBox machines
Shell
15
star
32

vagrant-boxen

Deprecated in favor of https://github.com/fgrehm/ventriloquist
Ruby
14
star
33

serenata-ocr

A Serverless API for OCRing Serenata de Amor's documents (currently limited to Chamber of Deputies receipts)
JavaScript
12
star
34

pearfarm

Improves the productivity of the PHP community by making it easy to repeatable produce PEAR packages and post them to a public PEAR server
PHP
12
star
35

previewdocs

Preview Viewdocs documentation before pushing changes back to your repositories
Go
11
star
36

docker-intellij

IntelliJ IDEA in a Docker container
Shell
11
star
37

find-pr-for-commit

Tired of copy & pasting commit SHAs into the browser to find out the PR that introduced it? You came to the right place
Shell
10
star
38

vimfiles

just my vim configuration
Vim Script
10
star
39

covid19br-pub

Projeto de monitoramento de publicações oficiais relacionadas a COVID-19 no Brasil.
Ruby
10
star
40

outlet-orm

Initial work towards 2.0 version of Outlet ORM for PHP and SVN mirror [unmaintained]
PHP
9
star
41

boom-curl

Work in progress cURL like interface for https://github.com/rakyll/boom
Go
8
star
42

rbenv-install-remote

rbenv / ruby-build plugin that adds support for installing rubies using a custom definition defined remotely (like a gist)
Shell
8
star
43

tiny-rails

Scaffold for tiny Rails apps based on José Valim's Rails Lightweight Stack code
Ruby
7
star
44

docker-alpine-dind

[DEPRECATED] Docker in Docker Alpine Linux image with support for latest Docker release
Makefile
6
star
45

monitor-covid19-br

Monitor COVID-19 no Brasil
Ruby
6
star
46

dev-droplet

Chef recipes for building a DigitalOcean Droplet for my development needs.
Ruby
6
star
47

laptop-bootstrap

Handful of script to boostrap my laptop
Shell
6
star
48

unity3d-roll-a-ball

Code created while following http://unity3d.com/learn/tutorials/projects/roll-a-ball
C#
6
star
49

vagrant-dev-box

My general purpose vagrant dev box
Puppet
5
star
50

itau_to_ofx

Itaú savings and credit card statements to OFX
Ruby
5
star
51

autotestforphp

AutotestForPHP is based off of ZenTest autotest which is a popular Ruby tool for running tests as soon as files get changed.
Ruby
5
star
52

docker-sbc-article-latex

Docker image for building LaTeX documents (more specifically, SBC articles)
TeX
4
star
53

ubuntu-puppet-git

Manage Ubuntu 12.04 servers using Puppet and git [unmaintained]
Ruby
4
star
54

sls-web

Web platform for analysis, modelling and solution of Stochastic Automata Networks (SAN)
CSS
4
star
55

rails-template

Ruby
4
star
56

letter_opener_web_demo

Ruby
4
star
57

docker-alpine-go

A simple Alpine Linux image for developing Golang apps
Makefile
4
star
58

docker-graphviz

Graphviz in an Alpine Linux container
3
star
59

docker-codebox

Codebox IDE in a Docker
Makefile
3
star
60

pucrs-ospf-attack

C
3
star
61

devstep-examples

Example projects for demoing https://github.com/fgrehm/devstep
Ruby
3
star
62

devstep-envy

Devstep and Envy holding hands.
Shell
3
star
63

pucrs-audio-steganography

Go
2
star
64

covid19br-pub-scenarios

Ruby
2
star
65

artoolkit-docker

Docker image for building and running ARToolKit projects
C
2
star
66

pucrs-simple-json-db

A rudimentary JSON database, built for the PUCRS Database Implementation 2015.2 course
Go
2
star
67

gh-journal

Trying to make sense of my GitHub activity feed since 2016
CSS
2
star
68

covid19br-pub-agents

Ruby
2
star
69

devstep-cli

A CLI for usage with http://fgrehm.viewdocs.io/devstep
Go
2
star
70

viewdocs-yeti

Assets and example for the yeti theme
CSS
2
star
71

brinfo-prototype

Agregador de publicações feitas por instituições governamentais do Brasil
Go
2
star
72

spike-gql-stitch-relay-nodes

JavaScript
2
star
73

rubygems-charts

JavaScript
2
star
74

pucrs-doom2d

Doom 2D
C++
1
star
75

angulardoro

Pomorodo app built with Rails and AngularJS
Ruby
1
star
76

devstep-squid3-ssl

Plugin for automatically configuring Devstep containers to use a Squid3 caching proxy with SSL enabled
Shell
1
star
77

my-setup

The way I set up my computers, with scripts, dotfiles and the like
Lua
1
star
78

git-applet

Python
1
star
79

docker-json-diff

https://github.com/andreyvit/json-diff in a Linux Alpine container
Makefile
1
star
80

go-san

A package for parsing Stochastic Automata Network models in Go
Go
1
star
81

docker-gh-release

https://github.com/progrium/gh-release in a minimal container
Shell
1
star
82

libduckdb-docker

DuckDB headers and libs distributed as Docker images
Makefile
1
star
83

docker-alpine-go-web

A simple Alpine Linux image for developing Golang web apps that leverages nodejs setups for client side code, built on top of https://github.com/fgrehm/docker-alpine-go
Makefile
1
star
84

pucrs-network-simulations

Experimenting with networking conditions
Shell
1
star
85

dockerized

Ruby
1
star