Support #648
Updated by Daniel Curtis over 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>
* Test JSbin in development mode:
<pre>
jsbin
</pre>
#* Go to http://localhost:3000 in a web browser
h2. Install JSbin from GitHub
* Clone JSbin from GitHub:
<pre>
git clone https://github.com/remy/jsbin.git
cd jsbin
npm install -g
</pre>
* Setup JSbin for production:
<pre>
npm install -g grunt-cli
npm install --dev
grunt build
</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>
* Edit the local JSbin config:
<pre>
vi config.local.json
</pre>
#* And change the env variable from development to production:
<pre>
"env": "production",
</pre>
* Test JS Bin in production:
<pre>
cd /usr/lib/node_modules/jsbin
node .
</pre>
h2. Running JSbin with PM2
* Install pm2 globally:
<pre>
npm install -g pm2
</pre>
* Add a jsbin user to separate privileges:
<pre>
useradd -g users -d /usr/lib/node_modules/jsbin -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 bin/jsbin
</pre>
h2. Resources
* https://github.com/jsbin/jsbin/blob/master/docs/running-your-own-jsbin.md
* https://github.com/nodesource/distributions