guillermo{at}guerreroibarra{dot}com
Follow me on github: https://github.com/ryanfox1985
February 17th, 2016
$ vagrant [command]
More at vagrantup cli
Vagrant.configure (2) do |config|
config.vm.box = 'ubuntu/trusty64'
config.ssh.forward_agent = true
config.vm.network 'forwarded_port', :guest => 80, :host => 8000
config.vm.provider 'virtualbox' do |vb|
vb.memory = '1024'
vb.gui = false
end
end
config.vm.provision 'shell', inline: <<-SHELL
sudo apt−get update
sudo apt−get install −y apache2
SHELL
# Setup when the VM is first created
app.vm.provision 'shell', path: 'vagrant/setup.sh'
# This script is running every time we start the VM.
app.vm.provision 'shell', run: 'always', path: 'vagrant/start.sh'
Vagrant.configure(2) do |config|
...
# Enable Berkshelf support
config.berkshelf.enabled = true
config.berkshelf.berksfile_path = './Berksfile'
...
end
source "https://supermarket.getchef.com"
cookbook 'apt'
cookbook 'git'
cookbook 'build-essential'
cookbook 'nodejs'
cookbook 'mysql'
cookbook 'rvm'
cookbook 'openssl'
cookbook 'app', path: './site-cookbooks/app'
...
config.vm.provision :chef_solo do |chef|
chef.add recipe 'apt'
chef.add recipe 'build−essential'
chef.add recipe 'git'
chef.add recipe 'nodejs'
chef.add recipe 'app::mysql'
end
Note: Recipe order is important.
site-cookbooks/app
attributes
list_of_attributes.rb
recipes
list_of_recipies.rb
templates
defaults_files
Berksfile
metadata.rb
mysql_service 'default' do
port '3306'
version '5.5'
initial_root_password 'put_here_a_password'
action :create
end
[Link to github] An example that sets up a Ruby on Rails development box based on Ubuntu with RVM, Ruby 2.1.0, MySQL 5.5.
Coobooks are very unstable.
You need a good computer with Ram.
[Link to github]: A box with Btsync, DYNDNS, SickRage, Couch potato and Deluge
Inspired in Freenas
Vagrant.configure(2) do |config|
...
# Ubuntu
config.vm.box = 'ubuntu/trusty64'
# Install latest docker
config.vm.provision 'docker'
# Setup the containers when the VM is first created
config.vm.provision 'shell', path: 'vagrant/setup.sh'
# Make sure the correct containers are running
# every time we start the VM.
config.vm.provision 'shell', run: 'always', path: 'vagrant/start.sh'
end
# Stop and remove any existing containers
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
# Run and link the containers
docker run -d -v /vagrant/ddclient/etc:/etc/ddclient --name dynamicdns \
ryanfox1985/docker-dynamicdns
docker run -d -p 8888:8888 -v /vagrant/ddclient/etc:/etc/ddclient \
--name sync bittorrent/sync
...
# Commands required to ensure correct docker containers are started when the vm is rebooted.
docker start dynamicdns
docker start sync
docker start sickrage
docker start couchpotato
docker start deluge