Things that are true:
- We love Github
- Github uses Unicorns
- Github deploys all.the.time
Therefor: We should be using Unicorn instead of Passenger.
However, my recent switch to unicorn wasn’t all Unicorns and Rainbows! (pun definitely intended). For me, here’s what I saw:
Make sure you uncomment your unicorn.rb code that’s checking for .oldbin. You can use these three configs to get a working capistrano with nginx and unicorn.
- Once I’d deploy, I’d refresh the page and see my new app version
- I’d refresh and see my old version
- Refresh again: new. repeat.
Once I deployed, I’d see something like this:
1 2 3 4 5 6 7 8 9 10 11
I kept expecting the master (old) to someday go away, but it wouldn’t unless I manually killed it. Capistrano was spinning up my new instance, but not shutting it down.
When I got started with unicorn, I had grabbed a unicorn config from the github blogpost, and the following was commented out. Uncomment it so that it’ll kill old processed where the PID does not match the current PID and BAM, you’re golden.
1 2 3 4 5 6 7 8
The Config Files
After re-examining the github unicorn blogpost, I see the .oldbin check was definitely NOT commented out. So don’t blame the github, but if you’re seeing unicorn not refresh your app, this is probably why.
Copyright on the Gists
The three config files are not copyrighted in any way (as I mostly copied them and edited them anyway). Use and be happy.