We’re wrapping up a weekend hack project, and on Jerome’s recommendation, chose to deploy it on dotCloud.
dotCloud is a “put it in the cloud and save some anxiety” service. The kicker is the variety of services they support for building your own stack and the ever so useful SSH access.
We’re using CoffeeScript, which turned out a bit tricky to set up. If you’re looking to cut corners and get started quickly, here are some configuration files you can borrow.
The dotcloud.yml configuration is very straightforward:
1 2 3 4 | www: type: nodejs data: type: mongodb |
Our app is an Express server that listens on 8080, so there’s nothing much to configure, but we do need to tell dotCloud how to start it. That requires pointing supervisord.conf at the CoffeeScript executable. And don’t forget to set NODE_ENV:
1 2 3 4 | [program:node] environment = NODE_ENV=production command = /home/dotcloud/current/node_modules/.bin/coffee server.coffee directory = /home/dotcloud/current |
BTW /home/dotcloud/current is your app’s deploy directory. Everyone gets the same path, just different server instance.
This seems like a bug, but multiple deploys didn’t seem to npm install, so I added this to postinstall:
1 2 | #!/bin/bash npm install |
Remember to chmod +x this file before pushing or nothing much happen.