Inside Gratipay

This is Gratipay's internal company portal. First time here? Welcome! Start at the top. :-)

Run a Script

We have a number of scripts that we use for support tasks. They generally require two levels of configuration: virtualenv and heroku.

virtualenv

Python's sandboxing mechanism is called virtualenv. When you build the gratipay.com repo locally, you get a virtualenv at ./env/ that has all the libraries and tools you'll need to run scripts.

If you invoke a script as ./env/bin/python bin/script.py then you're using the Python interpreter in the virtualenv and you're all set.

Heroku

We store our production configuration as environment variables in Heroku, so to run a script against production you need to call it under the influence of heroku, either locally or remotely.

To call a script locally use heroku config with honcho:

$ heroku config -sa gratipay | ./env/bin/honcho run -e /dev/stdin \
    ./env/bin/python bin/script.py

To call a script on a remote Heroku dyno use heroku run:

$ heroku run -a gratipay bash
Running `bash` attached to terminal... up, run.2359
~ $ python bin/script.py

We pay by the minute for dynos, so close it when you're done!

invoke

We're in the process of migrating scripts to invoke tasks (see #2294). When you build gratipay.com we'll install invoke in the virtualenv. Here's how to list the invoke tasks locally:

$ ./env/bin/invoke --list

And remotely:

$ heroku run -a gratipay bash
Running `bash` attached to terminal... up, run.2359
~ $ invoke --list

We pay by the minute for dynos, so close it when you're done!

Table of Contents