If you use Ruby on Rails, you’ve probably heard by now about the release of the Rails 3.0 betayesterday. There’s been a lot leading up to this release, so naturally most of the rails world is eager to jump in and give it a try. Saturday morning is a great time to get started, so I decided to give it a try.
First off, I wanted to make sure I had a more up to date version of Ruby. Rails 3.0 beta and up will require Ruby 1.8.7 or higher. If you’re running Snow Leopard you probably already have this, but can always do a ruby -v to check your current Ruby version. The easiest way I’ve found to run multiple versions of ruby is using the rvm gem. It handles everything needed for running multiple versions of Ruby, including Rubygems. Just install the gem and go from there:
After that I was able to create a project the usual way, and start messing around the latest version of Rails. Looking forward to upgrading some existing sites!
link:research adam$ rails testsite
link:research adam$ cd testsite
link:testsite adam$ rails server
If you haven’t heard of Heroku, you’re not alone. Heroku is a cloud host for Ruby on Rails driven sites that is relatively new on the scene. They’ve been in private mode for nearly a year, but recently their growth has skyrocketed. This growth is based on a few core features of their platform which are typically pain points for getting projects deployed.
What is Heroku
The trouble with most sites and descriptions of Heroku, is that they boil the service down to too small a line. The description on their site even goes this far — “Ruby Cloud Platform as a Service”. To put it in laymans terms, they’re a Cloud host for ruby websites (Rails, Sinatra, Rack, Merb). All Heroku sites run the same base base platform which includes some familiar faces if you’ve looked into Ruby hosting.
Operating System: Debian 4.0
Ruby: MRI 1.8.6
Ruby App Server: Thin
Web Server: Nginx 0.6.32
Database: PostgreSQL 8.3.5
HTTP cache/accelerator: Varnish 2.0.2
One of the most important things to me is that Heroku handles keeping all of these running and up to date. You don’t have to worry about getting a call that the database server has crashed, or one of the servers is out of memory — they do all that for you. You can think of it as managed hosting, but they’re managing a cloud rather than single servers.
Insanely easy setup
No Capistrano for Deployment – instead you just push to a git repository on their servers
No worrying about apache/nginx/mongrel/passenger – they just spin up a thin clients behind nginx.
Methods for simplifying many common tasks including database importing, exporting and site backups
Setup is Almost as Easy as They Say
Setting up you application to get on Heroku doesn’t take very long. Actually, during lunch at work today I got a Heroku app setup, just to try it out. You can follow the Heroku Quickstart Guide, so I won’t repeat it here. My only advice is to do everything you can from from the command line, rather than editing settings on the website. If your local copy and the remote copy get out of date (like if you rename an app for example), you’ll hit a speedbump and have to sift through the docs. The web management interface for Heroku is a beauty though, and coupled with the robust heroku gem, you can do a lot right out of the gate.
So after you get your database on Heroku migrated, you’ll probably want to load some data in it. Heroku has a very helpful command to get you started.
You only need db:push, but without the “utf8″ encoding specification, you may run into some problems converting from mysql to PostgreSQL. So far the only main difference in Mysql to Postgres for ArcadeFly (temp Heroku url until dns updates) is that I used 1 or 0 for booleans as strings in a few places. I changed these to true/false instead, pushed out the change and it worked fine.
Pushed out? Yeah you can deploy a heroku site with a simple git push. The initial setup already added Heroku to your git setup, so deploying is just pushing.
$ git push heroku master
They posted a Vimeo video about getting started that should help get an idea of just how easy setup is:
Under Heroku you’re set a very specific set of server software, as you know from the above listing. These luckily cover the vast majority of Rails sites, so there’s nothing wrong with that. What you don’t get is full SSH access to the server that you may have become used to. Instead, most access is done using the Heroku gem. Here’s a few things that you can do.
Using the heroku logs command, you can get the last bit of your production log real fast. Running rake tasks is as simple as heroku rake db:migrate. You never need to specify environment with Heroku — everything on Heroku is production.
Probably the biggest limitation is that there is no access to the filesystem except in /tmp. In order to save and manage files, you should instead use S3. Since Heroku runs on EC2, there is no file transfer charge for files between your S3 account and your Heroku servers since they are both in the same data center.
Expanding Heroku
It’s free to get started on Heroku. You can create a rails site with 1 Dyno (1 Thin server), have a daily cron job, get a PostgreSQL database and even point your own custom domain there. You can expand this with more thin clients, delayed_jobs and much more at a price. I like the idea of having delayed_job processes running in the cloud rather than possibly slowing down the site. Unfortunately there’s no public memcache yet, although it’s in private beta. I’m still just getting my feet wet with Heroku, but look forward to seeing how ArcadeFly does there.
Most people don’t think about what they name their computers. It’s just not important enough in peoples lives to be a question of relevance. But for us programmers who set naming conventions and coding standards, prefering convention over configuration, it seems like the next step to use see how these rules apply to naming other things in our lives. Remember – it’s all about having fun. You wouldn’t have a variable named Batman, but what’s to stop you from naming your computers after superheroes?
Naming Computer at Work
At one job I worked they took naming very seriously, in the fun way. All servers would be named after characters from The Matrix. So we might have a development server called Agent-Smith, or a database server called Trinity. If you’re connecting to a small set of servers, you won’t soon be confused over the names. It’s a great improvement over application-1, application-2, etc if you’re naming a small set of servers. There’s plenty of names to choose from. I wouldn’t recommend using the alternate Agent names though, unless you want to get Agent-Smith, Agent-Jones and Agent-Brown confused.
Desktop computers throughout the office were then named after Transformers. There’s plenty to select from, and it adds a personal touch to everyone’s computer. You could even take it a step farther and couple each computer with a Transformer. You could split the office into Decepticons and Autobots if you have a clear divide, and then the two sides can go to war — or something like that. It’s a lot easier to look at the network and see Starscream than “pc-rover-2245″. You can have all kinds of fun with this — big transformers are power computers, flying transformers are laptops.
Naming Computers at Home
My naming convention for devices in my home is largely copied from one of the above. All computers in my home are named after Matrix characters (aside from a few of my girlfriends devices which still need to fall inline). My computers that I use are named after human males – Link and Bane (Bane is the Windows partition on my Mac). Other devices of mine around the house that are named after male programs. So Keymaker is my router, my Drobo is Merovingian, portable hard drive is Seraph, my airport express is Trainman and our shared media center Mac Mini is Persephone (always coupled with Merovingian, you see?). At home you probably don’t have enough devices to really need much in the way of naming conventions, but if you have a few USB drives it suddenly makes a lot more sense.
Table of Elements
I don’t remember where I heard it, but someone mentioned to me that they’d organized their servers based on the periodic table of elements. Domain controllers would be noble gasses, halogens might be file servers, transition metals (which are the bulk of elements) could be desktops used by everyone in the office. There’s a few more groups built in for you to use, so long as you don’t have too many devices. This allows for a little more “professional” sounding names, or at least a different kind of nerdy.
Fun of Functional?
Whether you go with a fun or functional naming convention, or even have one at all, will depend on the atmosphere of where the devices will be. If you have a chance to have a little fun, go for it! Anyone have any other fun naming conventions they use or have heard about? Always looking for more examples.