How deploy Node app to Ubuntu

Posted August 10, 2013 11.9k views
I installed node, npm and mongodb on my dropplet and now wondering how to deploy my local node app to the server.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
13 answers
Create a user for the app:

adduser app

SSH in as app:

ssh app@yourdroplet'sIPaddress

Upload your files to your home directory (or clone the git repo), run "npm install" in the app's directory and edit the configuration files to connect properly to mongodb. Once you're done, run your app:
node start.js

node app.js

Keep in mind the filename varies from app to app.
I added new user, installed git, init git and added github repo as origin, added ssh key (local machine), now how do I authorize to pull from my github repo? If created new username does it mean all files will be accessible from ?

@abachuk: Is it a private github repo?
yes, it's private repo. It doesn't have to be github, I just want to push changes from local computer to DO server, I like how heroku gives you git repo, so I can push to heroku and github at the same time.
Run this command as the app user:

ssh-keygen -t rsa -N ''

Press enter if it asks you where to store the key pair.

Add the public key as a deploy key in your github repo:

cat ~/.ssh/

Then clone the git repo:

cd ~

git clone
Thanks. Getting this error.

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Is there a way to create repo on DO droplet like git@myrepo@123.345.456.11.git and push my code from my computer directly to DO repo ?

Thanks for your help, again!
Did you add your server's public key to your github repo?
I will try that. What about setting up repo on DO droplet and use it to push changes from local computer instead of pulling from github repo every time I do any changes. Thanks.
@abachuk: We have an article on that coming soon however it doesn't cover restarting the nodejs application on push but shouldn't be too hard to add.
Previous 1 2 Next