A place to breathe

Monday, September 8, 2014

Publishing your Static site on Heroku using Rails with Git, on top of Vagrant + VM

Why i use Heroku? Well, because it's said in the Middleman page that you can. (see my previous post on setting up Middleman),

No i am serious. I tried to run Rails by myself using Phusion Passanger and it is just .... horror.

So rather than doing it myself, i would trust heroku for now. For Now!

Ok enough. let's get working.

First, go signup at heroku.com, and after that, download Heroku toolbelt. Instead of downloading into your machine, go to ssh and install heroku there:

cd /your/vagrant/dir
vagrant ssh 
bash  (yes, do this please) 
wget -qO- http://toolbelt.heroku.com/install-ubuntu.sh | sh 

Heroku toolbelt is just a fancy words for some executables for Heroku. like installing some binaries somewhere in your directories. Now, you should have "heroku" executable so that you can login:

before your do anything, add the ssh key to your vm:
ssh-keygen -t rsa 

There are few steps that need to be done in order to run middleman page on heroku. One key thing is, you can use "puma" web server:

Heroku wants you to specify the "ruby" version so that it can grab the correct dependencies. If you fail to specify, most likely you fail to run middleman.

Now, let's push our middleman page to heroku:
git push heroku master 

Now when you push it, it will run your puma config that you specify in Procfile
web: bundle exec puma -p $PORT -e $RACK_ENV 

You should now see your middleman page at the specified URL given by heroku. if it returns error, use the following command and check why:

heroku logs



No comments:

About Me

I'm currently a software engineer. My specific interest is games and networking. I'm running software company called Nusantara Software.