I created a website with Harp.js (harpjs.com), but I have no clue how to deploy it on my DigitalOcean server. Can someone please help?
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!
See How To Use PM2 to Setup a Node.js Production Environment On An Ubuntu VPS. You can use the user you created while following Initial Server Setup with Ubuntu 14.04 as the “safeuser”.
host it with pm2, here is what I do with vagrant. structure like /var/www/hp.com/package.json /var/www/hp.com/node_modules /var/www/hp.com/hpserver.js # the server, which will be hold by pm2 /var/www/hp.com/html # site content, so here are the harp-content like html/harp.json , html/public/articles , html/public/index.jade
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash nvm install 4.4.3 ( dont run
nvm install stablebecause it will install v6.0.0 which is not robust yet ) nvm alias default 4.4.3 nvm use default
sudo touch /etc/nginx/sites-available/hp.com sudo nano /etc/nginx/sites-available/hp.com
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name localhost;
#server_name lorem.com www.lorem.com; # the domain
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:9000;
}
}
ref Ghost (a node blogging app) Nginx setting https://www.digitalocean.com/community/tutorials/how-to-host-ghost-with-nginx-on-digitalocean
sudo mkdir -p /var/www/hp.com/html sudo chown -R $USER:$USER /var/www/hp.com/html 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/hp.com/html --boilerplate kennethormandy/hb-remedy site content in /var/www/hp.com/html/public with /var/www/hp.com/html/harp.json (site info)
cd /var/www/hp.com 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/hp.com/hpserver.js
Test-to-run:
node /var/www/hp.com/hpserver.jsand 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 http://harpjs.com/docs/deployment/azure
npm install -g pm2 pm2 startup ubuntu # then do as prompt cmd
pm2 start /var/www/hp.com/hpserver.js pm2 dump && pm2 kill && pm2 resurrect Now as the vps starts, pm2 will trigger hpserver.js and serving every changes to /var/www/hp.com/html. For back up, just save the whold hp.com dir ( hpserver.js + package.json + node_modules dir + html dir )
This comment has been deleted
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.