RapidPro Development Server
RapidPro comes with everything you need to quickly get started with development. Note that development and deployment has only been tested on OSX and Ubuntu, you’ll likely need to modify the directions below if using Windows.
Prerequisites
You’ll need the following to get started:
- PostgreSQL 9.3 or later along with the PostGIS extensions. You probably want to refer to Django’s installation instructions to help get this working.
- Redis 2.8 or later installed and listening on localhost. By default the development server uses database 15.
- lessc, the Less compiler.
- coffee, the Coffee script compiler.
- bower, package manager for javascript libraries.
- libmagic or libmagic-dev depending on your development platform. Required by https://github.com/dveselov/python-libmagic.
Create temba user for PostgreSQL
$ createuser temba --pwprompt -d
Enter password for new role:
Enter it again:Create temba database, add PostGIS
Create the database as temba user:
$ psql --user=temba postgres
postgres=> create database temba;
CREATE DATABASENow connect as a superuser that can install extensions:
$ psql
postgres=# \c temba
You are now connected to database "temba" as user "psql".
temba=# create extension postgis;
CREATE EXTENSION
temba=# create extension postgis_topology;
CREATE EXTENSION
temba=# create extension hstore;
CREATE EXTENSIONClone RapidPro
Now clone the RapidPro repository and link up the development settings:
$ git clone git@github.com:rapidpro/rapidpro.git
$ cd rapidpro
$ ln -s temba/settings.py.dev temba/settings.pyBuild virtual environment
You should always use a virtual environment to run your RapidPro installation. The
pinned dependencies for RapidPro can be found in pip-freeze.txt. You can
build the needed environment as follows (from the root rapidpro directory):
$ virtualenv env
$ source env/bin/activate
(env) $ pip install -r pip-freeze.txtSync your database
You should now be able to run all the migrations and initialize your development server. This takes a little while on RapidPro as migrate also creates and initializes all the user groups and permissions.
$ python manage.py migrateInstall bower scripts
Before you can run your server, you will need the web-tier dependencies. These are managed by bower (see bower.json in the root for more details).
$ bower installRun development server
At this point you’ll be able to run the development server and run RapidPro. It
will be available at http://localhost:8000
$ python manage.py runserverTesting with the RapidPro SMS Channel Android app
Configure to connect to your development server
There is a hidden feature of the RapidPro SMS Channel Android app for testing your RapidPro development instance on a local network.
If you tap the rapidpro logo in the app 11 times you can unlock the advanced settings,
which will let you enter any an IP address. The app will attempt to connect to RapidPro
using the given IP address on port 8000 so you can claim the relayer and test
sending/receiving with real SMS messages. If you need to use a different port, you can
append it to the IP address like: 192.168.1.15:80.
Android only allows a single app to send a certain number of messages per hour. However, you can increase your message throughput by installing “SMS Channel Pack” apps, which effectively raise the allowed number of messages for the RapidPro SMS Channel Android app. On the RapidPro SMS Channel app’s page in the Play Store, click on ‘More by Nyaruka Ltd.’ and install up to 9 of the SMS Channel Packs to increase your message volume.