2018-12-03 15:12:24 +03:00
|
|
|
Using an existing Heroku database
|
|
|
|
=================================
|
|
|
|
|
|
|
|
.. contents:: Table of contents
|
|
|
|
:backlinks: none
|
|
|
|
:depth: 1
|
|
|
|
:local:
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-01-24 17:16:34 +03:00
|
|
|
Let's say you have an existing `Heroku Postgres <https://www.heroku.com/postgres>`__ database with data in it, and you'd
|
2018-09-11 14:11:24 +03:00
|
|
|
like add GraphQL on it.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
2019-02-14 12:37:47 +03:00
|
|
|
In case you're exposing an existing database (esp. if it is production), please configure an admin secret key
|
2018-09-11 14:11:24 +03:00
|
|
|
for the console and the GraphQL endpoint.
|
|
|
|
|
2019-01-29 12:27:15 +03:00
|
|
|
Step 1: Deploy Hasura on Heroku
|
2018-09-11 14:11:24 +03:00
|
|
|
-------------------------------
|
|
|
|
|
|
|
|
Deploy Hasura on Heroku by clicking on this button:
|
|
|
|
|
|
|
|
.. image:: https://camo.githubusercontent.com/83b0e95b38892b49184e07ad572c94c8038323fb/68747470733a2f2f7777772e6865726f6b7563646e2e636f6d2f6465706c6f792f627574746f6e2e737667
|
|
|
|
:width: 200px
|
|
|
|
:alt: heroku_deploy_button
|
|
|
|
:class: no-shadow
|
|
|
|
:target: https://heroku.com/deploy?template=https://github.com/hasura/graphql-engine-heroku
|
|
|
|
|
|
|
|
Follow the Heroku instructions to deploy, check if the Hasura console loads up when you **View app** and then head
|
|
|
|
to the **Manage App** screen on your Heroku dashboard.
|
|
|
|
|
2019-01-29 12:27:15 +03:00
|
|
|
This will deploy Hasura with a free Postgres add-on automatically provisioned.
|
|
|
|
|
|
|
|
Step 2: Remove the created Postgres add-on in the app
|
2018-09-11 14:11:24 +03:00
|
|
|
-----------------------------------------------------
|
|
|
|
|
2019-01-29 12:27:15 +03:00
|
|
|
Head to your Heroku dashboard and delete the Postgres add-on created in the previous step:
|
2018-09-11 14:11:24 +03:00
|
|
|
|
|
|
|
.. image:: ../../../../img/graphql/manual/deployment/remove-heroku-postgres-addon.png
|
|
|
|
|
2019-01-29 12:27:15 +03:00
|
|
|
Step 3: Configure environment variables
|
2018-12-03 15:12:24 +03:00
|
|
|
---------------------------------------
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-02-14 12:37:47 +03:00
|
|
|
Now configure the ``DATABASE_URL`` with your existing Heroku Postgres database URL and a ``HASURA_GRAPHQL_ADMIN_SECRET``
|
2018-09-25 19:59:47 +03:00
|
|
|
if you want to secure your endpoint.
|
2018-09-11 14:11:24 +03:00
|
|
|
|
|
|
|
.. image:: ../../../../img/graphql/manual/deployment/heroku-database-url-access.png
|
|
|
|
|
2019-01-29 12:27:15 +03:00
|
|
|
.. note::
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-01-29 12:27:15 +03:00
|
|
|
Hasura GraphQL engine needs access permissions to your Postgres database as described in
|
|
|
|
:doc:`Postgres permissions <../postgres-permissions>`
|
|
|
|
|
|
|
|
Step 4: Track tables and relationships
|
|
|
|
--------------------------------------
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-01-29 12:27:15 +03:00
|
|
|
Wait for the GraphQL engine to restart and then see :doc:`../../schema/using-existing-database` to enable GraphQL
|
|
|
|
over the database.
|