I did a quick push to the beta site this morning so that I could do some smoke testing. For the most part, everything looked good. Sadly, I did discover another oversight in my switch of the recipe URL delimiter from dashes to slashes. The recipe search results still had the dashes in them.
I am somewhat disappointed that my Cucumber scenarios did not catch this error. It would have been a simple matter of one of the 10 recipe search scenarios following a link from the search results to the actual recipe. A simple matter indeed, but I did not include such a step.
This is, of course, the point of smoke tests. Even if you have awesome tests, even if you do not make big changes the day before deploying, it is always a good idea to poke around. There may be a bit of smoke, there may be a raging inferno, but you won't know unless you exercise the code.
After fixing the link in the search results (a minor code change, but involving many spec changes), I am ready to deploy. But first...
I am not certain that I have identified the last of the dash/slash issues. Rather than delay the promotion to production, I do a bit of defensive Rack configuration with Rack::Rewrite. Specifically, a recipe URL that contains dashes should be redirected to the proper slash URL:
use Rack::Rewrite doThe
r301 %r{(.+)\.html}, '$1'
r301 %r{^/recipes/(\d{4})-(\d{2})-(\d{2})-(.+)}, '/recipes/$1/$2/$3/$4'
end
curl
command verifies that this works:jaynestown% curl -I http://localhost:3000/recipes/2008-07-13-sausageWith all of my RSpec tests passing, all of my Cucumber scenarios passing, and a bit of defensive Rack middleware, I am ready to deploy my Sinatra / CouchDB application:
HTTP/1.1 301 Moved Permanently
Location: /recipes/2008/07/13/sausage
Content-Length: 14
Connection: keep-alive
Server: thin 1.2.2 codename I Find Your Lack of Sauce Disturbing
jaynestown% rake vlad:stop_appFinally, I update DNS so that http://legacy.eeecooks.com points to the legacy Rails site and http://www.eeecooks.com points to the new Sinatra / CouchDB site.
jaynestown% rake vlad:update vlad:migrate vlad:start_app
Thus endeth the chain.
Congratulations on ending the chain, I've been following it from the very start and have certainly learned a lot from your adventure.
ReplyDeleteCheers !