### Start Django server Source: https://rapidpro.github.io/rapidpro/docs/development This command starts the Django development server for RapidPro. ```bash $ python manage.py runserver ``` -------------------------------- ### Install javascript dependencies Source: https://rapidpro.github.io/rapidpro/docs/development This command installs the necessary Javascript dependencies using NPM. ```bash $ npm install ``` -------------------------------- ### Install lessc and coffeescript Source: https://rapidpro.github.io/rapidpro/docs/development This snippet shows how to globally install 'less' and 'coffeescript' using NPM, which are needed for template and CSS compilation. ```bash $ sudo npm install less -g $ sudo npm install coffeescript -g ``` -------------------------------- ### Create temba database, add PostGIS Source: https://rapidpro.github.io/rapidpro/docs/development This snippet demonstrates creating the 'temba' database and then connecting to it to install PostGIS, hstore, and uuid-ossp extensions. ```bash $ createdb temba $ 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 EXTENSION temba=# create extension "uuid-ossp"; CREATE EXTENSION ``` -------------------------------- ### Create Superuser Source: https://rapidpro.github.io/rapidpro/docs/hosting Command to create a superuser for managing RapidPro installations. ```bash python manage.py createsuperuser ``` -------------------------------- ### Start Mailroom Source: https://rapidpro.github.io/rapidpro/docs/development This command starts the Mailroom service, which is necessary for editing and running flows in the development environment. ```bash $ ./mailroom ``` -------------------------------- ### Nginx rewrite rule for Mailroom URLs Source: https://rapidpro.github.io/rapidpro/docs/mailroom An example Nginx rewrite rule to forward all URLs starting with /mr/ to the Mailroom server. ```nginx # all Mailroom URLs go to Mailroom location ^~ /mr/ { proxy_set_header Host $http_host; proxy_pass http://mailroom_server; break; } ``` -------------------------------- ### Build virtual environment Source: https://rapidpro.github.io/rapidpro/docs/development This snippet outlines the steps to create and activate a Python virtual environment and install RapidPro dependencies using Poetry. ```bash $ python3 -m venv env $ source env/bin/activate (env) $ poetry install ``` -------------------------------- ### Nginx Rewrite Rule for Courier URLs Source: https://rapidpro.github.io/rapidpro/docs/courier An example nginx location block to forward all URLs starting with /c/ to the Courier server. ```nginx location ^~ /c/ { proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } ``` -------------------------------- ### Nginx configuration for Macrokiosk redirects Source: https://rapidpro.github.io/rapidpro/docs/courier This Nginx configuration block handles redirects for paths starting with /handlers/macrokiosk/, rewriting them to a different format and proxying to the courier_server. ```nginx location ~ /handlers/macrokiosk/ { rewrite /handlers/macrokiosk/(.*)/(.*)?(.*) /c/mk/$2/$1?$3; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } ``` -------------------------------- ### Nginx configuration for FCM redirects Source: https://rapidpro.github.io/rapidpro/docs/courier This Nginx configuration block handles redirects for paths starting with /handlers/fcm/, rewriting them to a different format and proxying to the courier_server. ```nginx location ~ /handlers/fcm/ { rewrite /handlers/fcm/(.*)/(.*)/ /c/fcm/$2/$1; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } ``` -------------------------------- ### Import All GeoJSON Data Source: https://rapidpro.github.io/rapidpro/docs/hosting Steps to import all country administrative boundaries for mapping features from GeoJSON files. ```bash cp /path/to/posm-extracts/geojson/*_simplified.json . python manage.py import_geojson *_simplified.json ``` -------------------------------- ### Sync your database Source: https://rapidpro.github.io/rapidpro/docs/development This command synchronizes the database by running all migrations and initializing user groups and permissions. ```bash $ python manage.py migrate ``` -------------------------------- ### Import GeoJSON for a Single Country Source: https://rapidpro.github.io/rapidpro/docs/hosting Steps to import country administrative boundaries for mapping features using a GeoJSON file. ```bash cp /path/to/posm-extracts/geojson/R192796*_simplified.json . python manage.py import_geojson *_simplified.json ``` -------------------------------- ### Clone RapidPro Source: https://rapidpro.github.io/rapidpro/docs/development This snippet shows how to clone the RapidPro repository and link the development settings. ```bash $ git clone git@github.com:rapidpro/rapidpro.git $ cd rapidpro/temba $ ln -s temba/settings.py.dev settings.py $ cd .. ``` -------------------------------- ### Configure to connect to your development server Source: https://rapidpro.github.io/rapidpro/docs/development This describes how to use a hidden feature in the RapidPro SMS Channel Android app to connect to a development server by tapping the logo 11 times to unlock advanced settings. ```bash 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`. ``` -------------------------------- ### Loading boundary data Source: https://rapidpro.github.io/rapidpro/docs/locations You can load new countries using the admin utility `import_geojson`. It expects files as generated by the POSM extra utility. ```bash $ python manage.py import_geojson extracts.zip ``` -------------------------------- ### Create temba user for PostgreSQL Source: https://rapidpro.github.io/rapidpro/docs/development This snippet shows how to create a PostgreSQL user named 'temba' with the password 'temba'. ```bash $ createuser temba --pwprompt -d Enter password for new role: (enter temba) Enter it again: (enter temba) ``` -------------------------------- ### Nginx Redirects for Legacy Handlers Source: https://rapidpro.github.io/rapidpro/docs/courier Sample nginx location blocks to redirect legacy RapidPro message handling URLs to Courier. ```nginx location /handlers/telegram/ { rewrite /handlers/telegram/(.*) /c/tg/$1/receive; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /shaqodoon/received/ { rewrite /shaqodoon/received/(.*)/ /c/sq/$1/receive; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /kannel/receive/ { rewrite /kannel/receive/(.*)/(.*) /c/kn/$1/receive$2; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /kannel/status/ { rewrite /kannel/status/(.*)(.*) /c/kn/$1/status$2; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /handlers/external/received { rewrite ^/(.*)/$ /$1; rewrite /handlers/external/received/(.*) /c/ex/$1/receive; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /handlers/external/ { rewrite /handlers/external/(.*)/(.*)/(.*) /c/ex/$2/$1$3; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /handlers/facebook/ { rewrite /handlers/facebook/(.*) /c/fb/$1/receive; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /handlers/start/receive/ { rewrite /handlers/start/receive/(.*) /c/st/$1/receive; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /handlers/dartmedia/receive { rewrite /handlers/dartmedia/receive(.?)/(.*) /c/da/$2/receive; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /handlers/dartmedia/status { rewrite /handlers/dartmedia/status/(.*) /c/da/$1/status; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /handlers/viber_public/ { rewrite /handlers/viber_public/(.*)?(.*) /c/vp/$1/receive?$2; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /handlers/yo/ { rewrite /handlers/yo/received/(.*)?(.*) /c/yo/$1/receive?$2; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /handlers/jasmin/ { rewrite /handlers/jasmin/(receive|status)/(.*) /c/js/$2/$1; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /m3tech/received/ { rewrite /m3tech/received/(.*)?(.*) /c/m3/$1/receive$2; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /handlers/jiochat/ { rewrite /handlers/jiochat/(.*) /c/jc/$1; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /handlers/smscentral/ { rewrite /handlers/smscentral/receive/(.*) /c/sc/$1/receive; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /handlers/globe/ { rewrite /handlers/globe/receive/(.*) /c/gl/$1/receive; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /handlers/line/ { rewrite /handlers/line/(.*)/ /c/ln/$1/receive; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /handlers/hcnx/receive { rewrite /handlers/hcnx/receive/(.*)?(.*) /c/hx/$1/receive?$2; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /handlers/hcnx/status { rewrite /handlers/hcnx/status/(.*)?(.*) /c/hx/$1/status?$2; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } location ~ /handlers/chikka/ { rewrite /handlers/chikka/(.*) /c/ck/$1/receive; proxy_set_header Host $http_host; proxy_pass http://courier_server; break; } ``` -------------------------------- ### Nginx upstream configuration for Mailroom Source: https://rapidpro.github.io/rapidpro/docs/mailroom Defines the upstream Mailroom server for Nginx configuration. ```nginx upstream mailroom_server { server 127.0.0.1:8090 fail_timeout=60; } ``` -------------------------------- ### Define Upstream Courier Server Source: https://rapidpro.github.io/rapidpro/docs/courier Defines the upstream server for the Courier instance, typically running on localhost port 8080. ```nginx upstream courier_server { server 127.0.0.1:8080 fail_timeout=60; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.