Skip to content
José Fresco edited this page Jan 22, 2015 · 62 revisions

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

Requirements

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

Notes

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.

Install

Unix and OS/X

  • Fork or download this repository.
  • cd to the project's location
  • Based on the sample.json create your own configuration (cp config/sample.json config/development.json for default values)
  • Make sure MongoDB is running and reachable as configured in config/development.json.
  • Set the enviroment variable NODE_PATH with value: ..
  • 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

(Note: DemocracyOS uses Component, 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).

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-certs

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. From the project's root path, you need to run:
  4. npm install to install node dependencies.
  5. node ./bin/dos-install && node ./bin/dos-config && node ./bin/dos-build && node index.js to build and run the app.

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.

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:

Clone this wiki locally