Skip to content

praekeltfoundation/rp-sidekick

Repository files navigation

Rapidpro Sidekick

Build Passing/Failing on TravisCI.com Code Style: Black Code Coverage Rapidpro Sidekick Documentation Docker Automated build

Sidekick is a Django application which provides additional functionality to RapidPro through RapidPro’s webhooks within flow, as well as using RP’s REST API to initiate flows, update contact fields etc. In some respects it functions much like setting up serverless functions to handle webhooks and return responses. However there are some additional benefits to using a Django application, primarily User authentication and management, as well as management of RapidPro Orgs.

Local installation

To set up and run rp-sidekick locally, do the following:

$ git clone [email protected]:praekeltfoundation/rp-sidekick.git
$ cd rp-sidekick
$ virtualenv ve
$ source ve/bin/activate
$ pip install -e .
$ pip install -r requirements-dev.txt
$ pre-commit install

RP-Sidekick does not work with SQLite because it uses JSONFields. This means that you will need to set up PostgreSQL locally. You can spin up a local db with docker, using the following command:

$ docker run -d -p 5432:5432 --name=sidekick_db -e POSTGRES_DB=rp_sidekick postgres:9.6

Tools

  • black - this repository uses an opinionated python code formatter. See pyproject.toml for config.
  • pre-commit - lints staged code as a git pre-commit check. Will prevent commits if linting fails. Currently runs black, flake8 and yamllint.

Running in Production

There is a [docker image](https://github.com/praekeltfoundation/rp-sidekick/pkgs/container/rp-sidekick) that can be used to easily run this service. It uses the following environment variables for configuration:

Variable | Description |
---------- | ----------- |
SECRET_KEY | The django secret key, set to a long, random sequence of characters |
DATABASE_URL | Where to find the database. Set to postgresql://host:port/db for a postgresql database |
ALLOWED_HOSTS | Comma separated list of hostnames for this service, eg. host1.example.org,host2.example.org |
BROKER_URL | Where to find the broker. Set to amqp://username:password@host:post/vhost to connect to RabbitMQ |
SENTRY_DSN | Where to send exceptions to |

Contributing

See our ways of working for a guide on how to contribute to rp-sidekick.