Thursday, February 13, 2014

Hosting Static Site on Heroku by Michael Droz

Heroku is the preferred hosting solution for Rails apps but what about hosting static sites? No problem of course, but you do have to know the trick. I spent about 15 minutes figuring it out which is probably an indictment on me and not the good folks at Heroku. Below is a step by step guide. 

Motivation: Hosting a static site as an example of html/css skills. 

Prerequisites: 
  • Git installed and configured 
  • Heroku account
  • Heroku's Toolbelt installed 
  • SSH generated and associated with your Heroku account

Step by step guide: 
1. mkdir michael_droz_static_site
2. cd michael_droz_static_site
3. git init
4. copy files into new directory (or clone from remote)
5. (this is the trick) create simple php file named index.php with the single line 
<?php include_once("home.html"); ?>

6. rename index.html to home.html
7. git . add
8. git commit
9. heroku create
10. git push heroku
11. heroku open (this will open a browser to your new site)

If you want to rename the site you simply issue the following command:
heroku app:rename michael-droz     

Here's a link to the site I created: 

   

Friday, February 7, 2014

Free Domains for Developers ~ .tk by Michael Droz

Before I get started on a new project I like to have a real domain to deploy to. Previously, I would go to GoDaddy.com (lame) and purchase a domain for < $10.00, but recently I came across the .tk top-level domain for Tokelau, a territory of New Zealand located in the South Pacific that allows you to register a domain for up to 2 years for free. My father, Michael Droz Sr., warned me that nothing in life is free, but I am trying to change my profligate ways and pinch pennies whenever possible.

I have registered the domain philanthropyrunner.tk as a test. I have the domain pointed to a Ruby on Rails server hosted by Rackspace. So far the domain is redirecting to ads that I am sure the owner of .tk is making a nice bit of coin serving up on newly registered domains. At this point I consider the experiment a failure - if not a scam. I will update this blog if the domain actually starts to redirect to my server. 

At this point I am cautiously optimistic...

UPDATE: After 15 minutes of registering my .tk domain it has started to redirect to my dedicated ip address. I am calling this a success. Free domains for developers are real thanks to .tk ~ awesome!