Skip to content

Installation Instructions on Nodejitsu

Mac Robeson edited this page Jul 5, 2022 · 30 revisions

CrowdGauge runs on Node.js and can be hosted on any server running Node. These instructions are for hosting on Nodejitsu.com.

Jitsu setup

  1. Install Node.js (this will automatically install the package manager called NPM)
  2. Set up an account on Nodejitsu.com and follow the instructions in the email. Note: for some reason they include the Ubuntu-specific 'sudo' command in the instructions. If you're not on Ubuntu (or similar) just leave that first part off and run "npm install jitsu -g".
  3. As per the email instructions, you will be asked to confirm your account and set up a password.

Clone crowdgauge from github

  1. Clone the github repository: https://github.com/placematters-decision-lab/crowdgauge.git
  2. By default, your application will be run from a subdomain on Nodejitsu (e.g. crowdgauge.jit.su). Open package.json in the root of the repository you just cloned and edit the 'subdomain' property from 'crowdgauge' to whatever you want as your unique URL on jit.su (jitsu will warn you later if its taken). Note that certain characters (such as underscores) are not permitted in the URL. See this regex.

Deploy your application

  1. Navigate a command window / terminal to the root of the crowdgauge folder you just cloned (where package.json resides).
  2. Run the command: jitsu deploy
  3. The application should upload and attempt to run, but it will return an error at this point because we still need to configure databases.

Database setup

  1. Log in to the Nodejitsu control panel.
  2. Open the 'Apps' tab. Select your app on the side panel and then select the 'Environment variables' tab. Click 'Add variable' to add these keys:
COUCH_URL, REDIS_HOST, REDIS_PORT, REDIS_KEY
  1. Enter 6379 next to REDIS_PORT
  2. You are going to need to copy multiple variables across so use a new browser tab (or window). Open the 'Databases' tab.
  3. Click CouchDB on the left and add an IrisCouch database.
    • Copy the connection string and paste in the other window next to the COUCH_URL key under 'Environment variables'.
  4. Click on Redis (By Iriscouch) on the left and then 'Add database'.
    • Copy the Host URL and paste it next to REDIS_HOST
    • Copy the Password and paste it next to REDIS_KEY
  5. Click 'Save'

You're good to go

Redeploy the application as per the 'Deploy your application' instructions above.

To start building content, go to your_subdomain.jit.su/client/contribute/index.html. You will be prompted to sign in with a Persona account.

Secure CouchDB

Once you have everything set up, you probably want to secure your CouchDB database which is completely open by default.

  1. Copy the CouchDB URL (the one you copied into the COUCH_URL variable) and append /_utils/ at the end. Hit that URL.
  2. Click the 'Fix this' link at the bottom right to set up a CouchDB username and password.
  3. Update your COUCH_URL environment variable: insert username:password@ as a prefix after 'https://' - it should look something like this:
https://joe:[email protected]:6984/

If you run into problems, please see the troubleshooting page