Skip to content
Gabriel Vigliensoni edited this page Jun 6, 2017 · 16 revisions

Installing PostgreSQL

Rodan only supports PostgreSQL as its database backend at this moment. Please let us know through GitHub issues if you need the support of a different database backend.

1. On Ubuntu you can Install postgreSQL and postgreSQL-Contrib with apt-get.

$> sudo apt-get install postgresql postgresql-contrib

On Mac, use Homebrew:

$> brew install postgresql

Lets also get the python extentions for postgresql:

$> sudo apt-get install postgresql-plpython

Mac users:

$> brew install postgres --with-python

2. After installing PostgreSQL you will need to start it, log in database console as the PostgreSQL root user and create a Database and accounts for django to use.

(On Ubuntu you need to execute the following first)

$> sudo -i -u postgres
$> psql postgres

(Mac users:)

$> postgres -D /usr/local/var/postgres
$> brew services start postgresql
$> psql postgres

Now you can set the $DB_USER, $DB_PASSWORD and $DB_NAME for your own configurations. You will need them later and the quotes (',") are necessary around the $DB_PASSWORD and $DB_NAME variables where they are specified.

postgres=# create user $DB_USER with password '$DB_PASSWORD';
postgres=# alter user $DB_USER with createdb;  # add create db privilege for Django testing
postgres=# create database $DB_NAME;
postgres=# grant all privileges on database "$DB_NAME" to $DB_USER;

3. If multiple people need to be accessing this server, after setting up the user and database, we need to allow access to PostgreSQL from the subnets of Rodan server and Rodan workers. First, add (or change) the following line to /etc/postgresql/9.3/main/postgresql.conf:

listen_addresses = '*'

Then, open /etc/postgresql/9.3/main/pg_hba.conf, and add following line for each of the subnets:

host  $DB_NAME  $DB_USER  $SUBNET  md5

4. Restart PostgreSQL with the following commands:

$> sudo /etc/init.d/postgresql reload
$> sudo /etc/init.d/postgresql restart

Mac users:

$> brew services restart postgres

Websocket messaging support

(Currently, Rodan has not provided any option for disabling Websocket messaging, although it is an extra functionality for Rodan. If you need an option for disabling it, please let us know through GitHub issues.)

1. Install Redis, as the backend for Websocket messaging. (on Ubuntu, sudo apt-get install redis-server)

Mac users:

$> brew install redis
$> sudo pip install psycopg2

2. Install Python 2.7 and its extension for PostgreSQL (on Ubuntu, sudo apt-get install postgresql-plpython).

3. Install Python package redis globally (sudo pip install redis).

4. Log in database console as Postgres root user. Create another PostgreSQL superuser account for registering Rodan bindings later from the Rodan server, again take note of the quotes (') around $DB_SU_PASSWORD.

postgres=# create user $DB_SU_USER with password '$DB_SU_PASSWORD';
postgres=# alter user $DB_SU_USER with superuser;

5. Allow logging in with the newly created superuser from the subnets of Rodan server and workers. Open /etc/postgresql/9.3/main/pg_hba.conf, and add following line:

host  $DB_NAME  $DB_SU_USER  $RODAN_SERVER_IP/32 md5

(on Mac it may be located at /usr/local/var/postgres/pg_hba.conf)

6. Restart PostgreSQL.

$> sudo /etc/init.d/postgresql reload
$> sudo /etc/init.d/postgresql restart

Mac users:

$> brew services restart postgres
Clone this wiki locally