Project

General

Profile

Support #648

Updated by Daniel Curtis almost 9 years ago

{{>toc}} 

 This is a guide on installing JSbin on Debian 8. 

 h2. Prepare the System 

 * Make sure the system is up to date: 
 <pre> 
 apt-get update && apt-get upgrade 
 </pre> 

 * Install a few dependencies: 
 <pre> 
 apt-get install curl git build-essential libzmq-dev 
 </pre> 

 * Install nodejs and npm: 
 <pre> 
 curl -sL https://deb.nodesource.com/setup_0.10 | bash - 
 apt-get install -y nodejs 
 </pre> 

 h2. Install JSbin with npm 

 * Install JSbin using npm: 
 <pre> 
 npm install -g jsbin 
 </pre> 

 * Create a new config file and edit it as necessary: 
 <pre> 
 cd /usr/lib/node_modules/jsbin 
 cp config.default.json config.local.json 
 </pre> 

 * Install a few node modules: 
 <pre> 
 npm install grunt-contrib-uglify grunt-contrib-jshint grunt-contrib-concat 
 </pre> 

 * Then build the production files: 
 <pre> 
 grunt build 
 </pre> 

 * Test JSbin in development mode: 
 <pre> 
 jsbin 
 </pre> 
 #* Go to http://localhost:3000 in a web browser 

 h2. Running JSbin with PM2 

 * Install pm2 globally: 
 <pre> 
 npm install -g pm2 
 </pre> 

 * Add the startup script for pm2: 
 <pre> 
 pm2 startup ubuntu 
 </pre> 

 * Add a jsbin user to separate privileges: 
 <pre> 
 useradd -m -g users -s /bin/bash jsbin 
 </pre> 

 * Change the ownership of the global jsbin folder to the jsbin user: 
 <pre> 
 chown -R jsbin /usr/lib/node_modules/jsbin 
 </pre> 

 * Switch to the jsbin user: 
 <pre> 
 su - jsbin 
 </pre> 
 #* 

 * Start jsbin using pm2: 
 <pre> 
 pm2 start /usr/lib/node_modules/jsbin/bin/jsbin 
 </pre> 
 #* Exit from the jsbin user: 
 <pre> 
 exit 
 </pre> 

 * Then save the pm2 applications to allow them to start up after rebooting: 
 <pre> 
 pm2 save 
 </pre> 

 h2. Resources 

 * https://github.com/jsbin/jsbin/blob/master/docs/running-your-own-jsbin.md 
 * https://github.com/nodesource/distributions

Back