Skip to content
Ling-Xiao Yang edited this page Nov 4, 2015 · 17 revisions

This will set up Rodan worker. First, check out Rodan source, either by git (make sure to do a recursive clone for populating all submodules):

$> git clone --recursive https://github.com/DDMAL/Rodan.git

...or Rodan release (TODO).

Following instructions will use $RODAN_HOME as the absolute path where you have checked out the Rodan source code.

Set up Python environment

Rodan is based on Python 2.7.x. Python 3 does not work with Rodan.

We recommend that all Python packages (see requirements.txt) should be installed inside a dedicated virtual environment for Rodan, because a virtual environment allows you to have multiple Python "environments" on the same machine:

$> sudo pip install virtualenv
$> cd $RODAN_HOME
$> virtualenv --no-site-packages rodan_env

(Note: from now on, we assume that we are in $RODAN_HOME.)

Then activate virtual environment:

$> source rodan_env/bin/activate

Note that your prompt looks like the following:

(rodan_env)$>

Whatever Python modules are installed from now on will only be available while in this virtual environment. (To exit your virtual environment, simply use the command deactivate.)

Then we install all Python packages. You may need system libraries before compiling some of them. On Ubuntu, perform:

(rodan_env)$> sudo apt-get install libpython-dev lib32ncurses5-dev libxml2-dev libxslt1-dev zlib1g-dev lib32z1-dev libjpeg-dev libpq-dev

For other Linux distributions, please find corresponding names.

Install Python packages:

(rodan_env)$> pip install -r requirements.txt

Now, exit virtual environment by executing:

(rodan_env)$> deactivate

Install NFS client (if NFS is configured)

(rodan_env)$> apt-get install nfs-common inotify-tools

Create a folder for mounting NFS folder as $RESOURCE_FOLDER_MOUNT_POINT.

Configure Rodan source

TODO (autoconf)

$> autoconf
$> ./configure --enable-debug=no @CONFIGURE_DIVA@ RODAN_VENV_DIR=/srv/webapps/Rodan/rodan_env/ RODAN_DATA_DIR=/mnt/rodan_data DB_NAME="@DB_NAME@" DB_USER="@DB_USER@" DB_PASSWORD="@DB_PASSWORD@" DB_HOST="@DB_HOST@" DB_PORT="@DB_PORT@" DOMAIN_NAME="@DOMAIN_NAME@" IIPSRV_FCGI=/srv/fcgi-bin/iipsrv.fcgi MODE="@MODE@" CELERY_BROKER_URL="@CELERY_BROKER_URL@" CLIENT_MAX_BODY_SIZE="@CLIENT_MAX_BODY_SIZE@" REDIS_HOST="@REDIS_HOST@"

Install and configure supervisor

We use supervisor to register Rodan as system services.

Install supervisor:

$> sudo apt-get install supervisor

Copy generated supervisor configurations:

$> cp $RODAN_HOME/etc/supervisor/conf.d/rodan.conf /etc/supervisor/conf.d/

Set up permissions

In a production environment, it is highly recommended to set up a dedicated account like www-data:www-data for limiting the permission of the application:

$> chmod a+x $RODAN_HOME/celery_start.sh
$> touch $RODAN_HOME/rodan.log
$> touch $RODAN_HOME/database.log
$> chgrp -R www-data $RODAN_HOME/Rodan
$> chmod g+w $RODAN_HOME/rodan.log $RODAN_HOME/database.log
$> chown www-data:www-data $RESOURCE_FOLDER_MOUNT_POINT

Set up requirements for image processing jobs (optional if you do not intend to use Rodan for optical music recognition)

Prepare database

Activate virtual environment:

$> source rodan_env/bin/activate

Then synchronize database and create superuser. The migrate command will prompt for a PostgreSQL superuser access: select 1, and enter $DB_SU_USER and $DB_SU_PASSWORD.

(rodan_env)$> python manage.py makemigrations
(rodan_env)$> python manage.py migrate
(rodan_env)$> python manage.py createsuperuser

Last step

1. Mount NFS folder:

$> service rpcbind start
$> mount -t nfs -o proto=tcp,port=2049 $RESOURCE_FILE_SERVER_IP:/ $RESOURCE_FOLDER_MOUNT_POINT

Try if the mounted folder works fine.

2. (Re)start supervisor:

$> sudo service supervisor restart

Check sudo supervisorctl for Rodan status.

Now, Rodan worker should be available.

Clone this wiki locally