Skip to content

Instantly share code, notes, and snippets.

@selfup
Last active July 22, 2016 09:21
Show Gist options
  • Save selfup/025dab4b72f5d9d56e10 to your computer and use it in GitHub Desktop.
Save selfup/025dab4b72f5d9d56e10 to your computer and use it in GitHub Desktop.
Use my open source scripts to set up a new vagrant/ruby on rails server!

For Ubuntu and/or Debian

SSH into a fresh Vagrant Box:

Here we set everything up to be ready for install

cd
sudo apt-get install git -y
git clone https://github.com/selfup/DevOpsOne.git
python ~/DevOpsOne/setup_1.py
. .bashrc
python ~/DevOpsOne/setup_2.py
. .bashrc
. .bash_profile
python ~/DevOpsOne/setup_3.py

Now we install the meat and bones (we have to re-run some of the the scripts, they will go by very very quickly this time)

Installing/compiling ruby will take 5 to 10 minutes depending on your setup:

python ~/DevOpsOne/install_ruby.py
python ~/DevOpsOne/setup_1.py
python ~/DevOpsOne/setup_2.py
python ~/DevOpsOne/setup_3.py
rbenv global 2.3.0
rbenv rehash
python ~/DevOpsOne/install_rest.py
rbenv rehash

Ruby, Rails, NodeJS, and Postgres have just been installed. Whoaa!

Now we hook up a rails app to a postgres database

Don't worry, this is pretty automated!

Clone your favorite app:

cd favorite_app_directory

Run the ruby script that will take a command line argument after the .rb

This will set up a valid database.yml for you (the most painfull process of hooking up a rails app) - Ubuntu:

ruby ~/DevOpsOne/create_db_yml_vagrant.rb a_password_you_will_remember

This will set up a valid database.yml for you (the most painfull process of hooking up a rails app) - Debian:

ruby ~/DevOpsOne/create_db_yml_debian_vagrant.rb a_password_you_will_remember

Please check your .gitignore and run git status to make sure the script properly added the correct files to your .gitignore

Now we go into the postgres console and input the password we gave to the ruby script as an ARGV[0]

sudo -u postgres psql
\password name_of_favorite_app
\q

Now you can run development/test/production

rake db:setup
RAILS_ENV=production rake db:setup
RAILS_ENV=production rake assets:precompile
RAILS_ENV=production rails s

All done!

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