Created
June 14, 2014 20:24
-
-
Save volkanunsal/2ee81ec8c41dab120392 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vagrant.configure("2") do |config| | |
# Forward the Rails server default port to the host | |
config.vm.network :forwarded_port, guest: 3000, host: 3000 | |
# config.omnibus.chef_version = :latest | |
# config.omnibus.chef_version = "11.10.0" | |
# config.berkshelf.enabled = true | |
config.librarian_chef.cheffile_dir = "./" | |
# Sets up the proxy VM | |
config.vm.define "phusion" do |v| | |
v.ssh.port = 22 | |
v.ssh.username = "root" | |
v.ssh.private_key_path = "insecure_key" | |
v.vm.synced_folder "../wishlist", "/wishlist" | |
v.vm.synced_folder "../otp", "/otp" | |
# chef.data_bags_path = "databags" | |
# Creates a Docker provider within the proxy VM | |
v.vm.provider "docker" do |d| | |
d.cmd = ["/sbin/my_init","--enable-insecure-key"] | |
d.image = "phusion/baseimage" | |
# d.image = "phusion/passenger-ruby21" | |
# d.image = "phusion/passenger-full" | |
d.has_ssh = true | |
end | |
v.vm.provision "shell", path: "http://www.opscode.com/chef/install.sh" | |
v.vm.provision "shell", inline: <<-HERE | |
cd /root | |
curl http://curl.haxx.se/ca/cacert.pem -o cacert.pem -s | |
export CURL_CA_BUNDLE="/root/cacert.pem" | |
apt-get -qq -y update | |
apt-get -qq -y upgrade ca-certificates | |
HERE | |
v.vm.provision "shell", inline: "apt-get install ruby2.0 ruby2.0-dev libruby2.0" | |
v.vm.provision "shell", inline: <<-HERE | |
sudo cd /var/lib/postgresql/9.3/main/ | |
sudo cp /etc/ssl/private/ssl-cert-snakeoil.key server.key | |
sudo chown postgres server.key | |
sudo chgrp postgres server.key | |
sudo chmod 740 server.key | |
sudo /etc/init.d/postgresql start | |
HERE | |
v.vm.provision :chef_solo do |chef| | |
chef.formatter = ENV.fetch("CHEF_FORMAT", "null").downcase.to_sym | |
chef.log_level = ENV.fetch("CHEF_LOG", "info").downcase.to_sym | |
chef.custom_config_path = "Vagrantfile.chef" | |
chef.cookbooks_path = ["cookbooks","site-cookbooks"] | |
chef.add_recipe "apt" | |
chef.add_recipe "nodejs" | |
chef.add_recipe "vim" | |
chef.add_recipe "nginx" | |
chef.add_recipe "postgresql::client" | |
chef.add_recipe "postgresql::server" | |
chef.add_recipe "java" | |
# chef.add_recipe "rails-lastmile" | |
# chef.add_recipe "unicorn" | |
# chef.add_recipe "rbenv" | |
# chef.add_recipe "ruby_build" | |
# chef.add_recipe "rbenv::user" | |
# chef.add_recipe "rbenv::vagrant" | |
chef.json = { | |
rails_lastmile: {}, | |
'rails-lastmile' => { | |
app_dir: "/wishlist", | |
'ruby_version' => '2.0.0-p0', | |
'nginx_ssl' => false | |
}, | |
postgresql: { | |
version: '9.3', | |
password: { | |
postgres: 'password' | |
}, | |
config:{ | |
ssl_key_file: "/var/lib/postgresql/9.3/main/server.key" | |
} | |
}, | |
unicorn: { | |
worker_processes: 1 | |
}, | |
build_essential: { | |
compile_time: true | |
} | |
# , rbenv: { | |
# user_installs: [{ | |
# user: 'root', | |
# rubies: ["2.0.0-p0"], | |
# global: "2.0.0-p0", | |
# home: "/root", | |
# gems: { | |
# "2.0.0-p0" => [ | |
# { name: "bundler" } | |
# ] | |
# } | |
# }] | |
# } | |
} | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment