proper workflow for deploying node app

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 :

  • Login is currently incompatible with git bash/cygwin
  • Using git branches for variations of a project
  • Using git for deploy
  • Error while deploying to heroku: rake assets:precompile PG::ConnectionBad: could not connect to server: Connection refused
  • Deploy path doesn't work for Git Deploy Method in middleman-deploy
  • svn deployment strategies for multiple groups of developers (not co-located) working on different components of the same project
  • 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.

    • All the npm dependencies in the package.json file

    What I’d like to do :

    • Store the app on a GIT repo so I can set it up quickly on an EC2 instance.
    • Install pm2, phantomjs/casperjs, all the node_modules and create the arborescence of the app (includes some empty folders for app-created files) in a simple manner, so people who don’t have my knowledge of the app can get it up and running fast.

    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 :

    • New to Git
    • Haven’t followed any guidelines for development as it all started as a toy project.

    Hope my problem is understandable, Thanks all!

    EDIT :

    SO far I have :

    • Read Git for beginners: The definitive practical guide
    • Made a repo on github, cloned it and used npm install to get my app dependencies.

    Still trying to figure out how to include the external dependencies.

  • Still untracked files even after using git add
  • Kubuntu/Windows 7 dual-boot and git
  • Does maven-release-plugin push tags to remote Git repository?
  • Gitolite asks password in localhost
  • How do i get source code for Jboss AS 7.1.1 from GIT?
  • How can I copy files from a branch to another using git?
  • 2 Solutions collect form web for “proper workflow for deploying node app”

    One way to deploy would be to add a install list of commands:

    1. clone repository
    2. install dependencies apt-get install npm ...
    3. install node global modules npm install -g pm2
    4. install node dependencies npm install and npm update
    5. copy config.example.json to config.json and change it to your needs
    6. start app pm2 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.

    You could use Capistrano for doing all the deploy tasks easily. It’s written in Ruby, but you could use it to deploying whatever you want, including Node.js apps.

    You can find a lot of examples and integration modules.

    Git Baby is a git and github fan, let's start git clone.