Skip to content

Instantly share code, notes, and snippets.

@dsandip
Last active February 2, 2023 02:36
Show Gist options
  • Save dsandip/29643498be200b0042414a14d0cd6ae6 to your computer and use it in GitHub Desktop.
Save dsandip/29643498be200b0042414a14d0cd6ae6 to your computer and use it in GitHub Desktop.

Step 1: Create a Hasura Account

Head to https://cloud.hasura.io and sign-up for an account if you don't already have one. This account will be used to administer all the Hasura instances that you own. If you already have a Hasura Cloud, please ensure that you can see the New Self-Hosted Project option in the Cloud dashboard:

self-hosted-project-option

If you don't see this option, please contact Hasura support to enable it for your Cloud account.

Step 2: Register a self-hosted project

Click on the aforementioned option to register your self-hosted Hasura instance as a project in Hasura Cloud and filling in the following details:

  • Name: a name for the project, for example Local-HGE
  • Endpoint: the URL for the Hasura instance (without /v1/graphql), for example http://localhost:8080

self-hosted-project-details

Note: This information can be updated later.

Click the Create Project button and copy the Pro Key (it will only be shown once):

pro-key-details

This key allows communication between your Hasura instance and Hasura Cloud's backend. You can always create a new key if required but the previous key will no longer be valid.

Step 3: Run Hasura GraphQL engine with the Pro Key

To unlock Hasura Enterprise capabilities, you'll need to run the regular Hasura GraphQL engine image with the following environment variables:

  • HASURA_GRAPHQL_ADMIN_SECRET: you may have already done this, but if not, please add an admin secret to secure your instance.
  • HASURA_GRAPHQL_PRO_KEY: Use the Pro key from the previous step as the value for this environment variable.

Sample Hasura image Docker config:

graphql-engine:
  image: hasuraci/graphql-engine-pro:v2.0.1-pro.1
  environment:
    HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres
    HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
    HASURA_GRAPHQL_PRO_KEY : eyJwcm9qZWN0X2lkIjoiOTYyMThhOTYtZjQyYi00YzUyLThkMjUtZWIzN2NjMzFmMDY3IiwiY29uc29sZV9pZCI6Ijk2MjE4YTk2LWY0MmItNGM1Mi04ZDI1LWViMzdjYzMxZjA2N19jb25zb2xlIiwic2VydmVyX2lkIjoiOTYyMThhOTYtZjQyYi00YzUyLThkMjUtZWIzN2NjMzFmMDY3X3NlcnZlciIsInNlcnZlcl9zZWNyZXQiOiJ2QzZLOFVXUWJKUG90Zm9FZHpYbUljcUJWSUNDYXVWMkhKOWNBbXpBWU1ITk9JVkpZM2luMjV0OFRhZzdFODBUIn0=
  ...

Step 4: Login to the Console

Your console should now feature a new Login option in addition to the previous admin secret.

You may need to sign out of an existing session via the "Sign out" option in the Settings page

Please use Chrome

  1. Admin secret: you can still provide the admin secret and login with full admin permissions
  2. Login with Hasura: you can log in to this console with your new Hasura account (OAuth2.0 login flow). This option redirects you to the Hasura Accounts page and prompts for login and consent if required.

Step 5: Explore the new Hasura Enterprise features:

All the features documented here and SSO capabilities via Hasura Cloud are now available to you to configure.

@dsandip
Copy link
Author

dsandip commented Feb 2, 2023

Comment to host images Pro key generated self-hosted project details Hasura cloud self-hosted project option Hasura cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment