This is a quick reference to get DemocracyOS up and running.
- Running in a production environment
- OS specifics
- Loading sample data
To get started with DemocracyOS, you will need to have installed:
- MongoDB open-source document database.
- NodeJS & NPM platform.
- Git distributed version control system. If you're on github and don't have
git, you're doing it wrong.
- Make build automation utility.
- OpenSSL in case you want to generate SSL certificates.
Unix and OS/X
- Fork or download this repository.
cdto the project's location
- Set up your configuration, and add your email as staff to be able to initialize your app.
- Make sure MongoDB is running and reachable as configured in
config/development.json. (Default values should work)
- Boom! DemocracyOS should be running on port 3000.
Please refer to the Configuration section to customize settings
Once DemocracyOS components and dependencies are installed, you can start the application like this:
Take a look at the Makefile for more information about the possible tasks you can run.
You can check the current DemocracyOS version going to
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 project root:
NODE_PATH=. node bin/dos-ssl
Then modify your configuration file by changing the
protocol property to
https and run it normally. Configuration options for SSL are listed here.
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
Running in production environment
- Configure your environment variables for production; specifically, set
- Set your
JWT_SECRETenvironment variable to something random. e.g.: Any of this.
- Set your MongoDB instance to run as a service.
- Make sure to correctly configure the Notifier for production environments.
- From the project's root path, you need to run
npm installto install node dependencies.
npm run build && npm run startto build assets and run the app. Don't run as
If something goes wrong you can always go back to a clean slate running
- Check this very detailed guide if you're on Ubuntu 10 LTS.
- On Ubuntu 14/13/lower, install the package
- Check this guide on how to run DemocracyOS as a service.
Running unit tests
To run unit tests simply run
A running MongoDB instance is required to perform tests. By default, the
DemocracyOS-test database is used and all its data is wiped on each run. If you want to override the database, just run the above command prefixing
MONGO_URL=<database uri>. For example:
MONGO_URL=mongodb://localhost/other-db npm test
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: Manually load sample fixtures bundled with DemocracyOS. Setup and access the administration module.