So my site is no longer hosted on Heroku. I moved it back at lunchtime. My site is low traffic enough that one dyno was more than capable of coping with it. However I am a firm believer that a good developer knows what lies below their feet. I pride myself on knowing the full 'web' stack. Granted my 'front end' knowledge is somewhat sparse in comparison to my 'back end' but I still know my way around it, kinda ;).
Having developers who don't really know the eco system beneath their feet is quite dangerous. It is quite common though - not knowing the virtues of the command line, relying too much on an IDE or strapped to a GUI so much so that moving away from one part of their toolchain renders them next to useless. I am as guilty as this as anyone, but I understand what the GUI or IDE is doing beneath the hood and I would much prefer it that way. I can always point and click and find my way around a GUI.
Obviously if I am doing some Java dev I use an IDE, albeit reluctantly. IntelliJ is my choice for that but you can hear me complain the whole time. I usually bounce on vim, macvim or sublime 2 depending on my mood. Anyway I am getting off topic here, I should blog about my toolchain all the same - maybe someone will find it useful.
So… I moved back to hosting my site on my own server. Mainly because I moved a few things over there at the weekend and I noticed that I hardly used it anymore… Heroku doesn't offer web sockets on the cedar stack so I had no choice but to use my server. When I went to deploy the app on Sunday morning I found out that my version of node was **really** out of date.
You wouldn’t half know I’ve been using PaaS a good bit recently…. #node.js twitter.com/swmcc/status/3…— Stephen McCullough (@swmcc) April 21, 2013
Luckily I solved that in less than a minute.. But still I was shocked at how out of date node (at the time of writing the current stable version of node is 0.10.4 and my server was on 0.6!).
….. and now I’m back up to date… Managing your own server is a pain.. twitter.com/swmcc/status/3…— Stephen McCullough (@swmcc) April 21, 2013
Job done, app deployed and working… I installed monit to monitor the processes and alert me when/if they are down.
check process nginx with pidfile /var/run/nginx.pid start program = "/etc/init.d/nginx start" stop program = "/etc/init.d/nginx stop" group www-data
and inside your app.js (or whatever)
var fs = require('fs'); fs.writeFile("/var/run/app.pid", process.pid);
check process app with pidfile /var/run/app.pid start program = "/path/to/app start" stop program = "/path/tp/app stop" group www-data
I should look into installing forever and used it for my node apps… But I like my monitoring layer to be agnostic to the native language of the app that is being monitored.
I think all this is good practise for a developer to do.