I have been learning Node for the last couple of months, and now have a complex application. My problem is that, i'd like to make it reusable, and as I was a complete noob, I haven't thought of this from the start.
What I have :
A complex node/express app running as a daemon with pm2.
lots of child processes scripts, some in Node, and some using casperjs/phantomjs
a config file for db credentials, server port, etc.
many npm dependencies, some for the app itself, some used only by child processes. The app itself is running perfectly, every path is stored in the config file, so deployment shouldn't be too hard.
What I'd like to do :
My question :
Do I need to add the node_modules to my git repo?
how can I integrate app deployement, install of dependencies and install of pm2, phantom and casper in the simplest possible way? I don't mind making a script but I don't really know where to start or best practices. Most of what I see on the web is about nodejitsu/heroku and does not apply.
My flaws :
Hope my problem is understandable, Thanks all!
EDIT :
SO far I have :
Still trying to figure out how to include the external dependencies.
One way to deploy would be to add a install list of commands:
apt-get install npm ...
npm install -g pm2
npm install
and npm update
config.example.json
to config.json
and change it to your needspm2 index.js
The node_modules folder should not be added to the git repo. You should add all your projects node dependencies to the package.json file and npm install
/ npm update
should do the rest.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With