With the Amazon AWS Free Usage Tier, how should I deploy a simple Node.js WebSocket chat server that uses the ws & pg modules?
If you can: How to deploy a Node.js WebSocket server to Amazon Elastic Beanstalk?
Otherwise, what are all the steps I should take to set it up using EC2 directly?
Or, should I do it with OpsCloud?
You CAN use Elastic Beanstalk with the free usage tier. However if you want to run both Postgres and Node.js, you might find you need to roll your own EC2 instance to remain within the free usage constraints - check here: http://aws.amazon.com/free/
EB does make it relatively simple to deploy, and if you do your development setup correctly, EB will install the extra node modules you need.
In any case, when developing you will find you need to install new modules - I'm sure you're familiar with the
npm install
mechanism. What you need to add to that is the--save
option, sobecomes
This then adds that package to the dependencies section of the
package.json
file. When you deploy to EB or any other dev ops system, these dependencies are automatically installed (the system runsnpm install
). If you are cloning from a repository onto your server, then runningnpm install
yourself will install those modules.Hopefully this helps you get the modules you need installed on the server. It's worth noting that your
node_modules
directory should not be shipped with your code - let the system build it when deploying.