Skip to content

Commit

Permalink
Merge pull request #433 from NYUCCL/heroku_instructions
Browse files Browse the repository at this point in the history
Heroku instructions warn about exposing database_url.
  • Loading branch information
deargle committed Aug 19, 2020
2 parents ea82b12 + e2b5fdf commit e3fb34f
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions doc/heroku.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,6 @@ If you're starting from a preexisting psiturk app, you need to grab three files

heroku addons:create heroku-postgresql

#. Get the URL of the Postgres database that you just created: ::

heroku config:get DATABASE_URL

#. Get the URL of your app: ::

heroku domains

#. In your psiTurk example, open the `config.txt` file. Here, find and make the following settings for the these rows, and then save the file: ::

database_url = <Your Postgres database URL that you retrieved above>
host = 0.0.0.0
threads = 1
ad_location = https://<Your app URL that you retrieved above>/pub
use_psiturk_ad_server = false

#. Run the following commands, replacing `<XYZ>` with your access and secret keys for `Amazon Web Services <amt_setup.html#obtaining-aws-credentials>`_ and `psiTurk Secure Ad Server <psiturk_org_setup.html#obtaining-psiturk-org-api-credentials>`_ (you can also use `this Python script <https://github.com/NYUCCL/psiTurk/blob/908ce7bcfc8fb6b38d94dbae480449324c5d9d51/psiturk/example/set-heroku-settings.py>`_ to automatically run these commmands, provided that you've filled out your credentials in your `.psiturkconfig` file. Running this script is the recommended approach!): ::

heroku config:set ON_CLOUD=true
Expand All @@ -71,6 +55,10 @@ If you're starting from a preexisting psiturk app, you need to grab three files
heroku config:set aws_access_key_id=<XYZ>
heroku config:set aws_secret_access_key=<XYZ>

You don't need all of these settings if you run psiTurk standalone, independent of Amazon Mechanical Turk.
However, you still need specify `ON_CLOUD=true` or psiTurk will not bind to the port specified by Heroku.
In that case the app log on Heroku will say `Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch`.

#. Stage all the files in your psiTurk example to your Git repository: ::

git add .
Expand All @@ -83,6 +71,27 @@ If you're starting from a preexisting psiturk app, you need to grab three files

git push heroku master

#. Get the URL of the Postgres database that you just created: ::

heroku config:get DATABASE_URL

#. Get the URL of your app: ::

heroku domains

#. In your psiTurk example, open the `config.txt` file. Here, find and make the following settings for the these rows, and then save the file: ::

database_url = <Your Postgres database URL that you retrieved above>
host = 0.0.0.0
threads = 1
ad_location = https://<Your app URL that you retrieved above>/pub
use_psiturk_ad_server = false

Your local psiTurk instance needs these settings to communicate with the database on Heroku.
You do not need to push these settings to Heroku to make them work.
Specifically, be careful who has access to this file and do not push this information to any public git repositories:
**anyone who has access to the database_url can connect to your database and has access to the data stored in it!**

#. Run `psiTurk` locally on your machine: ::

psiturk
Expand Down

0 comments on commit e3fb34f

Please sign in to comment.