How do I deploy a Harp app on DigitalOcean

I created a website with Harp.js (, but I have no clue how to deploy it on my DigitalOcean server. Can someone please help?

Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

This comment has been deleted

host it with pm2, here is what I do with vagrant. structure like /var/www/ /var/www/ /var/www/ # the server, which will be hold by pm2 /var/www/ # site content, so here are the harp-content like html/harp.json , html/public/articles , html/public/index.jade

  1. node -v I use nvm to install node, which you can use some alternative way. The point is node version.

curl -o- | bash nvm install 4.4.3 ( dont run nvm install stable because it will install v6.0.0 which is not robust yet ) nvm alias default 4.4.3 nvm use default

  1. Nginx

sudo touch /etc/nginx/sites-available/ sudo nano /etc/nginx/sites-available/

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;
    server_name localhost;
    #server_name; # the domain
    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;
        proxy_set_header X-NginX-Proxy true;

ref Ghost (a node blogging app) Nginx setting

  1. site content

sudo mkdir -p /var/www/ sudo chown -R $USER:$USER /var/www/ sudo chmod -R 755 /var/www npm install -g harp ( will install 0.20.3 and it is ok for harp cmd , but not for the server ) harp init /var/www/ --boilerplate kennethormandy/hb-remedy site content in /var/www/ with /var/www/ (site info)

  1. /var/www/

cd /var/www/ touch package.json echo “{}” >> package.json npm install harp@0.19.0 --save echo “require(‘harp’).server(__dirname+‘/html’, { port: process.env.PORT || 9000 })” >> /var/www/

Test-to-run: node /var/www/ and should have no error. If you don’t specify harp@0.19.0 then there might be errors ( like asking to do npm rebuild node-sass or the libsass binding was not found ) in harp@0.20.3 (the latest version which would do default install) ref

  1. pm2

npm install -g pm2 pm2 startup ubuntu # then do as prompt cmd

then restart vps

pm2 start /var/www/ pm2 dump && pm2 kill && pm2 resurrect Now as the vps starts, pm2 will trigger hpserver.js and serving every changes to /var/www/ For back up, just save the whold dir ( hpserver.js + package.json + node_modules dir + html dir )