Create Rails App with Hashicorp Otto on Windows 10

Dabbling in Hashicorp Otto trying to create a simple Rails environment

me@jaykilleen.com wrote this almost 8 years ago and it was last updated almost 8 years ago.


← Back to the Posts

This is just a series of steps I had put together when playing around with Hashicorp Otto back when it was in development. Such a shame it was put aside. Hopefully they can get somewhere in a close source environment and bring it back.

otto_rails_new bam #I just used 'bam' as a test app name.
otto compile
otto dev
otto dev ssh
sudo apt-get install curl
gem install rails
rails new . -d postgresql #The app name already exists in the folder name so can just
#bundle install then fails due to postgresql issues
sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-common
sudo apt-get install postgresql-9.3 libpq-dev
bundle
sudo -u postgres createuser vagrant -s
rake db:create
rake db:migrate
rails s -b 0.0.0.0
#Open a new Git Bash Terminal
otto dev address
#Open a browser
{insert address}:3000
otto_rails_new() {
  mkdir $1
  cd $1
  echo "you are now at " pwd
  echo "building Appfile"
  echo "application {" >> Appfile
  echo "  name = \"$1\"" >> Appfile
  echo "  type = \"ruby\"" >> Appfile
  #echo "  dependency {" >> Appfile
  #echo "     source = \"github.com/hashicorp/otto/examples/postgresql\"" >> Appfile
  #echo "  }" >> Appfile
  echo "}" >> Appfile
  echo "" >> Appfile
  echo "customization \"ruby\" {" >> Appfile
  echo "  ruby_version = \"2.2.3\"" >> Appfile
  echo "}" >> Appfile
  echo "Appfile is now available"
  echo "Ready for otto compile"
}