Rails Deployment on Shared Hosts - Geoffrey Grosenbach
Posted by Kevin Sun, 25 Jun 2006 19:05:00 GMT
- The nubyonrails.com guy
- This session is about therapy. If you have had problems with shared hosting in the past, it’s not your fault.
So why do people choose to use shared hosting? It’s cheap and it’s easy.
And why is it such a big struggle? There are many pigs sucking at the same teet.
Recommendations
- Keep your app small. Use less resources.
- Cache – page caching tends to work great in a shared hosting environment, assuming it can work for your app.
- Don’t use typo (whoops)
- Don’t use Lighttpd – Apache is usually the default, and the systems guys tend to like the defaults.
- Use capistrano.
* set :checkout, :export * set :restart_via, :run * set :use_sudo, false
* redefine the :restart task so it reaps the proper dispatch.fcgi, etc - Write tests!
- Use the reaper (possibly on a crontab – don’t let those dispatches explode)
- Monitor that stuff (some sites include easymonitor and montastic)
- Possibly just avoid shared hosting alltogether and go with a virtual private server.
Troubleshooting
- The same stuff always goes wrong
- Check you shebang line (the top line of any ruby script, especially in dispatch.fcgi)
- ./script/server to see if the app can even load in webrick
- ./script/console to see if you can even hit your database
- tail -f your logs
- And if none of that works…just wait, someone else may be screwing with something
Buy my book: Rails Deployment from the pragmatic programmers.
This Geoffrey, representing properly.
