Next month, 80 people with laptops are going to show up and expect me to teach them something about Rails. I want them to see the app they’re writing on the web, but I only have six hours in the workshop (including lunch!) and deployment could easily take that much time by itself. Apache and nginx and Passenger and Capistrano and memcached and…yeah. These are beginners.
So I’m super stoked about Heroku, who’s come to put the easy into Rails deployment. Register, install the gem, and deploying – with a real URL and everything – is as easy as git push heroku
.
Sounds great! But it turns out that using the Heroku client on Windows is slightly problematic. With the standard Rails crowd, I wouldn’t worry, but it looks like about half the attendees will bring some flavor of Windows. So my choices were either make it work on Windows, or scrap the idea of, you know, putting apps on the internet.
So I fixed it. It turned out to be relatively straightforward. The shell method, which takes a command and returns its output, was doing this:
`cd '#{Dir.pwd}' && #{cmd}`
Windows thinks '
is a perfectly good character for directory names, so all calls to shell in Windows generated this error:
The filename, directory name, or volume label syntax is incorrect.
How helpful. In any case, it won’t be doing that anymore. My changes are up on github, and I’ve sent the official heroku client a pull request.
The client still has two spec failures on Windows (running within MsysGit’s Git Bash) that are unrelated to this change, and actually represent fairly significant cross-platform challenges.
'Heroku::Command::Auth sets ~/.heroku/credentials to be readable only by the user' FAILED
expected: 16832,
got: 16877 (using ==)
./spec/commands/auth_spec.rb:49:
The client fails to chmod your credentials file to user-only read, because File.chmod doesn’t do anything. As I’m sure you’re aware, there are significant differences between POSIX-style file permissions and Windows ACLs (access control lists).
So your credentials file, which has your Heroku username and password in plaintext, may be readable by other users. This generally isn’t as much of an issue on Windows as it is on *nix but it’s something to be aware of. You may want to adjust the ACLs by hand if you’re on a multi-user system.
NotImplementedError in 'Heroku::Command::App Git Integration before(:all)'
fork() function is unimplemented on this machine
./spec/commands/app_spec.rb:103:
Yep, as the error message suggests, Kernel::fork
is not implemented in Windows Ruby. The Heroku client does not use fork – it’s in one of the gems, Session, which is used by Rush, which the Heroku test framework uses to create a sandbox git installation.
I haven’t looked too extensively at this one, but it might be possible to rewrite it to work on Windows. Rush does have some code specific to Windows, and there are alternate ways to sandbox the git install as well.
So given that neither of these failures affects the functioning of the client, I’m confident it’ll be usable on everyone’s laptop. I’m also super excited that one of the Heroku engineers, Pedro, has volunteered to help out with installation at the workshop!
We’re still looking for other volunteers – if you’re interested please email ruby workshop at gmail dot com.
Sarah, many thanks for this – it did the trick.
You may also want to look at this if you’re going to be using Taps:
http://github.com/charlesr/taps/tree/b8bd86872f48795f4db6f3432e4e3ebf6132e1fd
Hi Sarah,
one of my students was able to deploy Spree (an e-commerce app) by forking it from GitHub on Heroku (the old version) via Windows
you might want to see the discussion here: http://groups.google.com/group/spree-user/browse_thread/thread/1787b3ce20d29dd
the YouTube links start here (4 out of 4), the 4 videos are 31+ minutes: http://www.youtube.com/watch?v=vt0RHqRHyvA
The app is deployed here: http://spree6.herokugarden.com/
Thanks for the pointer, Paul. I will check it out.
I’m having my own struggles with Heroku so landed on here after seeing the familiar name. An introduction to Heroku was one of the many great things at the outreach talk! Interesting that Heroku is in Session. Anywho, as an attendant just wanted to say hey, your talk was great.
I also wasn’t able to get tap to work properly. My take on the Heroku experience here – http://allaboutruby.wordpress.com/2009/12/05/hosting-your-rails-app-first-look-at-heroku/
I’m having my own struggles with Heroku so landed on here after seeing the familiar name. An introduction to Heroku was one of the many great things at the outreach talk! Interesting that Heroku is in Session. Anywho, as an attendant just wanted to say hey, your talk was great.