Question

How deploy Node app to Ubuntu

  • Posted August 10, 2013

I installed node, npm and mongodb on my dropplet and now wondering how to deploy my local node app to the server.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

@abachuk: You can set up a private git repo on your droplet and push to it: <br> <br>https://www.digitalocean.com/community/articles/how-to-set-up-a-private-git-server-on-a-vps <br> <br>Also read my reply to Leo’s comment on that article.

I was able to set up git repo (/app/myappname.git) and push my code there, however after I pushed it, I don’t see it remotely. When I set up new local repo and clone remote (app/myappname.git) repo - all code gets copied, so it’s somewhere on the server, where is it and what URL it has in the browser (after I start node and do npm install) ? Thanks.

ok, great. I’ll wait for the article then. 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.

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.

Did you add your server’s public key to your github repo?

Thanks. Getting this error. <br> <br>Permission denied (publickey). <br>fatal: The remote end hung up unexpectedly <br> <br>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 ? <br> <br>Thanks for your help, again! <br>

Run this command as the app user: <br> <br><pre>ssh-keygen -t rsa -N ‘’</pre> <br> <br>Press enter if it asks you where to store the key pair. <br> <br>Add the public key as a deploy key in your github repo: <br> <br><pre>cat ~/.ssh/id_rsa.pub</pre> <br> <br>Then clone the git repo: <br> <br><pre>cd ~ <br>git clone git@github.com:user/privateRepo.git</pre>

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.

@abachuk: Is it a private github repo?