Skip to content

[DEPRECATED] Installation

Matías Lescano edited this page Sep 29, 2016 · 1 revision

This is a quick reference to get DemocracyOS up and running.

Requirements

To get started with DemocracyOS, you will need to have installed:

Notes

DemocracyOS uses ComponentJS, a frontend package manager and build tool that grabs its dependencies from GitHub repositories. Due a GitHub quota limitation with anonymous requests, you may get a build error when running the initial make. If you run into this issue, just follow the instructions from Component - Required Authentication, as instructed in the error logs). YOUR CODE WILL NOT BUILD IF YOU DON'T CONFIGURE THIS

Running on Windows environment is not currently supported. If you happen to be familiar with Docker or Vagrant, please lend us a hand and submit a PR so we can collaborate on a solution for this.

Finally, check your environment variables and read Environments and config files if something is not working properly.

When building node-gyp, make will fail throwing an error about python >= 3.0.0 not being supported. If you run python3 on your system, please pass the following command in your shell: $ npm config set python /path/to/executable/python2.7

Install

Unix and OS/X

  • Fork or download this repository.
  • cd to the project's location
  • Based on the defaults.json create your own configuration with the values you need to everride (e.g. config/development.json)
  • Make sure MongoDB is running and reachable as configured in config/development.json.
  • Set the environment variable NODE_PATH with value: ..
  • Make sure to set GITHUB_USERNAME & GITHUB_PASSWORD according to the following guide
  • Install, Config and run the Notifier Server.
  • From the root path, run make. (where is the Makefile)
  • For users behind corporate proxy, its recommended to redirect git clone to https (git config --global url."https://".insteadOf git://) and set properly http and https proxy env

Running

Once DemocracyOS components and dependencies are installed, you can start the application like this:

make run

Take a look at the Makefile for more information about the possible tasks you can run.

You can check the current Democracy OS version running on http://localhost:3000/api

Using SSL

In case you want to use SSL in your dev environment (it's disabled by default), you'll need to have proper certificate files. We ship a script that generates the needed files. Just run the following command in the source path:

NODE_PATH=. node bin/dos-ssl

Then modify your configuration file by changing the protocol property to https and run it normally.

A note on using port 443

The default configuration file make the app listens to port 443 to handle SSL connections. In some OSs, a normal user cannot perform this operation, and you are likely to get this error:

events.js:72
       throw er; // Unhandled 'error' event
             ^
Error: bind EACCES
   at errnoException (net.js:904:11)
   at net.js:1072:30
   at Object.37:1 (cluster.js:594:5)
[...]

To solve it without being root (that is always a bad idea), you can change the ssl.port value in your configuration file to another port, say 4443.

Running in production environment

  1. Configure your environment variables for production; specifically, set NODE_ENV to production
  2. Set your MongoDB instance to run as a service.
  3. Install and Config the Notifier Server.
  4. From the project's root path, you need to run make or:
  5. npm install to install node dependencies.
  6. node ./bin/dos-install && node ./bin/dos-build && node index.js to build and run the app. Don't run as sudo.

If something goes wrong you can always go back to a clean slate running make clean. If you're running other node services in the same server and you can't compromise NODE_PATH as an env variable, just prepend NODE_PATH=. to the build & run command.

OS specifics

  • Check this very detailed guide if you're on Ubuntu 10 LTS.
  • On Ubuntu 14/13/lower, install the package node-legacy for NodeJS.
  • Check this guide on how to run DemocracyOS as a service.

Loading sample data

In order for you to see a fully working deployment, you will need some sample data. This can be achieved by either of these approaches:

Troubleshooting

Random error downloading components

Symptom: You did make and randomly got this error while downloading components:

fatal : no remote found for dependency "<dependency name>". Visit http://component.github.io/troubleshooting for help.

or a timeout error.

Solution: Refer to this page or do the following:

  1. Generate a personal access token here.

  2. Edit or create ~/.netrc and append the following:

machine api.github.org
  login yourgithublogin
  password agianthashthatgithubgenerates
  1. Append the following to ~/.bashrc and ~/.zshrc (if exists):

export GITHUB_USERNAME="yourgithublogin" export GITHUB_PASSWORD="agianthashthatgithubgenerates"


4. Restart your computer.


## Let us know!
Don't forget to email Mair Williams (mair [at] democracyos.org) or Pia Mancini (pia [at] democracyos.org) if you are launching live instances of DemocracyOS so we can help you with communication from our networks. It's also easier for us to let you know about new features and progress if we know who's running the instances.