Installation¶
Varda depends on a database server, a message broker, a task result backend, Python 2.7, and several Python packages. This section walks you through installing Varda using PostgreSQL as database server and Redis as message broker and task result backend, which is the recommended setup.
Note
All operating system specific instructions assume installation on a Debian 7 wheezy system. You’ll have to figure out the necessary adjustements yourself if you’re on another system.
The following steps will get Varda running on your system with the recommended setup:
- Database server: PostgreSQL
- Message broker and task result backend: Redis
- Python virtual environment
- Varda setup
At the bottom of this page some alternative setups are documented.
If you’re in a hurry¶
The impatient can install and run Varda without a database server and more such nonsense with the following steps:
$ pip install -r requirements.txt
$ python -m varda.commands debugserver --setup
Don’t use this for anything serious though.
Database server: PostgreSQL¶
Install PostgreSQL and add a user for Varda. Create a database
(e.g. varda
) owned by the new user. For example:
$ sudo apt-get install postgresql
$ sudo -u postgres createuser --superuser $USER
$ createuser --pwprompt --encrypted --no-adduser --no-createdb --no-createrole varda
$ createdb --encoding=UNICODE --owner=varda varda
Also install some development libraries needed for building the psycopg2
Python package later and add the package to the list of requirements:
$ sudo apt-get install python-dev libpq-dev
$ echo psycopg2 >> requirements.txt
This will make sure the Python PostgreSQL database adapter gets installed in the Python virtual environment section.
See also
- Database server: MySQL
- Alternatively, MySQL can be used as database server.
- Database server: SQLite
- Alternatively, SQLite can be used as database server.
- Dialects – SQLAlchemy documentation
- In theory, any database supported by SQLAlchemy could work.
Message broker and task result backend: Redis¶
Varda uses Celery for distributing long-running tasks. A message broker is needed for communication between the server process and worker processes. Simply install Redis and you’re done.
$ sudo apt-get install redis-server
See also
- Message broker: RabbitMQ
- Alternatively, RabbitMQ can be used as message broker.
- Brokers – Celery documentation
- It should be possible to use any message broker and any task result backend supported by Celery.
Python virtual environment¶
It is recommended to run Varda from a Python virtual environment, using virtualenv. Installing virtualenv and creating virtual environment is not covered here.
Assuming you created and activated a virtual environment for Varda, install all required Python packages:
$ pip install -r requirements.txt
Now might be a good idea to run the unit tests:
$ nosetests -v
If everything’s okay, install Varda:
$ python setup.py install
See also
- virtualenv
virtualenv
is a tool to create isolated Python environments.- virtualenvwrapper
virtualenvwrapper
is a set of extensions to thevirtualenv
tool. The extensions include wrappers for creating and deleting virtual environments and otherwise managing your development workflow.
Varda setup¶
Varda looks for its configuration in the file specified by the
VARDA_SETTINGS
environment variable. First create the file with your
configuration settings, for example:
$ export VARDA_SETTINGS=~/varda/settings.py
$ cat > $VARDA_SETTINGS
DATA_DIR = '/data/varda'
SQLALCHEMY_DATABASE_URI = 'postgresql://varda:*****@localhost/varda'
BROKER_URL = 'redis://'
CELERY_RESULT_BACKEND = 'redis://'
Make sure DATA_DIR
refers to a directory that is writable for Varda. This
is where Varda stores uploaded and generated files.
A script is included to setup the database tables and add an administrator user:
$ varda setup
You can now proceed to Running Varda.
See also
- Configuration
- For more information on the available configuration settings.
Alternative setups¶
The remainder of this page documents some alternatives to the recommended setup documented above.
Database server: MySQL¶
Install MySQL and create a database (e.g. varda
) with all privileges
for the Varda user. For example:
$ sudo apt-get install mysql-server
$ mysql -h localhost -u root -p
> create database varda;
> grant all privileges on varda.* to varda@localhost identified by '*****';
Also install some development libraries needed for building the MySQL-python
Python package later and add the package to the list of requirements:
$ sudo apt-get install python-dev libmysqlclient-dev
$ echo MySQL-python >> requirements.txt
This will make sure the Python MySQL database adapter gets installed in the Python virtual environment section.
See also
- Database server: PostgreSQL
- The recommended setup uses PostgreSQL as database server.
Database server: SQLite¶
You probably already have all you need for using SQLite.
See also
- Database server: PostgreSQL
- The recommended setup uses PostgreSQL as database server.
Message broker: RabbitMQ¶
Preferably install RabbitMQ from the APT repository provided by RabbitMQ. Example:
$ sudo apt-get install rabbitmq-server
$ sudo rabbitmqctl add_user varda varda
$ sudo rabbitmqctl add_vhost varda
$ sudo rabbitmqctl set_permissions -p varda varda '.*' '.*' '.*'
See also
- Message broker and task result backend: Redis
- The recommended setup uses Redis as message broker.