Skip to content

Instantly share code, notes, and snippets.

@es
Last active October 13, 2021 20:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save es/3bb937c05355a2c9646e to your computer and use it in GitHub Desktop.
Save es/3bb937c05355a2c9646e to your computer and use it in GitHub Desktop.
Rails Cheffile + Vagrantfile
# encoding: utf-8
site 'http://community.opscode.com/api/v1'
cookbook "apt"
cookbook "ruby_build", {:github=>"fnichol/chef-ruby_build", :ref=>"v0.7.2"}
cookbook "rbenv", {:github=>"fnichol/chef-rbenv"}
cookbook "git", {}
cookbook "redis", {:github=>"ctrabold/chef-redis"}
cookbook "postgresql", {:github => 'phlipper/chef-postgresql'}
cookbook "vim", {}
cookbook "nodejs", {:github=>"mdxp/nodejs-cookbook"}
#!/usr/bin/env bash
sudo apt-get install -y postgresql-server-dev-9.3
echo "gem: --no-rdoc --no-ri" >> ~/.gemrc
gem install bundler
rbenv rehash
cd /vagrant
bundle install
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "chef/ubuntu-14.04"
config.ssh.forward_agent = true
config.omnibus.chef_version = :latest
config.vm.network :forwarded_port, guest: 3000, host: 3000
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["vagrant/cookbooks"]
chef.add_recipe :apt
chef.add_recipe 'ruby_build'
chef.add_recipe 'rbenv::user'
chef.add_recipe 'git'
chef.add_recipe 'redis'
chef.add_recipe 'postgresql::server'
chef.add_recipe 'vim'
chef.add_recipe 'nodejs'
chef.json = {
:rbenv => {
:user_installs => [
{
:user => "vagrant",
:rubies => [
"2.1.2"
],
:global => "2.1.2"
}
]
},
:git => {
:prefix => "/usr/local"
},
:redis => {
:bind => "127.0.0.1",
:port => "6379",
:config_path => "/etc/redis/redis.conf",
:daemonize => "yes",
:timeout => "300",
:loglevel => "notice"
},
:postgresql => {
:users => [
{
:username => "devuser",
:password => "pass",
:superuser => true,
:createdb => true,
:login => true
}
],
:pg_hba => [
{
:type => "local",
:db => "postgres",
:user => "postgres",
:addr => "",
:method => "trust"
},
{
:type => "host",
:db => "all",
:user => "all",
:addr => "0.0.0.0/0",
:method => "md5"
},
{
:type => "host",
:db => "all",
:user => "all",
:addr => "::1/0",
:method => "md5"
},
{
:type => "local",
:db => "all",
:user => "devuser",
:addr => "",
:method => "md5"
}
],
:password => {
:postgres => "password"
}
},
:vim => {
:extra_packages => [
"vim-rails"
]
}
}
end
config.vm.provision 'shell', path: 'vagrant/provision.sh', privileged: false
end
@es
Copy link
Author

es commented Sep 28, 2014

Install Vagrant plugin omnibox: vagrant plugin install vagrant-omnibus
Install Vagrant box chef/ubuntu-14.04: vagrant box add chef/ubuntu-14.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment