Last active
August 21, 2016 21:39
-
-
Save cdl/9a6c91738bf16250f2abfffb2b101ee3 to your computer and use it in GitHub Desktop.
Revisions
-
cdl revised this gist
Aug 21, 2016 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -28,8 +28,8 @@ $locale = "en_US.UTF-8" $ports = [ 8080 ] # The database name and password to use for Postgres. User is `postgres`. $db_name = "db_name" $db_password = "db_password" # The provisioning script. Uses the variables above to properly set things up # for a Ruby environment. -
cdl revised this gist
Aug 21, 2016 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -52,8 +52,8 @@ $provision_script = <<SCRIPT git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build echo "\n\ninstalling ruby..." sudo -H -u vagrant bash -i -c 'rbenv install #{$ruby_version}' sudo -H -u vagrant bash -i -c 'rbenv rehash' echo "\n\nsetting up ruby..." sudo -H -u vagrant bash -i -c 'rbenv global #{$ruby_version}' -
cdl revised this gist
Aug 21, 2016 . 1 changed file with 12 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -36,32 +36,32 @@ $db_password = "development" $provision_script = <<SCRIPT echo "\n\nmaking sure everything's up to date..." sudo sh -c "echo 'LC_ALL=#{$locale}\nLANG=#{$locale}' >> /etc/environment" sudo apt-get update sudo apt-get upgrade -y echo "\n\ninstalling dependencies..." sudo apt-get -y install curl git-core python-software-properties ruby-dev libpq-dev build-essential libsqlite3-0 libsqlite3-dev libxml2 libxml2-dev libxslt1-dev postgresql postgresql-contrib libreadline-dev echo "\n\ninstalling rbenv..." git clone https://github.com/rbenv/rbenv.git ~/.rbenv echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc source ~/.bashrc echo "\n\ninstalling ruby-build..." git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build echo "\n\ninstalling ruby..." # sudo -H -u vagrant bash -i -c 'rbenv install #{$ruby_version}' # sudo -H -u vagrant bash -i -c 'rbenv rehash' echo "\n\nsetting up ruby..." sudo -H -u vagrant bash -i -c 'rbenv global #{$ruby_version}' sudo -H -u vagrant bash -i -c 'gem install bundler --no-ri --no-rdoc' sudo -H -u vagrant bash -i -c 'rbenv rehash' echo "\n\nsetting up postgres..." sudo -u postgres createdb #{$db_name} echo "ALTER USER postgres WITH PASSWORD \'#{$db_password}\';" | sudo -u postgres psql SCRIPT -
cdl revised this gist
Aug 21, 2016 . 1 changed file with 18 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -19,6 +19,10 @@ $ruby_version = "2.3.1" # is in), but you can change the below to just a raw string if you'd like. $project_name = File.basename(Dir.getwd) # Locale environment to use. Change the below to match the locale used on your # host machine. (When in doubt, stick with the default.) $locale = "en_US.UTF-8" # The ports to open. Points each port from the guest to the same port on the server. # So, setting $ports to [ 8080 ] will point the VM :8080 -> host :8080. $ports = [ 8080 ] @@ -31,29 +35,30 @@ $db_password = "development" # for a Ruby environment. $provision_script = <<SCRIPT echo "\n\nmaking sure everything's up to date..." sudo sh -c "echo 'LC_ALL=#{$locale}\nLANG=#{$locale}' >> /etc/environment" # sudo apt-get update # sudo apt-get upgrade -y echo "\n\ninstalling dependencies..." # sudo apt-get -y install curl git-core python-software-properties ruby-dev libpq-dev build-essential libsqlite3-0 libsqlite3-dev libxml2 libxml2-dev libxslt1-dev postgresql postgresql-contrib libreadline-dev echo "\n\ninstalling rbenv..." # git clone https://github.com/rbenv/rbenv.git ~/.rbenv # echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc # echo 'eval "$(rbenv init -)"' >> ~/.bashrc # source ~/.bashrc echo "\n\ninstalling ruby-build..." # git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build echo "\n\ninstalling ruby..." # sudo -H -u vagrant bash -i -c 'rbenv install #{$ruby_version}' # sudo -H -u vagrant bash -i -c 'rbenv rehash' echo "\n\nsetting up ruby..." # sudo -H -u vagrant bash -i -c 'rbenv global #{$ruby_version}' # sudo -H -u vagrant bash -i -c 'gem install bundler --no-ri --no-rdoc' # sudo -H -u vagrant bash -i -c 'rbenv rehash' echo "\n\nsetting up postgres..." sudo -u postgres createdb --locale en_US.UTF-8 --encoding UTF8 #{$db_name} -
cdl revised this gist
Aug 21, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -56,7 +56,7 @@ $provision_script = <<SCRIPT sudo -H -u vagrant bash -i -c 'rbenv rehash' echo "\n\nsetting up postgres..." sudo -u postgres createdb --locale en_US.UTF-8 --encoding UTF8 #{$db_name} echo "ALTER USER postgres WITH PASSWORD \'#{$db_password}\';" | sudo -u postgres psql SCRIPT -
cdl revised this gist
Aug 21, 2016 . No changes.There are no files selected for viewing
-
cdl created this gist
Aug 21, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,84 @@ # Ruby + PostgreSQL Vagrantfile # Written by Colby Ludwig, @cdl # Vagrantfile for setting up a base Ruby + PostgreSQL environment on # Ubuntu 14.04 with the latest deps. Sets up the following: # - rbenv for installing Ruby with the default `vagrant` user # - shares the current directory for the project to ~/{dir-name} # - sets up Postgres with a given database name and password (user is `postgres`) # - forwards given ports # # Thanks to http://stackoverflow.com/a/30106828 for helping me get the # base of the file going. # The Ruby version to install with rbenv. Use `rbenv install -l` to list # all versions available to rbenv. $ruby_version = "2.3.1" # Project name - infers it's name from the current directory (that this Vagrantfile # is in), but you can change the below to just a raw string if you'd like. $project_name = File.basename(Dir.getwd) # The ports to open. Points each port from the guest to the same port on the server. # So, setting $ports to [ 8080 ] will point the VM :8080 -> host :8080. $ports = [ 8080 ] # The database name and password to use for Postgres. User is `postgres`. $db_name = "development" $db_password = "development" # The provisioning script. Uses the variables above to properly set things up # for a Ruby environment. $provision_script = <<SCRIPT echo "\n\nmaking sure everything's up to date..." sudo apt-get update sudo apt-get upgrade -y echo "\n\ninstalling dependencies..." sudo apt-get -y install curl git-core python-software-properties ruby-dev libpq-dev build-essential libsqlite3-0 libsqlite3-dev libxml2 libxml2-dev libxslt1-dev postgresql postgresql-contrib libreadline-dev echo "\n\ninstalling rbenv..." git clone https://github.com/rbenv/rbenv.git ~/.rbenv echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc source ~/.bashrc echo "\n\ninstalling ruby-build..." git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build echo "\n\ninstalling ruby..." sudo -H -u vagrant bash -i -c 'rbenv install #{$ruby_version}' sudo -H -u vagrant bash -i -c 'rbenv rehash' echo "\n\nsetting up ruby..." sudo -H -u vagrant bash -i -c 'rbenv global #{$ruby_version}' sudo -H -u vagrant bash -i -c 'gem install bundler --no-ri --no-rdoc' sudo -H -u vagrant bash -i -c 'rbenv rehash' echo "\n\nsetting up postgres..." sudo -u postgres createdb --locale en_US.utf8 --encoding UTF8 #{$db_name} echo "ALTER USER postgres WITH PASSWORD \'#{$db_password}\';" | sudo -u postgres psql SCRIPT # Start the config! Vagrant.configure(2) do |config| # Use the ubuntu/trusty64 box (for Ubuntu 14.04 LTS). config.vm.box = "ubuntu/trusty64" # Share each port in $ports from the VM to the guest (under the same port). $ports.each do |port| config.vm.network "forwarded_port", guest: port.to_s, host: port.to_s end # Share the project directory to ~/{current-dir-name}. config.vm.synced_folder "./", "/home/vagrant/#{$project_name}" # Provider-specific settings for Virtualbox. Just setting the RAM to 1GB here. config.vm.provider "virtualbox" do |vb| # Customize the amount of memory on the VM: vb.memory = "1024" end # Provision the VM with the script at the top of the Vagrantfile. config.vm.provision :shell, privileged: false, inline: $provision_script end