mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
docs: feature index restructure
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7715 Co-authored-by: Sean Park-Ross <94021366+seanparkross@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> GitOrigin-RevId: 61a91af22333ef08db1ec623941ac9dd5dc50179
This commit is contained in:
parent
95f5553af6
commit
96646005f7
@ -1,6 +1,6 @@
|
||||
---
|
||||
sidebar_label: Create Actions
|
||||
sidebar_position: 1
|
||||
sidebar_position: 3
|
||||
description: Create Hasura Actions
|
||||
keywords:
|
||||
- hasura
|
||||
|
@ -1,163 +0,0 @@
|
||||
---
|
||||
description: Hasura Actions
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- actions
|
||||
slug: index
|
||||
title: Actions
|
||||
---
|
||||
|
||||
import Thumbnail from '@site/src/components/Thumbnail';
|
||||
import Actions from '@site/static/icons/features/actions.svg';
|
||||
|
||||
# <Actions /> Actions
|
||||
|
||||
## What are Hasura Actions?
|
||||
|
||||
Actions are a way to extend Hasura's schema with custom business logic using custom queries and mutations. Actions can
|
||||
be added to Hasura to handle various use cases such as data validation, data enrichment from external sources and any
|
||||
other complex business logic.
|
||||
|
||||
<Thumbnail src="/img/actions/actions-arch.png" alt="Actions high level architecture" className="no-shadow" />
|
||||
|
||||
:::tip Supported from
|
||||
|
||||
Actions are supported in Hasura GraphQL Engine versions `v1.2.0` and above.
|
||||
|
||||
Actions are supported for **Postgres versions 10 and above**.
|
||||
|
||||
:::
|
||||
|
||||
## Action description
|
||||
|
||||
An action consists of the following parts:
|
||||
|
||||
1. `Type`: The type of the action (`query` or `mutation`)
|
||||
2. `Definition`: The definition of the query or mutation
|
||||
3. `Handler`: The logic to be run when the query or mutation is executed
|
||||
4. `Kind`: Sync or async. In case of a query action, there is no `Kind` associated with it. A query action is always
|
||||
sync
|
||||
|
||||
### Type
|
||||
|
||||
Actions can be of two types:
|
||||
|
||||
- **Query action**: An action of type `query` extends the query root of the Hasura schema. This means that you can
|
||||
execute this action through a GraphQL query. Query Actions must be used where you want to fetch data from a data
|
||||
source without changing anything on the data source.
|
||||
- **Mutation action**: An action of type `mutation` extends the mutation root of the Hasura schema. This means that you
|
||||
can execute this action through a GraphQL mutation. Mutation Actions must be used when you want to mutate the state of
|
||||
a data source and fetch some data.
|
||||
|
||||
### Definition
|
||||
|
||||
The action definition consists of the following:
|
||||
|
||||
- `Action Name`: The action will be available as a query or mutation in the GraphQL schema named as the action name
|
||||
- `Arguments`: Arguments are used to pass dynamic values along with the query/mutation.
|
||||
- `Response type`: The GraphQL type of the response that the query or mutation will return. Action response types
|
||||
support objects, scalars and lists of those only.
|
||||
|
||||
For instance, consider this action definition:
|
||||
|
||||
```graphql
|
||||
type Mutation {
|
||||
userLogin(username: String!, password: String!): UserInfo
|
||||
}
|
||||
```
|
||||
|
||||
In case the action response is a scalar (eg. Int), the action can also be defined as:
|
||||
|
||||
```graphql
|
||||
type Mutation {
|
||||
userLogin(username: String!, password: String!): Int!
|
||||
}
|
||||
```
|
||||
|
||||
In this definition, we are extending the mutation root with an action called `userLogin`.
|
||||
|
||||
- `userLogin` is the action name
|
||||
- `username` and `password` are the arguments that accept non-nullable string values.
|
||||
- `UserInfo` is the response type of the action
|
||||
|
||||
**Custom Types**
|
||||
|
||||
In case the action returns an object type, you will have to define your custom types like so:
|
||||
|
||||
```graphql
|
||||
type UserInfo {
|
||||
accessToken: String!
|
||||
userId: Int!
|
||||
}
|
||||
```
|
||||
|
||||
Read more about [custom types](/actions/types.mdx).
|
||||
|
||||
### Handler
|
||||
|
||||
Once you define the action types, you also have to specify the logic to run when the action is executed. This can be
|
||||
done in an HTTP webhook, also called the action handler. It could be a REST endpoint or a serverless function.
|
||||
|
||||
Learn more about [writing an action handler](/actions/action-handlers.mdx).
|
||||
|
||||
### Kind
|
||||
|
||||
**Mutation Actions** are of two kinds:
|
||||
|
||||
- **Synchronous**: Sync Actions return a response to the client after receiving a response from the handler.
|
||||
- **Asynchronous**: [Async Actions](/actions/async-actions.mdx) return an `action id` as response to the client before
|
||||
receiving a response from the handler and allow the client to subscribe to the actual response using the `action id`.
|
||||
|
||||
**Query Actions** don't have a kind, they always behave like sync mutation Actions.
|
||||
|
||||
## How it works?
|
||||
|
||||
- Hasura receives the action GraphQL query or mutation and converts this request into an event payload.
|
||||
- The event is captured, persisted and then delivered to the action handler with the appropriate retry/delivery
|
||||
guarantees.
|
||||
- The Action handler runs and returns a response that is captured as an event and again persisted to the event store.
|
||||
- The Action response is returned to the client synchronously or asynchronously based on the kind.
|
||||
|
||||
## Actions vs. Remote Schemas
|
||||
|
||||
Both Actions and Remote Schemas can be used to extend Hasura with business logic. However, they have slightly different
|
||||
use cases.
|
||||
|
||||
**Actions**
|
||||
|
||||
Actions can be used when we want to call a REST endpoint from Hasura as a resolver for some custom types. They are
|
||||
especially useful for setting up serverless functions as resolvers.
|
||||
|
||||
**Remote Schemas**
|
||||
|
||||
If you have an existing GraphQL API or if you're comfortable building a GraphQL server yourself, you can use
|
||||
[Remote Schemas](/remote-schemas/index.mdx) to add custom types and resolvers.
|
||||
|
||||
## Learn more
|
||||
|
||||
- [Creating Actions](/actions/create.mdx)
|
||||
- [Custom types](/actions/types.mdx)
|
||||
- [Action handlers](/actions/action-handlers.mdx)
|
||||
- [Async Actions](/actions/async-actions.mdx)
|
||||
- [Codegen](/actions/codegen/index.mdx)
|
||||
- [Deriving Actions](/actions/derive.mdx)
|
||||
- [Actions permissions](/actions/action-permissions.mdx)
|
||||
- [Actions relationships](/actions/action-relationships.mdx)
|
||||
- [REST Connectors for Actions](/actions/rest-connectors.mdx)
|
||||
- [Debugging Actions](/actions/debugging.mdx)
|
||||
- [Cleaning up async Action logs](/actions/logs-clean-up.mdx)
|
||||
|
||||
<!--
|
||||
|
||||
action-examples
|
||||
|
||||
-->
|
||||
|
||||
:::info Additional Resources
|
||||
|
||||
- Introduction to Hasura Actions -
|
||||
[View Recording](https://hasura.io/events/webinar/hasura-actions/?pg=docs&plcmt=body&cta=view-recording&tech=)
|
||||
- Custom Business Logic - [Learn Tutorial](https://hasura.io/learn/graphql/hasura/custom-business-logic/)
|
||||
|
||||
:::
|
80
docs/docs/actions/overview.mdx
Normal file
80
docs/docs/actions/overview.mdx
Normal file
@ -0,0 +1,80 @@
|
||||
---
|
||||
description: Hasura Actions
|
||||
title: Overview
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- actions
|
||||
hide_table_of_contents: true
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
import Thumbnail from '@site/src/components/Thumbnail';
|
||||
import VersionedLink from '@site/src/components/VersionedLink';
|
||||
import Actions from '@site/static/icons/features/actions.svg';
|
||||
|
||||
# <Actions /> Actions
|
||||
|
||||
<div className="overview-header">
|
||||
<div className="overview-text">
|
||||
<p>
|
||||
Actions are a convenient and secure way to connect to REST APIs to achieve any business logic you may need,
|
||||
directly from your GraphQL API.
|
||||
</p>
|
||||
<p>
|
||||
Maybe you need to validate, process or enrich some data, call another API, or log a user in. With Actions you can
|
||||
connect to a REST endpoint which can be your own custom server, a public API, or a serverless function.
|
||||
</p>
|
||||
<p>
|
||||
You can also apply transforms to your payloads and responses and handle the response to your GraphQL client
|
||||
asynchronously, subscribing to results as they occur.
|
||||
</p>
|
||||
<h4>Quick Links</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<VersionedLink to="/actions/quickstart/">Get started with Actions in 60 seconds.</VersionedLink>
|
||||
</li>
|
||||
<li>
|
||||
<VersionedLink to="/actions/create/">Learn how Actions work.</VersionedLink>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<iframe
|
||||
src="https://www.youtube.com/embed/Fqb6Ar3t_C4"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Thumbnail
|
||||
src="/img/actions/actions-arch.png"
|
||||
alt="Actions high level architecture"
|
||||
className="no-shadow overview-img"
|
||||
/>
|
||||
|
||||
## Using Actions
|
||||
|
||||
<div className="overview-gallery">
|
||||
<VersionedLink to="/actions/rest-connectors/">
|
||||
<div className="card">
|
||||
<h3>REST Connectors</h3>
|
||||
<p>Integrate existing REST APIs into your GraphQL schema with Actions by applying context and transforms.</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/actions/open-api/">
|
||||
<div className="card">
|
||||
<h3>Import OpenAPI to Actions</h3>
|
||||
<p>
|
||||
Upload an API written in the OpenAPI spec, select the operation you want as a Hasura Action and it will be
|
||||
imported for you.
|
||||
</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/actions/async-actions/">
|
||||
<div className="card">
|
||||
<h3>Async Actions</h3>
|
||||
<p>Subscribe to the result of a long-running action in order to be updated as results are processed.</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
</div>
|
207
docs/docs/actions/quickstart.mdx
Normal file
207
docs/docs/actions/quickstart.mdx
Normal file
@ -0,0 +1,207 @@
|
||||
---
|
||||
description: Quickstart Actions
|
||||
title: Quickstart Actions
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- actions
|
||||
- quickstart
|
||||
- guide
|
||||
- tutorial
|
||||
sidebar_label: Quickstart
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
import Thumbnail from '@site/src/components/Thumbnail';
|
||||
import GraphiQLIDE from '@site/src/components/GraphiQLIDE';
|
||||
import SampleAppBlock from '@site/src/components/SampleAppBlock';
|
||||
|
||||
# Quickstart Actions
|
||||
|
||||
Actions extend your GraphQL schema, allowing it to include traditional REST endpoints. This quickstart will show you how
|
||||
to implement an Action using the Console of your Hasura project. This Action, using a REST API, will convert a
|
||||
currency value that we'll query directly from our GraphQL API.
|
||||
|
||||
**All you need to do is to follow the steps listed below, but if you're more curious about what's happening, check out
|
||||
the [recap at the bottom of the page](#recap).**
|
||||
|
||||
<SampleAppBlock />
|
||||
|
||||
## Step 1: Open the Actions page
|
||||
|
||||
From the Console of a Hasura Project, open the `Actions` page and click `Create`:
|
||||
|
||||
<Thumbnail
|
||||
src="/img/actions/actions-quickstart_step-1_console_2-17-0.png"
|
||||
alt="Click create for new Action"
|
||||
className="no-shadow"
|
||||
/>
|
||||
|
||||
## Step 2: Describe the Action {#step-2}
|
||||
|
||||
Copy and paste the following string in the `Comment / Description` field at the top of the page:
|
||||
|
||||
```text
|
||||
Convert currency with real-time exchange rates.
|
||||
```
|
||||
|
||||
<Thumbnail
|
||||
src="/img/actions/actions-quickstart_step-2_console_2-17-0.png"
|
||||
alt="Add a description for your Action"
|
||||
className="no-shadow"
|
||||
/>
|
||||
|
||||
## Step 3: Define the Action {#step-3}
|
||||
|
||||
Copy and paste the block below into the `Action Definition` field. It will take the place of all placeholder text:
|
||||
|
||||
```graphql
|
||||
type Query {
|
||||
currencyConverter(CurrencyInfo: InputParams!): ConvertedCurrency
|
||||
}
|
||||
```
|
||||
|
||||
<Thumbnail
|
||||
src="/img/actions/actions-quickstart_step-3_console_2-17-0.png"
|
||||
alt="Define your Action"
|
||||
className="no-shadow"
|
||||
/>
|
||||
|
||||
## Step 4: Configure your types {#step-4}
|
||||
|
||||
Copy and paste the block below into the `Type Configuration` field. It will take the place of all placeholder text:
|
||||
|
||||
```graphql
|
||||
input InputParams {
|
||||
from: String
|
||||
to: String
|
||||
amt: Int
|
||||
}
|
||||
|
||||
type Info {
|
||||
rate: Float
|
||||
}
|
||||
|
||||
type Query {
|
||||
amount: Int
|
||||
from: String
|
||||
to: String
|
||||
}
|
||||
|
||||
type ConvertedCurrency {
|
||||
date: String
|
||||
info: Info
|
||||
query: Query
|
||||
result: Float
|
||||
success: Boolean
|
||||
}
|
||||
```
|
||||
|
||||
<Thumbnail
|
||||
src="/img/actions/actions-quickstart_step-4_console_2-17-0.png"
|
||||
alt="Click create for new Action"
|
||||
className="no-shadow"
|
||||
/>
|
||||
|
||||
## Step 5: Add the REST endpoint {#step-5}
|
||||
|
||||
In the `Webhook Handler` field, copy and paste the following:
|
||||
|
||||
```text
|
||||
https://api.exchangerate.host/convert
|
||||
```
|
||||
|
||||
<Thumbnail
|
||||
src="/img/actions/actions-quickstart_step-5_console_2-17-0.png"
|
||||
alt="Click create for new Action"
|
||||
className="no-shadow"
|
||||
/>
|
||||
|
||||
## Step 6: Change the request options and add query params {#step-6}
|
||||
|
||||
Click `Add Request Options Transform` and change the `Request Method` to `GET`:
|
||||
|
||||
<Thumbnail
|
||||
src="/img/actions/actions-quickstart_step-6_console_2-17-0.png"
|
||||
alt="Click create for new Action"
|
||||
className="no-shadow"
|
||||
/>
|
||||
|
||||
Add the following query parameters and values as separate pairs in the available fields:
|
||||
|
||||
| Query Param | Value |
|
||||
| ----------- | ----------------------------------- |
|
||||
| from | `{{$body.input.CurrencyInfo.from}}` |
|
||||
| to | `{{$body.input.CurrencyInfo.to}}` |
|
||||
| amount | `{{$body.input.CurrencyInfo.amt}}` |
|
||||
|
||||
Scroll to the bottom of the page, click `Create Action`, then head to your API page.
|
||||
|
||||
## Step 7: Run a query
|
||||
|
||||
Copy and paste the query on the left into your GraphiQL explorer and execute the query by clicking the `Play` button.
|
||||
The response should look similar to what's on the right (depending on rates):
|
||||
|
||||
<GraphiQLIDE
|
||||
query={`query CurrencyQuery {
|
||||
currencyConverter(CurrencyInfo: { amt: 1, from: "EUR", to: "USD" }) {
|
||||
result
|
||||
}
|
||||
}
|
||||
`}
|
||||
response={`{
|
||||
"data": {
|
||||
"currencyConverter": {
|
||||
"result": 1.088456
|
||||
}
|
||||
}
|
||||
}
|
||||
`}
|
||||
/>
|
||||
|
||||
## Recap
|
||||
|
||||
What just happened? Congrats! You just extended your GraphQL API with a REST endpoint 🎉
|
||||
|
||||
Actions can do a lot of things, but chances are - wherever you are in your GraphQL journey - you still have some legacy
|
||||
REST APIs that you need to integrate with. Whether you built them yourself or you're trying to integrate with public
|
||||
APIs, Actions are a great way to do that.
|
||||
|
||||
We started by [describing our Action](#step-2). This may seem like an excessive step, but - since our GraphQL API is
|
||||
self-documenting - it's a good idea to add a description to your Action so that your consumers know what it does. The
|
||||
value we entered is available as a tooltip in the GraphiQL explorer and in the API's documentation.
|
||||
|
||||
From there, we [defined our Action](#step-3). This is where we tell Hasura what our Action will do. In this case, we're
|
||||
defining a `Query` that will return a `ConvertedCurrency` type. This is the type that we'll be returning from our REST
|
||||
API. We haven't actually defined these types yet; we're just telling Hasura that when running this query, with these
|
||||
inputs, we'll be returning a `ConvertedCurrency` type.
|
||||
|
||||
Next, we [configured our types](#step-4). This is where we tell Hasura what our `ConvertedCurrency` type looks like. We
|
||||
defined the types of our inputs and output. In the case of our inputs, we're defining an `InputParams` type that will be
|
||||
used as the input to our Action (i.e., a user will have to pass in an `InputParams` object that contains `from`, `to`,
|
||||
and `amt` when executing our Query).
|
||||
|
||||
We're also defining the types of our outputs. In this case, we're defining a `ConvertedCurrency` type that will be
|
||||
returned from our REST API. It can be laborious to define these types, but Hasura can take care of that for you. The
|
||||
Console's Type Generator is a great way to do that: simply paste in some sample JSON output from your endpoint and
|
||||
Hasura will generate the types for you.
|
||||
|
||||
<Thumbnail
|
||||
src="/img/actions/actions-quickstart_type-generator_console_2-17-0.png"
|
||||
alt="Generate types from a REST API"
|
||||
className="no-shadow"
|
||||
/>
|
||||
|
||||
Finally, we [added the REST endpoint](#step-5) and [configured the request options](#step-6). This is where we tell
|
||||
Hasura where to send our request and what to send. In this case, we're sending a `GET` request to the
|
||||
`https://api.exchangerate.host/convert` endpoint. We're also passing in the `from`, `to`, and `amount` query parameters
|
||||
that our REST API expects.
|
||||
|
||||
Hasura automatically amends the base url of the REST endpoint with these query parameters and their values from the
|
||||
query to produce a request that looks like this:
|
||||
|
||||
```text
|
||||
https://api.exchangerate.host/convert?from=EUR&to=USD&amount=1
|
||||
```
|
||||
|
||||
To learn about creating your own Actions, check out the [Create Actions page](/actions/create.mdx).
|
@ -7,7 +7,7 @@ keywords:
|
||||
- API
|
||||
- API reference
|
||||
sidebar_position: 14
|
||||
sidebar_label: Hasura Cloud API reference
|
||||
sidebar_label: Hasura Cloud API reference ☁️
|
||||
sidebar_class_name: cloud-icon
|
||||
---
|
||||
|
||||
|
@ -1,17 +1,16 @@
|
||||
---
|
||||
description: Hasura API reference
|
||||
description: Hasura API reference general info
|
||||
title: API Reference
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- API
|
||||
- API reference
|
||||
slug: index
|
||||
sidebar_position: 2
|
||||
sidebar_label: General Info
|
||||
---
|
||||
|
||||
import APIReference from '@site/static/icons/features/api_reference.svg';
|
||||
|
||||
# <APIReference /> API Reference
|
||||
# API Reference | General Info
|
||||
|
||||
## Available APIs
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"label": "GraphQL API",
|
||||
"position": 1
|
||||
"position": 2
|
||||
}
|
@ -44,7 +44,7 @@ At present, Kriti templating is available for:
|
||||
- [Action REST Connectors](/actions/rest-connectors.mdx)
|
||||
- [Event Triggers REST Connectors](/event-triggers/rest-connectors.mdx)
|
||||
- [Cron Triggers REST Connectors](/scheduled-triggers/create-cron-trigger.mdx#rest-connectors)
|
||||
- [Dynamic Database Connection Routing](databases/connect-db/dynamic-db-connection.mdx#connection-template)
|
||||
- [Dynamic Database Connection Routing](databases/database-config/dynamic-db-connection.mdx#connection-template)
|
||||
|
||||
### Example
|
||||
|
||||
|
78
docs/docs/api-reference/overview.mdx
Normal file
78
docs/docs/api-reference/overview.mdx
Normal file
@ -0,0 +1,78 @@
|
||||
---
|
||||
description: Hasura API reference
|
||||
title: API Reference
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- API
|
||||
- API reference
|
||||
hide_table_of_contents: true
|
||||
sidebar_position: 1
|
||||
sidebar_label: Overview
|
||||
---
|
||||
|
||||
import Thumbnail from '@site/src/components/Thumbnail';
|
||||
import VersionedLink from '@site/src/components/VersionedLink';
|
||||
import APIReference from '@site/static/icons/features/api_reference.svg';
|
||||
|
||||
# <APIReference /> API Reference
|
||||
|
||||
<div className="overview-header">
|
||||
<div className="overview-text">
|
||||
<p>
|
||||
The Hasura API reference is a comprehensive guide to the Hasura GraphQL Engine API. It is a great place to start
|
||||
if you are building a client application that interacts with the Hasura GraphQL Engine API.
|
||||
</p>
|
||||
<p>
|
||||
The API reference is divided into sections based on the type of API. Each section contains a list of API endpoints
|
||||
and a description of the API endpoint.
|
||||
</p>
|
||||
<h4>Quick Links</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<VersionedLink to="/api-reference/graphql-api/index/">Get started with the GraphQL API.</VersionedLink>
|
||||
</li>
|
||||
<li>
|
||||
<VersionedLink to="/api-reference/general-info/">Learn more about the available APIs.</VersionedLink>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<iframe
|
||||
src="https://www.youtube.com/embed/3RSprDf-Ckc"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen
|
||||
/>
|
||||
</div>
|
||||
|
||||
## Using the APIs
|
||||
|
||||
<div className="overview-gallery">
|
||||
<VersionedLink to="/api-reference/graphql-api/query/">
|
||||
<div className="card">
|
||||
<h3>Query / Subscription API</h3>
|
||||
<p>
|
||||
Learn more about using the Query API to fetch data from the database and the Subscription API to subscribe to
|
||||
database events.
|
||||
</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/api-reference/restified/">
|
||||
<div className="card">
|
||||
<h3>RESTified GraphQL Endpoints</h3>
|
||||
<p>
|
||||
See how you can use the RESTified GraphQL Endpoints API to fetch data from the database and to subscribe to
|
||||
database events.
|
||||
</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/api-reference/syntax-defs/">
|
||||
<div className="card">
|
||||
<h3>Common Syntax Definitions</h3>
|
||||
<p>
|
||||
Check out our common syntax definitions for the GraphQL API, RESTified GraphQL Endpoints API, and the Metadata
|
||||
API.
|
||||
</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
</div>
|
@ -8,7 +8,7 @@ keywords:
|
||||
- source health API
|
||||
- API reference
|
||||
sidebar_position: 14
|
||||
sidebar_label: Source Health Check API
|
||||
sidebar_label: Source Health Check API ☁️
|
||||
sidebar_class_name: cloud-icon
|
||||
---
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"label": "Authentication",
|
||||
"position": 2
|
||||
"position": 4
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"label": "Authorization",
|
||||
"position": 3
|
||||
"position": 6
|
||||
}
|
@ -1,14 +1,13 @@
|
||||
---
|
||||
description: Manage GraphQL Authentication and Authorization with Hasura
|
||||
description: How GraphQL Authentication and Authorization works with Hasura
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- authentication
|
||||
- auth
|
||||
- authorization
|
||||
slug: index
|
||||
title: Authentication and Authorization
|
||||
sidebar_position: 1
|
||||
title: How it works
|
||||
sidebar_position: 3
|
||||
---
|
||||
|
||||
import Thumbnail from '@site/src/components/Thumbnail';
|
87
docs/docs/auth/overview.mdx
Normal file
87
docs/docs/auth/overview.mdx
Normal file
@ -0,0 +1,87 @@
|
||||
---
|
||||
description: Hasura Authentication and Authorization
|
||||
title: Overview
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- actions
|
||||
hide_table_of_contents: true
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
import Thumbnail from '@site/src/components/Thumbnail';
|
||||
import VersionedLink from '@site/src/components/VersionedLink';
|
||||
import Auth from '@site/static/icons/features/auth.svg';
|
||||
|
||||
# <Auth /> Authentication and Authorization
|
||||
|
||||
<div className="overview-header">
|
||||
<div className="overview-text">
|
||||
<p>
|
||||
Hasura gives you the power to authenticate users how you want, integrating with many popular auth services or your
|
||||
own existing custom solution hosted elsewhere.
|
||||
<br />
|
||||
<br />
|
||||
With Hasura, you can easily manage access to your data and APIs by defining roles and permissions. Hasura's fine-grained
|
||||
access control system allows you to specify which users can access which data, Actions, and Remote Schema fields, ensuring
|
||||
that your application is secure and robust.
|
||||
<br />
|
||||
<br />
|
||||
Say goodbye to the headache of managing authentication and authorization and focus on building your application
|
||||
with Hasura.
|
||||
</p>
|
||||
<h4>Quick Links</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<VersionedLink to="/auth/quickstart/">Get started with Auth in 60 seconds.</VersionedLink>
|
||||
</li>
|
||||
<li>
|
||||
<VersionedLink to="/auth/how-it-works/">Learn how Auth works.</VersionedLink>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<iframe
|
||||
src="https://www.youtube.com/embed/OL_eWdwQU2I"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Thumbnail
|
||||
src="/img/auth/auth-high-level-overview-diagram.png"
|
||||
alt="Authentication and authorization with Hasura"
|
||||
className="no-shadow overview-img"
|
||||
/>
|
||||
|
||||
## Using Auth
|
||||
|
||||
<div className="overview-gallery">
|
||||
<VersionedLink to="/auth/authentication/jwt/">
|
||||
<div className="card">
|
||||
<h3>JWT Mode</h3>
|
||||
<p>
|
||||
With JWT Mode, Hasura can easily integrate with your existing authentication service and rapidly help you
|
||||
configure granular access to your data.
|
||||
</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/auth/authorization/permissions/">
|
||||
<div className="card">
|
||||
<h3>Configuring Permissions</h3>
|
||||
<p>
|
||||
Regardless of the authentication mode you choose, Hasura provides a flexible permission system to control who
|
||||
can access your data.
|
||||
</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/auth/authorization/roles-variables/">
|
||||
<div className="card">
|
||||
<h3>Roles and Session Variables</h3>
|
||||
<p>
|
||||
Using defined roles based on your custom configuration, you can enable permissions for your tables and views
|
||||
based on the role of the user.
|
||||
</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
</div>
|
259
docs/docs/auth/quickstart.mdx
Normal file
259
docs/docs/auth/quickstart.mdx
Normal file
@ -0,0 +1,259 @@
|
||||
---
|
||||
description: Quickstart Auth
|
||||
title: Quickstart Auth
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- actions
|
||||
- quickstart
|
||||
- guide
|
||||
- tutorial
|
||||
sidebar_label: Quickstart
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import Thumbnail from '@site/src/components/Thumbnail';
|
||||
import GraphiQLIDE from '@site/src/components/GraphiQLIDE';
|
||||
import SampleAppBlock from '@site/src/components/SampleAppBlock';
|
||||
|
||||
# Quickstart Auth
|
||||
|
||||
In this quickstart, we'll use a JWT and permissions to limit a query to only the user making the request. We're using
|
||||
our sample app, which you can read more about below. If you don't use the sample app, you'll need to ensure your data
|
||||
model includes a `users` table and modify the values of the encoded and decoded JWT to match your user's information.
|
||||
|
||||
<SampleAppBlock />
|
||||
|
||||
## Step 1: Add an environment variable
|
||||
|
||||
Depending on how your instance is deployed, you can either use the GUI or your configuration files to set this secret.
|
||||
|
||||
<Tabs groupId="user-preference">
|
||||
<TabItem value="cloud" label="Cloud">
|
||||
|
||||
Head to your Project's settings page and click on the Env vars option in the side navigation:
|
||||
|
||||
<Thumbnail
|
||||
src="/img/auth/quickstart/auth-jwt_getting-started-guide_2.18.0_env.png"
|
||||
alt="Authentication and authorization with Hasura"
|
||||
className="no-shadow overview-img"
|
||||
/>
|
||||
|
||||
Once there, click on New Env Var and select `HASURA_GRAPHQL_JWT_SECRET` from the `Key` field. Paste this value into the
|
||||
environment variable's value field:
|
||||
|
||||
```json
|
||||
{
|
||||
"key": "oursupersecretsupersecurekey1234567890",
|
||||
"type": "HS256"
|
||||
}
|
||||
```
|
||||
|
||||
Click `Add`:
|
||||
|
||||
<Thumbnail
|
||||
src="/img/auth/quickstart/auth-jwt_getting-started-guide_2.18.0_env-add.png"
|
||||
alt="Authentication and authorization with Hasura"
|
||||
className="no-shadow overview-img"
|
||||
/>
|
||||
</TabItem>
|
||||
<TabItem value="self-hosted" label="Self-hosted">
|
||||
|
||||
In your `docker-compose.yml`, add the following environment variable and value:
|
||||
|
||||
```yaml
|
||||
HASURA_GRAPHQL_JWT_SECRET: '{ "type": "HS256", "key": "oursupersecretsupersecurekey1234567890" }'
|
||||
```
|
||||
|
||||
If you don't already have a `users` table, add one with the following SQL using the `Data` tab's SQL editor:
|
||||
|
||||
```sql
|
||||
CREATE TABLE users (
|
||||
id uuid NOT NULL,
|
||||
name text NOT NULL,
|
||||
email text NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
```
|
||||
|
||||
Then, insert these users:
|
||||
|
||||
```sql
|
||||
INSERT INTO public.users (id, name, email) VALUES ('7cf0a66c-65b7-11ed-b904-fb49f034fbbb', 'Sean', 'seandemo@hasura.io');
|
||||
INSERT INTO public.users (id, name, email) VALUES ('82001336-65b7-11ed-b905-7fa26a16d198', 'Rob', 'robdemo@hasura.io');
|
||||
INSERT INTO public.users (id, name, email) VALUES ('86d5fba0-65b7-11ed-b906-afb985970e2e', 'Marion', 'mariondemo@hasura.io');
|
||||
INSERT INTO public.users (id, name, email) VALUES ('8dea1160-65b7-11ed-b907-e3c5123cb650', 'Sandeep', 'sandeepdemo@hasura.io');
|
||||
INSERT INTO public.users (id, name, email) VALUES ('9bd9d300-65b7-11ed-b908-571fef22d2ba', 'Abby', 'abbydemo@hasura.io');
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Step 2: Create a user role
|
||||
|
||||
Head to the `Data` tab of the Hasura Console. If you have a `users` table, select it from the list on the left-hand
|
||||
side, and open the `Permissions` tab:
|
||||
|
||||
<Thumbnail
|
||||
src="/img/auth/quickstart/auth-jwt_getting-started-guide_2.18.0_default-roles.png"
|
||||
alt="Authentication and authorization with Hasura"
|
||||
className="no-shadow overview-img"
|
||||
/>
|
||||
|
||||
As you can see, we currently only have an admin role. To make access to data more granular, we'll create a new role by
|
||||
entering `user` into the text input. After entering the name of the role, click the ❌ in the `select` column:
|
||||
|
||||
<Thumbnail
|
||||
src="/img/auth/quickstart/auth-jwt_getting-started-guide_2.18.0_add-user-role.png"
|
||||
alt="Authentication and authorization with Hasura"
|
||||
className="no-shadow overview-img"
|
||||
/>
|
||||
|
||||
Configure the `Row select permissions` by choosing `With custom check` and pasting the following value in the editor on
|
||||
line 1:
|
||||
|
||||
```json
|
||||
{ "id": { "_eq": "X-Hasura-User-Id" } }
|
||||
```
|
||||
|
||||
Configure the `Column select permissions` by clicking `Toggle All`:
|
||||
|
||||
<Thumbnail
|
||||
src="/img/auth/quickstart/auth-jwt_getting-started-guide_2.18.0_configure-user-role.png"
|
||||
alt="Authentication and authorization with Hasura"
|
||||
className="no-shadow overview-img"
|
||||
/>
|
||||
|
||||
Finally, click `Save Permissions`.
|
||||
|
||||
## Step 3: Add a header in the GraphiQL explorer
|
||||
|
||||
Head back to the `API` tab and add a new row to the `Request Headers`. Enter this `key`:
|
||||
|
||||
```plaintext
|
||||
Authorization
|
||||
```
|
||||
|
||||
And this value:
|
||||
|
||||
```plaintext
|
||||
Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IlNlYW4iLCJlbWFpbCI6InNlYW5kZW1vQGhhc3VyYS5pbyIsImlhdCI6MTUxNjIzOTAyMiwiaHR0cHM6Ly9oYXN1cmEuaW8vand0L2NsYWltcyI6eyJ4LWhhc3VyYS1hbGxvd2VkLXJvbGVzIjpbInVzZXIiLCJhZG1pbiJdLCJ4LWhhc3VyYS1kZWZhdWx0LXJvbGUiOiJ1c2VyIiwieC1oYXN1cmEtdXNlci1pZCI6IjdjZjBhNjZjLTY1YjctMTFlZC1iOTA0LWZiNDlmMDM0ZmJiYiJ9fQ.jSp42PsCa4r-2ObfopkiDBvTn9nDysIv-NOIEnU3wR0
|
||||
```
|
||||
|
||||
Check the box next to `Authorization`; the final result should look like this:
|
||||
|
||||
<Thumbnail
|
||||
src="/img/auth/quickstart/auth-jwt_getting-started-guide_2.18.0_add-auth-header.png"
|
||||
alt="Authentication and authorization with Hasura"
|
||||
className="no-shadow overview-img"
|
||||
/>
|
||||
|
||||
## Step 4: Test it out
|
||||
|
||||
Before demonstrating the access control you just designed, run the following query:
|
||||
|
||||
```graphql
|
||||
query GetUsers {
|
||||
users {
|
||||
id
|
||||
email
|
||||
name
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You should see an array of 5 records returned:
|
||||
|
||||
```json
|
||||
{
|
||||
"data": {
|
||||
"users": [
|
||||
{
|
||||
"id": "7cf0a66c-65b7-11ed-b904-fb49f034fbbb",
|
||||
"email": "seandemo@hasura.io",
|
||||
"name": "Sean"
|
||||
},
|
||||
{
|
||||
"id": "82001336-65b7-11ed-b905-7fa26a16d198",
|
||||
"email": "robdemo@hasura.io",
|
||||
"name": "Rob"
|
||||
},
|
||||
{
|
||||
"id": "86d5fba0-65b7-11ed-b906-afb985970e2e",
|
||||
"email": "mariondemo@hasura.io",
|
||||
"name": "Marion"
|
||||
},
|
||||
{
|
||||
"id": "8dea1160-65b7-11ed-b907-e3c5123cb650",
|
||||
"email": "sandeepdemo@hasura.io",
|
||||
"name": "Sandeep"
|
||||
},
|
||||
{
|
||||
"id": "9bd9d300-65b7-11ed-b908-571fef22d2ba",
|
||||
"email": "abbydemo@hasura.io",
|
||||
"name": "Abby"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Uncheck the `x-hasura-admin-secret` request header. Re-run the query; this time, your output should be similar to this:
|
||||
|
||||
```json
|
||||
{
|
||||
"data": {
|
||||
"users": [
|
||||
{
|
||||
"id": "7cf0a66c-65b7-11ed-b904-fb49f034fbbb",
|
||||
"email": "seandemo@hasura.io",
|
||||
"name": "Sean"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
:::tip Did you see that?!
|
||||
|
||||
If you weren't watching closely, you may have missed it. When you deselected your admin secret in the request headers
|
||||
and used only the `authorization` header, the available schema changed to what you defined in step 2 🔥
|
||||
|
||||
You can see that in the screenshot below, the only field available to the user is the `users` table:
|
||||
|
||||
<Thumbnail
|
||||
src="/img/auth/quickstart/auth-jwt_getting-started-guide_2.18.0_user-schema.png"
|
||||
alt="Authentication and authorization with Hasura"
|
||||
className="no-shadow overview-img"
|
||||
/>
|
||||
|
||||
:::
|
||||
|
||||
## Recap
|
||||
|
||||
What did we just do? Well, you just implemented a JWT-based authorization system with Hasura 🎉
|
||||
|
||||
Is this production-grade? Not quite. In a real-world application, you'd need to generate and verify the
|
||||
[JWTs](/auth/authentication/jwt.mdx) on the server-side. You'd also need to implement a mechanism to refresh the JWTs.
|
||||
What we've demonstrated is how Hasura utilizes the JWT to determine the role of the user and the
|
||||
[permissions](/auth/authorization/index.mdx) that they have access to.
|
||||
|
||||
The environment variable we set up in the beginning contains a secret; this secret is used to encode your JWTs wherever
|
||||
they're generated, be it on your own server, a third-party service, or even a client-side library. Hasura is agnostic
|
||||
about how or where you generate your JWTs. Saving that secret as an environment variable allows Hasura to decode the
|
||||
JWTs and verify that they're valid.
|
||||
|
||||
If you're curious about the composition of the JWT, you can view the decoded version one of two ways. By visiting
|
||||
[this link](https://jwt.io/#debugger-io?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IlNlYW4iLCJlbWFpbCI6InNlYW5kZW1vQGhhc3VyYS5pbyIsImlhdCI6MTUxNjIzOTAyMiwiaHR0cHM6Ly9oYXN1cmEuaW8vand0L2NsYWltcyI6eyJ4LWhhc3VyYS1hbGxvd2VkLXJvbGVzIjpbInVzZXIiLCJhZG1pbiJdLCJ4LWhhc3VyYS1kZWZhdWx0LXJvbGUiOiJ1c2VyIiwieC1oYXN1cmEtdXNlci1pZCI6IjdjZjBhNjZjLTY1YjctMTFlZC1iOTA0LWZiNDlmMDM0ZmJiYiJ9fQ.FQJp6we0EFXWtmeqcM3-gAqxeNURL3Qa6AMDM6qv2NE),
|
||||
you can see the payload and other data associated with the JWT we used in this example. Alternatively, Hasura provides a
|
||||
JWT decoder tool that you can use to decode any JWT. You can utilize this by clicking the "detective" icon next to the
|
||||
`Authorization` header's value in the GraphiQL explorer.
|
||||
|
||||
The permissions we set up in step 2 are the most basic form of access control. We created a new role called `user` and
|
||||
limited the rows returned on the `users` table to only those whose `id` matches the `x-hasura-user-id` claim in the JWT.
|
||||
|
||||
As you can see from the example, Hasura automatically provides a schema that only exposes the `users` table to the
|
||||
`user` role. This is a great way to limit the exposure of your data to the outside world and ensure that your users only
|
||||
have access to the data they're authorized to see.
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
sidebar_label: Apollo Federation
|
||||
sidebar_position: 3
|
||||
sidebar_position: 4
|
||||
description: Use Hasura as a subgraph in an Apollo gateway
|
||||
keywords:
|
||||
- hasura
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
sidebar_label: Data federation types
|
||||
sidebar_position: 2
|
||||
sidebar_position: 3
|
||||
description: Join data across remote data sources
|
||||
keywords:
|
||||
- hasura
|
||||
|
@ -1,33 +0,0 @@
|
||||
---
|
||||
sidebar_label: Data Federation
|
||||
sidebar_position: 1
|
||||
description: Join data across remote data sources
|
||||
title: Data Federation
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- remote join
|
||||
- data federation
|
||||
slug: index
|
||||
---
|
||||
|
||||
import DataFederation from '@site/static/icons/features/data_federation.svg';
|
||||
|
||||
# <DataFederation /> Data Federation
|
||||
|
||||
## Introduction
|
||||
|
||||
Hasura’s data federation capabilities allow you to compose data from different sources that reside in independent data
|
||||
stores but are semantically related. This is done by creating a single GraphQL schema from multiple data sources thereby
|
||||
making the data access process self-serve, allowing you to query, mutate or federate real-time and stream data across
|
||||
services without writing any custom code.
|
||||
|
||||
The remote data sources can either be a table from a [database source](/databases/index.mdx), a GraphQL API added as a
|
||||
[Remote Schema](/remote-schemas/index.mdx), or a REST API added as an [action](/actions/index.mdx). Once you create
|
||||
relationships between types from your database tables, Remote Schemas and actions, you can then "join" data across them
|
||||
by running GraphQL queries.
|
||||
|
||||
## Explore data federation
|
||||
|
||||
- [Explore data federation types](/data-federation/data-federation-types.mdx)
|
||||
- [Using hasura in Apollo federated gateway](/data-federation/apollo-federation.mdx)
|
67
docs/docs/data-federation/overview.mdx
Normal file
67
docs/docs/data-federation/overview.mdx
Normal file
@ -0,0 +1,67 @@
|
||||
---
|
||||
description: Hasura Data Federation
|
||||
title: Overview
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- data
|
||||
- federation
|
||||
- data federation
|
||||
hide_table_of_contents: true
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
import Thumbnail from '@site/src/components/Thumbnail';
|
||||
import VersionedLink from '@site/src/components/VersionedLink';
|
||||
import DataFederation from '@site/static/icons/features/data_federation.svg';
|
||||
|
||||
# <DataFederation /> Data Federation
|
||||
|
||||
<div className="overview-header">
|
||||
<div className="overview-text">
|
||||
<p>
|
||||
Hasura's data federation capabilities allow you to compose data from different sources that reside in independent
|
||||
data stores but are semantically related.
|
||||
</p>
|
||||
<p>
|
||||
Hasura creates a single GraphQL schema from multiple data sources thereby making the data access process
|
||||
self-serve, allowing you to query, mutate or federate real-time and stream data across services without writing
|
||||
any custom code.
|
||||
</p>
|
||||
<h4>Quick Links</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<VersionedLink to="/data-federation/data-federation-types/">Learn about data federation types.</VersionedLink>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<iframe
|
||||
src="https://www.youtube.com/embed/bdyhK3Bmy20"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen
|
||||
/>
|
||||
</div>
|
||||
|
||||
## Using Data Federation
|
||||
|
||||
<div className="overview-gallery">
|
||||
<VersionedLink to="/schema/postgres/remote-relationships/remote-source-relationships/">
|
||||
<div className="card">
|
||||
<h3>Create a Database-to-Remote-Database Relationship</h3>
|
||||
<p>Learn how to create a database-to-database relationship using remote relationships.</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/schema/postgres/remote-relationships/remote-schema-relationships/">
|
||||
<div className="card">
|
||||
<h3>Create a Database-to-Remote-Schema Relationship</h3>
|
||||
<p>Learn how to create a database-to-remote-schema relationship using remote relationships.</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/data-federation/apollo-federation">
|
||||
<div className="card">
|
||||
<h3>Apollo Federation</h3>
|
||||
<p>Learn how to use Apollo Federation to compose data from multiple sources using Hasura.</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
</div>
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"label": "Connecting databases",
|
||||
"position": 1
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"label": "Cloud database guides",
|
||||
"position": 1
|
||||
}
|
@ -1,191 +0,0 @@
|
||||
---
|
||||
description: Use an existing database with Hasura Cloud
|
||||
title: 'Cloud: Guides for connecting Hasura Cloud with different cloud databases'
|
||||
keywords:
|
||||
- hasura
|
||||
- cloud databases
|
||||
- docs
|
||||
- existing database
|
||||
slug: index
|
||||
---
|
||||
|
||||
import HeadingIcon from '@site/src/components/HeadingIcon';
|
||||
import useBaseUrl from '@docusaurus/useBaseUrl';
|
||||
import VersionedLink from '@site/src/components/VersionedLink';
|
||||
import ArrowRight from '@site/static/icons/arrow_right.svg';
|
||||
import Aiven from '@site/static/img/cloud-dbs/logos/aiven.png';
|
||||
import Alloy from '@site/static/img/cloud-dbs/logos/alloydb.png';
|
||||
import Aurora from '@site/static/img/cloud-dbs/logos/aws-aurora.png';
|
||||
import Azure from '@site/static/img/cloud-dbs/logos/azure.png';
|
||||
import Cosmos from '@site/static/img/cloud-dbs/logos/cosmos.png';
|
||||
import RDS from '@site/static/img/cloud-dbs/logos/aws.png';
|
||||
import RollTide from '@site/static/img/cloud-dbs/logos/crunchy.png';
|
||||
import DO from '@site/static/img/cloud-dbs/logos/DO.png';
|
||||
import Elephant from '@site/static/img/cloud-dbs/logos/elephant.png';
|
||||
import Enterprise from '@site/static/img/cloud-dbs/logos/enterprisedb.png';
|
||||
import GCP from '@site/static/img/cloud-dbs/logos/gcp.png';
|
||||
import MSSQL from '@site/static/img/cloud-dbs/logos/mssql.png';
|
||||
import Neon from '@site/static/img/cloud-dbs/logos/neon.png';
|
||||
import Railway from '@site/static/img/cloud-dbs/logos/railway.png';
|
||||
import Render from '@site/static/img/cloud-dbs/logos/render.png';
|
||||
import Supabase from '@site/static/img/cloud-dbs/logos/supabase.png';
|
||||
import Timescale from '@site/static/img/cloud-dbs/logos/timescaledb.png';
|
||||
import Yugabyte from '@site/static/img/cloud-dbs/logos/yugabyte.png';
|
||||
|
||||
# Guides for Connecting Hasura with Different Cloud Databases
|
||||
|
||||
## Overview
|
||||
|
||||
Check out the following guides for tutorials on how to use Hasura with a new or existing database provided by
|
||||
specific cloud vendors.
|
||||
|
||||
<div className="vendor-table">
|
||||
<VersionedLink to="/databases/connect-db/cloud-databases/aiven">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Aiven} title="Aiven Postgres" alt="Connect Postgres DB to Hasura" />
|
||||
</div>
|
||||
<h5>Aiven</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/connect-db/cloud-databases/alloy">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Alloy} title="Google AlloyDB Postgres" alt="Connect Google AlloyDB to Hasura" />
|
||||
</div>
|
||||
<h5>AlloyDB</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/connect-db/cloud-databases/aws-aurora">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Aurora} title="AWS Aurora Postgres" alt="Connect AWS Aurora Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>AWS RDS Aurora Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/connect-db/cloud-databases/aws-postgres">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={RDS} title="AWS RDS Postgres" alt="Connect AWS RDS Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>AWS RDS Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/connect-db/cloud-databases/azure-cosmos">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Cosmos} title="Azure Cosmos DB" alt="Connect Azure Cosmos to Hasura" />
|
||||
</div>
|
||||
<h5>Azure Cosmos</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/connect-db/cloud-databases/mssql">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={MSSQL} title="MS SQL on Azure" alt="Connect MS SQL on Azure to Hasura" />
|
||||
</div>
|
||||
<h5>Azure MS SQL</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/connect-db/cloud-databases/azure">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Azure} title="Azure Postgres" alt="Connect Azure Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>Azure Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/connect-db/cloud-databases/crunchy">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={RollTide} title="Crunchy Postgres" alt="Connect Crunchy Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>Crunchy Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/connect-db/cloud-databases/digital-ocean">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={DO} title="DigitalOcean Postgres" alt="Connect DO Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>DigitalOcean Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/connect-db/cloud-databases/elephant">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Elephant} title="ElephantSQL Postgres" alt="Connect ElephantSQL Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>ElephantSQL</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/connect-db/cloud-databases/enterprisedb">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img
|
||||
src={Enterprise}
|
||||
title="EnterpriseDB BigAnimal Postgres"
|
||||
alt="Connect EnterpriseDB BigAnimal Postgres to Hasura"
|
||||
/>
|
||||
</div>
|
||||
<h5>EnterpriseDB</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/connect-db/cloud-databases/gcp">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={GCP} title="GCP Postgres" alt="Connect GCP Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>GCP Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/connect-db/cloud-databases/neon">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Neon} title="Neon Postgres" alt="Connect Neon Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>Neon Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/connect-db/cloud-databases/railway">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Railway} title="Railway Postgres" alt="Connect Railway Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>Railway Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/connect-db/cloud-databases/render">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Render} title="Render Postgres" alt="Connect Render Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>Render Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/connect-db/cloud-databases/supabase">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Supabase} title="Supabase Postgres" alt="Connect Supabase Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>Supabase Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/connect-db/cloud-databases/timescale-cloud">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Timescale} title="TimescaleDB Postgres" alt="Connect TimescaleDB Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>TimescaleDB</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/connect-db/cloud-databases/yugabyte">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Yugabyte} title="YugabyteDB Postgres" alt="Connect YugabyteDB Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>YugabyteDB</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
</div>
|
4
docs/docs/databases/database-config/_category_.json
Normal file
4
docs/docs/databases/database-config/_category_.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"label": "Database Config",
|
||||
"position": 1.5
|
||||
}
|
@ -9,7 +9,7 @@ keywords:
|
||||
- connection
|
||||
- pools
|
||||
- autoscaling
|
||||
sidebar_label: Elastic connection pools
|
||||
sidebar_label: Elastic connection pools ☁️
|
||||
sidebar_position: 2
|
||||
sidebar_class_name: cloud-icon
|
||||
---
|
@ -14,7 +14,7 @@ keywords:
|
||||
- routing
|
||||
- connections
|
||||
- pool
|
||||
sidebar_label: Dynamic DB connection routing
|
||||
sidebar_label: Dynamic DB connection routing ☁️🏢
|
||||
sidebar_position: 3
|
||||
sidebar_class_name: cloud-and-enterprise-icon
|
||||
---
|
||||
@ -400,7 +400,7 @@ differs in the Postgres schema from the primary connection.
|
||||
|
||||
### Event Triggers
|
||||
|
||||
[Hasura Event Triggers](/event-triggers/index.mdx) are triggered only for mutations executed on the primary connection.
|
||||
[Hasura Event Triggers](/event-triggers/overview.mdx) are triggered only for mutations executed on the primary connection.
|
||||
Mutations routed to the members of the connection set will not trigger Event Triggers.
|
||||
|
||||
### Migrations
|
@ -43,7 +43,7 @@ button to open the Hasura Console in your browser.
|
||||
|
||||
Hasura Cloud does not host databases, but does provide integrations with which you can connect databases from
|
||||
many 3rd party managed cloud providers. Check out a
|
||||
[list of supported databases here](/databases/index.mdx#supported-databases).
|
||||
[list of supported databases here](/databases/overview.mdx).
|
||||
|
||||
To get started quickly with a Postgres database, choose `Create New Database`:
|
||||
|
||||
@ -53,7 +53,7 @@ To get started quickly with a Postgres database, choose `Create New Database`:
|
||||
database"
|
||||
/>
|
||||
|
||||
Follow the prompts or [check out our detailed Neon connect page](/databases/connect-db/cloud-databases/neon.mdx).
|
||||
Follow the prompts or [check out our detailed Neon connect page](/databases/postgres/neon.mdx).
|
||||
Hasura Cloud will integrate with your Neon account and manage the initial setup of a Postgres instance. You can
|
||||
always upgrade the instance and manage options later through your Neon account.
|
||||
|
||||
@ -63,8 +63,7 @@ To use an existing database, choose `Connect existing database` and enter your d
|
||||
database connection string.
|
||||
|
||||
For help finding your particular connection string for your database provider check out our
|
||||
[supported databases](/databases/index.mdx#supported-databases) and
|
||||
[cloud providers](/databases/connect-db/cloud-databases/index.mdx) pages.
|
||||
[databases page](/databases/overview.mdx).
|
||||
|
||||
<Thumbnail src="/img/projects/connect-database_console_2.15.png" alt="database setup with new database" />
|
||||
|
||||
@ -205,7 +204,7 @@ Hasura Metadata is stored on the same database as specified in the `HASURA_GRAPH
|
||||
## Connect different Hasura instances to the same database
|
||||
|
||||
You can connect different Hasura instances (i.e. instances with different Metadata) to the same database as long as
|
||||
there are no [Event Triggers](/event-triggers/index.mdx) in any of the Metadata. Event Triggers store their data in the
|
||||
there are no [Event Triggers](/event-triggers/overview.mdx) in any of the Metadata. Event Triggers store their data in the
|
||||
underlying database and hence different instances acting on the same data can cause undefined behavior during
|
||||
run-time. This should not be a problem if the Hasura instances have the same Metadata.
|
||||
|
||||
@ -219,4 +218,4 @@ To connect multiple Hasura instances to the same database, simply follow the ste
|
||||
## More databases
|
||||
|
||||
Support for more databases is coming soon. Stay up to date with
|
||||
[supported databases here](/databases/index.mdx#supported-databases).
|
||||
[supported databases here](/databases/overview.mdx).
|
@ -9,7 +9,7 @@ keywords:
|
||||
- read replicas
|
||||
- connections
|
||||
- pool
|
||||
sidebar_label: Read replicas
|
||||
sidebar_label: Read replicas ☁️🏢
|
||||
sidebar_position: 1
|
||||
sidebar_class_name: cloud-and-enterprise-icon
|
||||
---
|
@ -1,50 +1,45 @@
|
||||
---
|
||||
title: Databases
|
||||
description: Hasura databases support
|
||||
description: Database feature support
|
||||
sidebar_label: Feature Support
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- databases
|
||||
slug: index
|
||||
- feature support
|
||||
sidebar_position: 1.3
|
||||
---
|
||||
|
||||
import Databases from '@site/static/icons/features/database.svg';
|
||||
import VersionedLink from '@site/src/components/VersionedLink';
|
||||
import PostgreSQL from '@site/static/img/databases/logos/postgresql.png';
|
||||
import SQLServer from '@site/static/img/databases/logos/sql-server.png';
|
||||
import BigQuery from '@site/static/img/databases/logos/bigquery.png';
|
||||
import MySQL from '@site/static/img/databases/logos/mysql.png';
|
||||
import Snowflake from '@site/static/img/databases/logos/snowflake.png';
|
||||
import AmazonAthena from '@site/static/img/databases/logos/amazon-athena.png';
|
||||
|
||||
# <Databases /> Databases
|
||||
import HeadingIcon from '@site/src/components/HeadingIcon';
|
||||
import useBaseUrl from '@docusaurus/useBaseUrl';
|
||||
import ArrowRight from '@site/static/icons/arrow_right.svg';
|
||||
import Aiven from '@site/static/img/cloud-dbs/logos/aiven.png';
|
||||
import Alloy from '@site/static/img/cloud-dbs/logos/alloydb.png';
|
||||
import Aurora from '@site/static/img/cloud-dbs/logos/aws-aurora.png';
|
||||
import Azure from '@site/static/img/cloud-dbs/logos/azure.png';
|
||||
import Cosmos from '@site/static/img/cloud-dbs/logos/cosmos.png';
|
||||
import RDS from '@site/static/img/cloud-dbs/logos/aws.png';
|
||||
import RollTide from '@site/static/img/cloud-dbs/logos/crunchy.png';
|
||||
import DO from '@site/static/img/cloud-dbs/logos/DO.png';
|
||||
import Elephant from '@site/static/img/cloud-dbs/logos/elephant.png';
|
||||
import Enterprise from '@site/static/img/cloud-dbs/logos/enterprisedb.png';
|
||||
import GCP from '@site/static/img/cloud-dbs/logos/gcp.png';
|
||||
import MSSQL from '@site/static/img/cloud-dbs/logos/mssql.png';
|
||||
import Neon from '@site/static/img/cloud-dbs/logos/neon.png';
|
||||
import Railway from '@site/static/img/cloud-dbs/logos/railway.png';
|
||||
import Render from '@site/static/img/cloud-dbs/logos/render.png';
|
||||
import Supabase from '@site/static/img/cloud-dbs/logos/supabase.png';
|
||||
import Timescale from '@site/static/img/cloud-dbs/logos/timescaledb.png';
|
||||
import Yugabyte from '@site/static/img/cloud-dbs/logos/yugabyte.png';
|
||||
|
||||
## Introduction
|
||||
|
||||
The Hasura GraphQL Engine automatically generates your GraphQL schema and resolvers based on tables/views in your
|
||||
database . **You don't need to write a GraphQL schema or resolvers.** See
|
||||
[How Hasura GraphQL Engine works](/getting-started/how-it-works/index.mdx) for more details.
|
||||
|
||||
The Hasura Console gives you UI tools that speed up your data-modeling process, or working with your existing databases.
|
||||
The Console also automatically generates Migrations or Metadata files that you can edit directly and check into your
|
||||
version control.
|
||||
|
||||
## Supported databases
|
||||
|
||||
Hasura GraphQL Engine supports:
|
||||
|
||||
- [Postgres & Postgres compatible flavours](/databases/postgres/index.mdx)
|
||||
- [MS SQL Server](/databases/ms-sql-server/index.mdx)
|
||||
- [Citus / Hyperscale](/databases/postgres/citus-hyperscale-postgres/index.mdx)
|
||||
- [CockroachDB](/databases/postgres/cockroachdb/index.mdx)
|
||||
- [BigQuery](/databases/bigquery/index.mdx)
|
||||
- [Snowflake](/databases/snowflake/index.mdx)
|
||||
- [Amazon Athena](/databases/athena/index.mdx)
|
||||
- [MySQL Alpha](/databases/mysql/index.mdx)
|
||||
|
||||
Hasura also [supports many other cloud database services](/databases/connect-db/cloud-databases/index.mdx).
|
||||
|
||||
:::tip Tip
|
||||
|
||||
Although it is safe to use Hasura with a serverless database, caution must be maintained because some functionalities -
|
||||
such as subscriptions or Event Triggers - will force a serverless database to be always on.
|
||||
|
||||
:::
|
||||
|
||||
### Feature support
|
||||
# Database Feature Support
|
||||
|
||||
The below matrices show the database wise support for the different GraphQL features under schema, queries, mutations
|
||||
and subscriptions.
|
||||
@ -55,7 +50,7 @@ Each ✅ below links **directly** to the feature within a particular type of dat
|
||||
|
||||
:::
|
||||
|
||||
#### Schema
|
||||
## Schema
|
||||
|
||||
<div className="db-tables">
|
||||
|
||||
@ -73,7 +68,7 @@ Each ✅ below links **directly** to the feature within a particular type of dat
|
||||
| Custom Fields | [✅](/schema/postgres/custom-field-names.mdx) | [✅](/schema/postgres/custom-field-names.mdx) | [✅](/schema/ms-sql-server/custom-field-names.mdx) | [✅](/schema/bigquery/custom-field-names.mdx) | [✅](/schema/postgres/custom-field-names.mdx) | [✅](/schema/postgres/custom-field-names.mdx) |
|
||||
| Default Values | [✅](/schema/postgres/default-values/index.mdx) | [✅](/schema/postgres/default-values/index.mdx) | [✅](/schema/ms-sql-server/default-values/index.mdx) | ❌ | [✅](/schema/postgres/default-values/index.mdx) | [✅](/schema/postgres/default-values/index.mdx) |
|
||||
|
||||
#### Queries
|
||||
## Queries
|
||||
|
||||
| | Postgres | Citus | SQL Server | BigQuery | CockroachDB | CosmosDB |
|
||||
| ------------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ----------------------------------------------------------------------- | ------------------------------------------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
|
||||
@ -88,7 +83,7 @@ Each ✅ below links **directly** to the feature within a particular type of dat
|
||||
| Multiple Queries | [✅](/queries/postgres/multiple-queries.mdx) | [✅](/queries/postgres/multiple-queries.mdx) | [✅](/queries/ms-sql-server/multiple-queries.mdx) | [✅](/queries/bigquery/index.mdx) | [✅](/queries/postgres/multiple-queries.mdx) | [✅](/queries/postgres/multiple-queries.mdx) |
|
||||
| Variables / Aliases / Fragments | [✅](/queries/postgres/variables-aliases-fragments-directives.mdx) | [✅](/queries/postgres/variables-aliases-fragments-directives.mdx) | [✅](/queries/ms-sql-server/variables-aliases-fragments-directives.mdx) | [✅](/queries/bigquery/index.mdx) | [✅](/queries/postgres/variables-aliases-fragments-directives.mdx) | [✅](/queries/postgres/variables-aliases-fragments-directives.mdx) |
|
||||
|
||||
#### Mutations
|
||||
## Mutations
|
||||
|
||||
| | Postgres | Citus | SQL Server | BigQuery | CockroachDB | CosmosDB |
|
||||
| -------------------- | ------------------------------------------------ | ------------------------------------------------ | ----------------------------------------- | -------- | ------------------------------------------------ | ------------------------------------------------ |
|
||||
@ -98,7 +93,7 @@ Each ✅ below links **directly** to the feature within a particular type of dat
|
||||
| Delete | [✅](/mutations/postgres/delete.mdx) | [✅](/mutations/postgres/delete.mdx) | [✅](/mutations/ms-sql-server/delete.mdx) | ❌ | [✅](/mutations/postgres/delete.mdx) | [✅](/mutations/postgres/delete.mdx) |
|
||||
| Multiple per Request | [✅](/mutations/postgres/multiple-mutations.mdx) | [✅](/mutations/postgres/multiple-mutations.mdx) | ❌ | ❌ | [✅](/mutations/postgres/multiple-mutations.mdx) | [✅](/mutations/postgres/multiple-mutations.mdx) |
|
||||
|
||||
#### Subscriptions
|
||||
## Subscriptions
|
||||
|
||||
| | Postgres | Citus | SQL Server | BigQuery | CockroachDB | CosmosDB |
|
||||
| ----------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | --------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
||||
@ -107,14 +102,14 @@ Each ✅ below links **directly** to the feature within a particular type of dat
|
||||
| Value of Derived Field | [✅](/subscriptions/postgres/livequery/use-cases.mdx#pg-subscribe-derived) | [✅](/subscriptions/postgres/livequery/use-cases.mdx#pg-subscribe-derived) | [✅](/subscriptions/ms-sql-server/use-cases.mdx#pg-subscribe-derived) | ❌ | [✅](/subscriptions/postgres/livequery/use-cases.mdx#pg-subscribe-derived) | [✅](/subscriptions/postgres/livequery/use-cases.mdx#pg-subscribe-derived) |
|
||||
| Streaming Subscriptions | [✅](/subscriptions/postgres/streaming/index.mdx) | [✅](/subscriptions/postgres/streaming/index.mdx) | ❌ | ❌ | [✅](/subscriptions/postgres/streaming/index.mdx) | [✅](/subscriptions/postgres/streaming/index.mdx) |
|
||||
|
||||
#### Event Triggers
|
||||
## Event Triggers
|
||||
|
||||
| | Postgres | Citus | SQL Server | BigQuery | CockroachDB | CosmosDB |
|
||||
| ------ | ------------------------------- | -------------------------------------------------------------------------------------------------- | ------------------------------- | -------- | ------------------------------------------------------------------------------------------ | -------- |
|
||||
| INSERT | [✅](/event-triggers/index.mdx) | [❌](/databases/postgres/citus-hyperscale-postgres/hasura-citus-compatibility.mdx/#event-triggers) | [✅](/event-triggers/index.mdx) | ❌ | [❌](/databases/postgres/cockroachdb/hasura-cockroachdb-compatibility.mdx/#event-triggers) | ❌ |
|
||||
| UPDATE | [✅](/event-triggers/index.mdx) | [❌](/databases/postgres/citus-hyperscale-postgres/hasura-citus-compatibility.mdx/#event-triggers) | [✅](/event-triggers/index.mdx) | ❌ | [❌](/databases/postgres/cockroachdb/hasura-cockroachdb-compatibility.mdx/#event-triggers) | ❌ |
|
||||
| DELETE | [✅](/event-triggers/index.mdx) | [❌](/databases/postgres/citus-hyperscale-postgres/hasura-citus-compatibility.mdx/#event-triggers) | [✅](/event-triggers/index.mdx) | ❌ | [❌](/databases/postgres/cockroachdb/hasura-cockroachdb-compatibility.mdx/#event-triggers) | ❌ |
|
||||
| MANUAL | [✅](/event-triggers/index.mdx) | [❌](/databases/postgres/citus-hyperscale-postgres/hasura-citus-compatibility.mdx/#event-triggers) | [✅](/event-triggers/index.mdx) | ❌ | [❌](/databases/postgres/cockroachdb/hasura-cockroachdb-compatibility.mdx/#event-triggers) | ❌ |
|
||||
| ------ | ---------------------------------- | -------------------------------------------------------------------------------------------------- | ---------------------------------- | -------- | ------------------------------------------------------------------------------------------ | -------- |
|
||||
| INSERT | [✅](/event-triggers/overview.mdx) | [❌](/databases/postgres/citus-hyperscale-postgres/hasura-citus-compatibility.mdx/#event-triggers) | [✅](/event-triggers/overview.mdx) | ❌ | [❌](/databases/postgres/cockroachdb/hasura-cockroachdb-compatibility.mdx/#event-triggers) | ❌ |
|
||||
| UPDATE | [✅](/event-triggers/overview.mdx) | [❌](/databases/postgres/citus-hyperscale-postgres/hasura-citus-compatibility.mdx/#event-triggers) | [✅](/event-triggers/overview.mdx) | ❌ | [❌](/databases/postgres/cockroachdb/hasura-cockroachdb-compatibility.mdx/#event-triggers) | ❌ |
|
||||
| DELETE | [✅](/event-triggers/overview.mdx) | [❌](/databases/postgres/citus-hyperscale-postgres/hasura-citus-compatibility.mdx/#event-triggers) | [✅](/event-triggers/overview.mdx) | ❌ | [❌](/databases/postgres/cockroachdb/hasura-cockroachdb-compatibility.mdx/#event-triggers) | ❌ |
|
||||
| MANUAL | [✅](/event-triggers/overview.mdx) | [❌](/databases/postgres/citus-hyperscale-postgres/hasura-citus-compatibility.mdx/#event-triggers) | [✅](/event-triggers/overview.mdx) | ❌ | [❌](/databases/postgres/cockroachdb/hasura-cockroachdb-compatibility.mdx/#event-triggers) | ❌ |
|
||||
|
||||
</div>
|
||||
|
@ -182,6 +182,6 @@ Voilà. You are ready to start developing.
|
||||
:::info Note
|
||||
|
||||
For more information on which SQL Server features we support, check out
|
||||
[this page](/databases/index.mdx#feature-support)!
|
||||
[this page]/databases/supported-databases.mdx).
|
||||
|
||||
:::
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"label": "MySQL",
|
||||
"position": 5,
|
||||
"position": 100,
|
||||
"className": "alpha-cat"
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ import Thumbnail from '@site/src/components/Thumbnail';
|
||||
|
||||
## Introduction
|
||||
|
||||
This guide will help you get set up with [Hasura Cloud](/hasura-cloud/index.mdx) and our MySQL integration. This is
|
||||
This guide will help you get set up with [Hasura Cloud](/hasura-cloud/overview.mdx) and our MySQL integration. This is
|
||||
the easiest way to set up Hasura Engine and the MySQL GraphQL Data Connector.
|
||||
|
||||
:::tip Supported versions:
|
||||
@ -49,7 +49,11 @@ create a new Hasura Cloud account.
|
||||
|
||||
Once you create a project on Hasura Cloud, hit the "Launch Console" button to open the Hasura Console for your project.
|
||||
|
||||
<Thumbnail src='/img/databases/data-connector/create-project.png' alt='Connect new or existing database' width='1000px' />
|
||||
<Thumbnail
|
||||
src="/img/databases/data-connector/create-project.png"
|
||||
alt="Connect new or existing database"
|
||||
width="1000px"
|
||||
/>
|
||||
|
||||
### Step 2: Connect to a MySQL database
|
||||
|
||||
@ -57,8 +61,8 @@ From the Console, click the `Data` tab:
|
||||
|
||||
<Thumbnail src="/img/getting-started/connect-db-console.png" alt="Connect database" width="1000px" />
|
||||
|
||||
Select the MySQL (Alpha) data source driver. Enter a database display name and the JDBC Connection URL for your
|
||||
MySQL instance.
|
||||
Select the MySQL (Alpha) data source driver. Enter a database display name and the JDBC Connection URL for your MySQL
|
||||
instance.
|
||||
|
||||
The JDBC connection URL should look like this:
|
||||
|
||||
@ -67,27 +71,26 @@ jdbc:mysql://<hostname>:<port>/<database name>?user=<username>&password=<passwor
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
```yaml {4-6}
|
||||
jdbc:mysql://myhost.mycompany.com/mysqltest?user=abc&password=pqr # assuming the default port 3306
|
||||
jdbc:mysql://localhost:4533/mysqltest?user=abc&password=pqr # assuming MySQL is running on port 4533
|
||||
|
||||
```
|
||||
|
||||
For more information see [MySQL Connection URL syntax](https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-jdbc-url-format.html).
|
||||
|
||||
For more information see
|
||||
[MySQL Connection URL syntax](https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-jdbc-url-format.html).
|
||||
|
||||
Click `Connect Database`.
|
||||
|
||||
### Step 7: Track tables and run GraphQL API queries
|
||||
|
||||
Now that you have successfully connected your MySQL database to Hasura, you can track tables and use Hasura to automatically build a GraphQL API on top of it.
|
||||
|
||||
Now that you have successfully connected your MySQL database to Hasura, you can track tables and use Hasura to
|
||||
automatically build a GraphQL API on top of it.
|
||||
|
||||
## Keep up to date
|
||||
|
||||
|
||||
If you'd like to stay informed about the status of MySQL support, subscribe to our newsletter and join our
|
||||
discord!
|
||||
If you'd like to stay informed about the status of MySQL support, subscribe to our newsletter and join our discord!
|
||||
|
||||
- [https://hasura.io/newsletter/](https://hasura.io/newsletter/)
|
||||
- [https://discord.com/invite/hasura](https://discord.com/invite/hasura)
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
sidebar_label: Docker
|
||||
description: Getting Started with Docker for Hasura Enterprise Edition
|
||||
title: "MySQL: Getting Started with Docker"
|
||||
title: 'MySQL: Getting Started with Docker'
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
@ -11,8 +11,8 @@ keywords:
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
import Thumbnail from "@site/src/components/Thumbnail";
|
||||
import LatestRelease from "@site/src/components/LatestRelease";
|
||||
import Thumbnail from '@site/src/components/Thumbnail';
|
||||
import LatestRelease from '@site/src/components/LatestRelease';
|
||||
|
||||
# Getting Started with Hasura and MySQL in Docker
|
||||
|
||||
@ -23,8 +23,8 @@ import LatestRelease from "@site/src/components/LatestRelease";
|
||||
|
||||
## Introduction
|
||||
|
||||
This guide will help you get set up with the [Enterprise Edition](/enterprise/index.mdx) of Hasura GraphQL Engine with
|
||||
our MySQL integration using Docker Compose. This is the easiest way to set up Hasura Enterprise Edition and the
|
||||
This guide will help you get set up with the [Enterprise Edition](/enterprise/overview.mdx) of Hasura GraphQL Engine
|
||||
with our MySQL integration using Docker Compose. This is the easiest way to set up Hasura Enterprise Edition and the
|
||||
MySQL GraphQL Data Connector.
|
||||
|
||||
:::tip Supported versions:
|
||||
@ -54,12 +54,11 @@ This tutorial assumes that the following prerequisites have been met:
|
||||
working on your machine.
|
||||
- You have access to a MySQL database for which you would like to create an API.
|
||||
|
||||
|
||||
### Step 1: Get the Docker Compose file
|
||||
|
||||
The [install manifests repo](https://github.com/hasura/graphql-engine/tree/master/install-manifests) contains all
|
||||
installation manifests required to deploy Hasura anywhere. The Docker Compose manifest also contains a Postgres
|
||||
database in order to store the Hasura metadata and a Redis instance for caching.
|
||||
installation manifests required to deploy Hasura anywhere. The Docker Compose manifest also contains a Postgres database
|
||||
in order to store the Hasura metadata and a Redis instance for caching.
|
||||
|
||||
```bash
|
||||
# in a new directory run
|
||||
@ -72,25 +71,25 @@ curl https://raw.githubusercontent.com/hasura/graphql-engine/master/install-mani
|
||||
|
||||
Edit the downloaded `docker-compose.yaml` and set the license key and admin secret.
|
||||
|
||||
An [admin secret key](/deployment/securing-graphql-endpoint.mdx) is required to make sure that your GraphQL endpoint
|
||||
and the Hasura Console are not publicly accessible.
|
||||
An [admin secret key](/deployment/securing-graphql-endpoint.mdx) is required to make sure that your GraphQL endpoint and
|
||||
the Hasura Console are not publicly accessible.
|
||||
|
||||
#### Edit the Docker Compose file to include the license key and admin secret environment variables
|
||||
|
||||
```yaml {5-6}
|
||||
...
|
||||
|
||||
---
|
||||
graphql-engine:
|
||||
image: hasura/graphql-engine:v2.12.0
|
||||
environment:
|
||||
HASURA_GRAPHQL_EE_LICENSE_KEY: <license key>
|
||||
HASURA_GRAPHQL_ADMIN_SECRET: <your secretkey>
|
||||
...
|
||||
```
|
||||
|
||||
:::caution Secure the admin secret
|
||||
|
||||
The `HASURA_GRAPHQL_ADMIN_SECRET` should never be passed from the client to the Hasura GraphQL Engine as it would give
|
||||
the client full admin rights to your Hasura instance. See [Authentication & Authorization](/auth/index.mdx) for
|
||||
the client full admin rights to your Hasura instance. See [Authentication & Authorization](/auth/overview.mdx) for
|
||||
information on setting up auth in Hasura.
|
||||
|
||||
:::
|
||||
@ -117,8 +116,8 @@ b0b1aac0508d postgres ... 1m ago Up 1m 5432/tcp ...
|
||||
|
||||
### Step 5: Load the Hasura Console
|
||||
|
||||
Open the Hasura Console by navigating to `http://localhost:8080/console`. You will need to input your admin secret
|
||||
key as set in your Docker Compose file to log in.
|
||||
Open the Hasura Console by navigating to `http://localhost:8080/console`. You will need to input your admin secret key
|
||||
as set in your Docker Compose file to log in.
|
||||
|
||||
### Step 6: Connect to a MySQL database
|
||||
|
||||
@ -126,8 +125,8 @@ From the Console, click the `Data` tab:
|
||||
|
||||
<Thumbnail src="/img/getting-started/connect-db-console.png" alt="Connect database" width="1000px" />
|
||||
|
||||
Select the MySQL (Alpha) data source driver, enter in a display name for the database and set the JDBC Connection
|
||||
URL for your MySQL instance.
|
||||
Select the MySQL (Alpha) data source driver, enter in a display name for the database and set the JDBC Connection URL
|
||||
for your MySQL instance.
|
||||
|
||||
The JDBC connection URL should look like this:
|
||||
|
||||
@ -136,13 +135,14 @@ jdbc:mysql://<hostname>:<port>/<database name>?user=<username>&password=<passwor
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
```yaml {4-6}
|
||||
jdbc:mysql://myhost.mycompany.com/mysqltest?user=abc&password=pqr # assuming the default port 3306
|
||||
jdbc:mysql://localhost:4533/mysqltest?user=abc&password=pqr # assuming MySQL is running on port 4533
|
||||
```
|
||||
|
||||
For more information see [MySQL Connection URL syntax](https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-jdbc-url-format.html).
|
||||
|
||||
For more information see
|
||||
[MySQL Connection URL syntax](https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-jdbc-url-format.html).
|
||||
|
||||
Click `Connect Database`.
|
||||
|
||||
@ -160,21 +160,20 @@ We highly recommend using managed PostgreSQL and Redis instances especially when
|
||||
To switch to using your PostgreSQL or Redis instances, set the following environment variables:
|
||||
|
||||
```yaml {4-6}
|
||||
HASURA_GRAPHQL_METADATA_DATABASE_URL
|
||||
HASURA_GRAPHQL_REDIS_URL
|
||||
HASURA_GRAPHQL_RATE_LIMIT_REDIS_URL
|
||||
HASURA_GRAPHQL_METADATA_DATABASE_URL HASURA_GRAPHQL_REDIS_URL HASURA_GRAPHQL_RATE_LIMIT_REDIS_URL
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
```yaml {5-7}
|
||||
...
|
||||
|
||||
---
|
||||
graphql-engine:
|
||||
image: hasura/graphql-engine:v2.12.0
|
||||
environment:
|
||||
HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres
|
||||
HASURA_GRAPHQL_REDIS_URL: "redis://redis:6379"
|
||||
HASURA_GRAPHQL_RATE_LIMIT_REDIS_URL: "redis://redis:6379"
|
||||
...
|
||||
HASURA_GRAPHQL_REDIS_URL: 'redis://redis:6379'
|
||||
HASURA_GRAPHQL_RATE_LIMIT_REDIS_URL: 'redis://redis:6379'
|
||||
```
|
||||
|
||||
### Resources
|
||||
|
@ -51,9 +51,9 @@ new implementation built using our [GraphQL Data Connectors](https://hasura.io/b
|
||||
## Coming soon for MySQL
|
||||
|
||||
- [Remote relationships](/remote-schemas/remote-relationships/index.mdx)
|
||||
- [Mutations](/mutations/index.mdx)
|
||||
- [Subscriptions](/subscriptions/index.mdx)
|
||||
- [Event triggers](/event-triggers/index.mdx)
|
||||
- [Mutations](/mutations/overview.mdx)
|
||||
- [Subscriptions](/subscriptions/overview.mdx)
|
||||
- [Event triggers](/event-triggers/overview.mdx)
|
||||
|
||||
## Resources
|
||||
|
||||
|
127
docs/docs/databases/overview.mdx
Normal file
127
docs/docs/databases/overview.mdx
Normal file
@ -0,0 +1,127 @@
|
||||
---
|
||||
description: Hasura Remote Schemas
|
||||
title: Overview
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- remote schemas
|
||||
hide_table_of_contents: true
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
import VersionedLink from '@site/src/components/VersionedLink';
|
||||
import Database from '@site/static/icons/features/database.svg';
|
||||
|
||||
import PostgreSQL from '@site/static/img/databases/logos/postgresql.png';
|
||||
import SQLServer from '@site/static/img/databases/logos/sql-server.png';
|
||||
import BigQuery from '@site/static/img/databases/logos/bigquery.png';
|
||||
import MySQL from '@site/static/img/databases/logos/mysql.png';
|
||||
import Snowflake from '@site/static/img/databases/logos/snowflake.png';
|
||||
import AmazonAthena from '@site/static/img/databases/logos/amazon-athena.png';
|
||||
|
||||
# <Database /> Databases
|
||||
|
||||
<div className="overview-header">
|
||||
<div className="overview-text">
|
||||
<p>
|
||||
The Hasura GraphQL Engine can connect to a wide range of databases in order to generate a full featured data
|
||||
API for you automatically, without needing to write handlers, schemas or resolvers.
|
||||
</p>
|
||||
<p>
|
||||
Hasura can connect to your existing databases or you can create new databases and connect to, and manage them
|
||||
with Hasura Engine.
|
||||
</p>
|
||||
<h4>Quick Links</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<VersionedLink to="/databases/quickstart">Get started with databases in 60 seconds.</VersionedLink>
|
||||
</li>
|
||||
<li>
|
||||
<VersionedLink to="/databases/feature-support">Check Hasura feature support for databases.</VersionedLink>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<iframe
|
||||
src="https://www.youtube.com/embed/iugaSai6jr8"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen
|
||||
/>
|
||||
</div>
|
||||
|
||||
## Supported databases
|
||||
|
||||
<div className="vendor-table">
|
||||
<VersionedLink to="/databases/postgres/index/">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={PostgreSQL} title="PostgreSQL" alt="Connect PostgreSQL to Hasura" />
|
||||
</div>
|
||||
<h5>Postgres & Compatible</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/ms-sql-server/index/">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={SQLServer} title="Microsoft SQL Server" alt="Connect Microsoft SQL Server to Hasura" />
|
||||
</div>
|
||||
<h5>Microsoft SQL Server</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/bigquery/index/">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={BigQuery} title="Google BigQuery" alt="Connect Google BigQuery to Hasura" />
|
||||
</div>
|
||||
<h5>Google BigQuery</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/athena/index/">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={AmazonAthena} title="Amazon Athena" alt="Connect Amazon Athena to Hasura" />
|
||||
</div>
|
||||
<h5>Amazon Athena</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/snowflake/index/">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Snowflake} title="Snowflake" alt="Connect Snowflake to Hasura" />
|
||||
</div>
|
||||
<h5>Snowflake</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/mysql/index/">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={MySQL} title="MySQL" alt="Connect MySQL to Hasura" />
|
||||
</div>
|
||||
<h5>MySQL (Alpha)</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
</div>
|
||||
|
||||
## Using Databases
|
||||
|
||||
<div className="overview-gallery">
|
||||
<VersionedLink to="/databases/postgres/neon">
|
||||
<div className="card">
|
||||
<h3>Connect to a Neon Serverless Postgres Database</h3>
|
||||
<p>Create a database with our partners at Neon with a generous free starter tier.</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/bigquery/index">
|
||||
<div className="card">
|
||||
<h3>Connect to a BigQuery Database</h3>
|
||||
<p>Utilize Google's leading enterprise data warehouse platform.</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/mysql/index/">
|
||||
<div className="card">
|
||||
<h3>Connect to a MySQL Database</h3>
|
||||
<p>The world's most popular open source database. Currently in Alpha preview.</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
</div>
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"label": "Postgres",
|
||||
"label": "Postgres & Compatible",
|
||||
"position": 2
|
||||
}
|
||||
|
@ -158,6 +158,6 @@ Voilà. You are ready to start developing.
|
||||
|
||||
:::info Note
|
||||
|
||||
For more information on which Postgres features we support, check out [this page](/databases/index.mdx#feature-support)!
|
||||
For more information on which Postgres features we support, check out [this page](/databases/feature-support.mdx).
|
||||
|
||||
:::
|
@ -230,6 +230,6 @@ Voilà. You are ready to start developing.
|
||||
|
||||
:::info Note
|
||||
|
||||
For more information on which Postgres features we support, check out [this page](/databases/index.mdx#feature-support)!
|
||||
For more information on which Postgres features we support, check out [this page](/databases/feature-support.mdx).
|
||||
|
||||
:::
|
@ -203,6 +203,6 @@ Voilà. You are ready to start developing.
|
||||
|
||||
:::info Note
|
||||
|
||||
For more information on which Postgres features we support, check out [this page](/databases/index.mdx#feature-support)!
|
||||
For more information on which Postgres features we support, check out [this page](/databases/feature-support.mdx).
|
||||
|
||||
:::
|
@ -104,7 +104,7 @@ If you're using a database user other than the default one, make sure to give it
|
||||
## Step 4: Allow connections to your DB from Hasura {#connect-hasura-aws-pg}
|
||||
|
||||
On the database dashboard, click on `Connectivity & security`. On the right, click on the security group that you
|
||||
selected or added in [step 3](/databases/connect-db/cloud-databases/aws-postgres.mdx#create-aws-rds-postgres-db).
|
||||
selected or added in [step 3](/databases/postgres/aws-postgres.mdx#create-aws-rds-postgres-db).
|
||||
|
||||
<Thumbnail
|
||||
src="/img/cloud-dbs/aws/postgres/find-security-group.png"
|
||||
@ -172,7 +172,7 @@ On the database dashboard, click on `Connectivity & security`:
|
||||
## Step 6: Finish connecting the database
|
||||
|
||||
Back on the Hasura Console, enter the database URL that we retrieved in
|
||||
[step 5](/databases/connect-db/cloud-databases/aws-postgres.mdx#construct-db-url-aws-postgres):
|
||||
[step 5](/databases/postgres/aws-postgres.mdx#construct-db-url-aws-postgres):
|
||||
|
||||
<Thumbnail src="/img/getting-started/connect-db-cloud.png" alt="Database setup" width="600px" />
|
||||
|
||||
@ -202,6 +202,6 @@ Voilà. You are ready to start developing.
|
||||
|
||||
:::info Note
|
||||
|
||||
For more information on which Postgres features we support, check out [this page](/databases/index.mdx#feature-support)!
|
||||
For more information on which Postgres features we support, check out [this page](/databases/feature-support.mdx).
|
||||
|
||||
:::
|
@ -117,6 +117,6 @@ Voilà. You are ready to start developing.
|
||||
:::info Note
|
||||
|
||||
For more information on which Azure Cosmos DB features we support, check out
|
||||
[this page](/databases/index.mdx#feature-support)!
|
||||
[this page](/databases/feature-support.mdx).
|
||||
|
||||
:::
|
@ -170,6 +170,6 @@ Voilà. You are ready to start developing.
|
||||
|
||||
:::info Note
|
||||
|
||||
For more information on which Postgres features we support, check out [this page](/databases/index.mdx#feature-support)!
|
||||
For more information on which Postgres features we support, check out [this page](/databases/feature-support.mdx).
|
||||
|
||||
:::
|
@ -146,6 +146,6 @@ Voilà. You are ready to start developing.
|
||||
|
||||
:::info Note
|
||||
|
||||
For more information on which Postgres features we support, check out [this page](/databases/index.mdx#feature-support)!
|
||||
For more information on which Postgres features we support, check out [this page](/databases/feature-support.mdx).
|
||||
|
||||
:::
|
@ -159,6 +159,6 @@ Voilà. You are ready to start developing.
|
||||
|
||||
:::info Note
|
||||
|
||||
For more information on which Postgres features we support, check out [this page](/databases/index.mdx#feature-support)!
|
||||
For more information on which Postgres features we support, check out [this page](/databases/feature-support.mdx).
|
||||
|
||||
:::
|
@ -146,6 +146,6 @@ Voilà. You are ready to start developing.
|
||||
|
||||
:::info Note
|
||||
|
||||
For more information on which Postgres features we support, check out [this page](/databases/index.mdx#feature-support)!
|
||||
For more information on which Postgres features we support, check out [this page](/databases/feature-support.mdx).
|
||||
|
||||
:::
|
@ -175,6 +175,6 @@ Voilà. You are ready to start developing.
|
||||
|
||||
:::info Note
|
||||
|
||||
For more information on which Postgres features we support, check out [this page](/databases/index.mdx#feature-support)!
|
||||
For more information on which Postgres features we support, check out [this page](/databases/feature-support.mdx).
|
||||
|
||||
:::
|
@ -224,6 +224,6 @@ Finally, click on the `Update Connection` button to apply the SSL settings.
|
||||
|
||||
:::info Note
|
||||
|
||||
For more information on which Postgres features we support, check out [this page](/databases/index.mdx#feature-support)!
|
||||
For more information on which Postgres features we support, check out [this page](/databases/feature-support.mdx).
|
||||
|
||||
:::
|
@ -39,7 +39,7 @@ If you are interested in connecting to a Heroku database, our
|
||||
|
||||
Hasura works well with popular database providers. Most of these providers offer generous free tiers. We have guides you
|
||||
can use to provision and connect a new database in a matter of minutes. You can check them out
|
||||
[here](/databases/connect-db/cloud-databases/index.mdx).
|
||||
[here](/databases/overview.mdx).
|
||||
|
||||
If you're interested in migrating away from Heroku, our different cloud database providers have guides and documentation
|
||||
to help you:
|
||||
@ -109,6 +109,6 @@ to help you:
|
||||
|
||||
:::info Note
|
||||
|
||||
For more information on which Postgres features we support, check out [this page](/databases/index.mdx#feature-support)!
|
||||
For more information on which Postgres features we support, check out [this page](/databases/feature-support.mdx).
|
||||
|
||||
:::
|
@ -8,7 +8,27 @@ keywords:
|
||||
slug: index
|
||||
---
|
||||
|
||||
# Postgres
|
||||
import VersionedLink from '@site/src/components/VersionedLink';
|
||||
import Aiven from '@site/static/img/cloud-dbs/logos/aiven.png';
|
||||
import Alloy from '@site/static/img/cloud-dbs/logos/alloydb.png';
|
||||
import Aurora from '@site/static/img/cloud-dbs/logos/aws-aurora.png';
|
||||
import Azure from '@site/static/img/cloud-dbs/logos/azure.png';
|
||||
import Cosmos from '@site/static/img/cloud-dbs/logos/cosmos.png';
|
||||
import RDS from '@site/static/img/cloud-dbs/logos/aws.png';
|
||||
import RollTide from '@site/static/img/cloud-dbs/logos/crunchy.png';
|
||||
import DO from '@site/static/img/cloud-dbs/logos/DO.png';
|
||||
import Elephant from '@site/static/img/cloud-dbs/logos/elephant.png';
|
||||
import Enterprise from '@site/static/img/cloud-dbs/logos/enterprisedb.png';
|
||||
import GCP from '@site/static/img/cloud-dbs/logos/gcp.png';
|
||||
import Postgres from '@site/static/img/databases/logos/postgresql.png';
|
||||
import Neon from '@site/static/img/cloud-dbs/logos/neon.png';
|
||||
import Railway from '@site/static/img/cloud-dbs/logos/railway.png';
|
||||
import Render from '@site/static/img/cloud-dbs/logos/render.png';
|
||||
import Supabase from '@site/static/img/cloud-dbs/logos/supabase.png';
|
||||
import Timescale from '@site/static/img/cloud-dbs/logos/timescaledb.png';
|
||||
import Yugabyte from '@site/static/img/cloud-dbs/logos/yugabyte.png';
|
||||
|
||||
# Postgres & Compatible Databases
|
||||
|
||||
## Introduction
|
||||
|
||||
@ -22,26 +42,169 @@ Hasura GraphQL Engine supports all supported versions of Postgres per the
|
||||
|
||||
:::
|
||||
|
||||
## Postgres compatibility & flavors {#postgres-compatible-flavors}
|
||||
## Postgres compatible {#postgres-compatible-flavors}
|
||||
|
||||
Hasura supports most databases with full Postgres compatibility such as:
|
||||
|
||||
- [Yugabyte](https://www.yugabyte.com/)
|
||||
- [Timescale](https://www.timescale.com/)
|
||||
- [Citus](https://www.citusdata.com/)
|
||||
- [CockroachDB](https://www.cockroachlabs.com/product/)
|
||||
- [Aurora](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.AuroraPostgreSQL.html)
|
||||
- [RDS](https://aws.amazon.com/rds/postgresql/)
|
||||
- [Crunchy](https://www.crunchydata.com/)
|
||||
- [AlloyDB](https://cloud.google.com/alloydb)
|
||||
- [Neon](https://neon.tech/)
|
||||
- [CosmosDB](https://azure.microsoft.com/en-gb/products/cosmos-db/)
|
||||
<div className="vendor-table">
|
||||
<VersionedLink to="/databases/quickstart">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Postgres} title="Postgres" alt="Connect Postgres DB to Hasura" />
|
||||
</div>
|
||||
<h5>Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/postgres/aiven">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Aiven} title="Aiven Postgres" alt="Connect Postgres DB to Hasura" />
|
||||
</div>
|
||||
<h5>Aiven</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/postgres/alloy">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Alloy} title="Google AlloyDB Postgres" alt="Connect Google AlloyDB to Hasura" />
|
||||
</div>
|
||||
<h5>AlloyDB</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/postgres/aws-aurora">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Aurora} title="AWS Aurora Postgres" alt="Connect AWS Aurora Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>AWS RDS Aurora Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/postgres/aws-postgres">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={RDS} title="AWS RDS Postgres" alt="Connect AWS RDS Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>AWS RDS Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/postgres/azure-cosmos">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Cosmos} title="Azure Cosmos DB" alt="Connect Azure Cosmos to Hasura" />
|
||||
</div>
|
||||
<h5>Azure Cosmos</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/postgres/azure">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Azure} title="Azure Postgres" alt="Connect Azure Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>Azure Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/postgres/crunchy">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={RollTide} title="Crunchy Postgres" alt="Connect Crunchy Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>Crunchy Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/postgres/digital-ocean">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={DO} title="Digital Ocean Postgres" alt="Connect DO Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>Digital Ocean Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/postgres/elephant">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Elephant} title="ElephantSQL Postgres" alt="Connect ElephantSQL Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>ElephantSQL</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/postgres/enterprisedb">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img
|
||||
src={Enterprise}
|
||||
title="EnterpriseDB BigAnimal Postgres"
|
||||
alt="Connect EnterpriseDB BigAnimal Postgres to Hasura"
|
||||
/>
|
||||
</div>
|
||||
<h5>EnterpriseDB</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/postgres/gcp">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={GCP} title="GCP Postgres" alt="Connect GCP Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>GCP Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/postgres/neon">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Neon} title="Neon Postgres" alt="Connect Neon Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>Neon Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/postgres/railway">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Railway} title="Railway Postgres" alt="Connect Railway Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>Railway Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/postgres/render">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Render} title="Render Postgres" alt="Connect Render Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>Render Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/postgres/supabase">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Supabase} title="Supabase Postgres" alt="Connect Supabase Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>Supabase Postgres</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/postgres/timescale-cloud">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Timescale} title="TimescaleDB Postgres" alt="Connect TimescaleDB Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>TimescaleDB</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/databases/postgres/yugabyte">
|
||||
<div className="card-wrapper">
|
||||
<div className="card">
|
||||
<img src={Yugabyte} title="YugabyteDB Postgres" alt="Connect YugabyteDB Postgres to Hasura" />
|
||||
</div>
|
||||
<h5>YugabyteDB</h5>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
</div>
|
||||
|
||||
Hasura also [supports many other cloud database services](/databases/connect-db/cloud-databases/index.mdx).
|
||||
:::tip Other Postgres flavors
|
||||
|
||||
Curious about any other Postgres flavours? Any other questions? Ask us on
|
||||
Curious about any other Postgres flavors? Any other questions? Ask us on
|
||||
[GitHub discussions](https://github.com/hasura/graphql-engine/discussions)
|
||||
|
||||
:::
|
||||
|
||||
|
||||
## Know more
|
||||
|
||||
- [Schema](/schema/postgres/index.mdx)
|
||||
|
@ -116,6 +116,6 @@ the Hasura Console.
|
||||
|
||||
:::info Note
|
||||
|
||||
For more information on which Postgres features we support, check out [this page](/databases/index.mdx#feature-support)!
|
||||
For more information on which Postgres features we support, check out [this page](/databases/feature-support.mdx).
|
||||
|
||||
:::
|
@ -127,6 +127,6 @@ Voilà. You are ready to start developing.
|
||||
|
||||
:::info Note
|
||||
|
||||
For more information on which Postgres features we support, check out [this page](/databases/index.mdx#feature-support)!
|
||||
For more information on which Postgres features we support, check out [this page](/databases/feature-support.mdx).
|
||||
|
||||
:::
|
@ -119,6 +119,6 @@ Voilà. You are ready to start developing.
|
||||
|
||||
:::info Note
|
||||
|
||||
For more information on which Postgres features we support, check out [this page](/databases/index.mdx#feature-support)!
|
||||
For more information on which Postgres features we support, check out [this page](/databases/feature-support.mdx).
|
||||
|
||||
:::
|
@ -178,6 +178,6 @@ Voilà. You are ready to start developing.
|
||||
|
||||
:::info Note
|
||||
|
||||
For more information on which Postgres features we support, check out [this page](/databases/index.mdx#feature-support)!
|
||||
For more information on which Postgres features we support, check out [this page](/databases/feature-support.mdx).
|
||||
|
||||
:::
|
@ -154,6 +154,6 @@ Voilà. You are ready to start developing.
|
||||
|
||||
:::info Note
|
||||
|
||||
For more information on which Postgres features we support, check out [this page](/databases/index.mdx#feature-support)!
|
||||
For more information on which Postgres features we support, check out [this page](/databases/feature-support.mdx).
|
||||
|
||||
:::
|
@ -174,6 +174,6 @@ Voilà. You are ready to start developing.
|
||||
|
||||
:::info Note
|
||||
|
||||
For more information on which Postgres features we support, check out [this page](/databases/index.mdx#feature-support)!
|
||||
For more information on which Postgres features we support, check out [this page](/databases/feature-support.mdx).
|
||||
|
||||
:::
|
214
docs/docs/databases/quickstart.mdx
Normal file
214
docs/docs/databases/quickstart.mdx
Normal file
@ -0,0 +1,214 @@
|
||||
---
|
||||
sidebar_label: Quickstart
|
||||
sidebar_position: 1
|
||||
description: Connect a database to Hasura
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- databases
|
||||
- connect
|
||||
toc_max_heading_level: 2
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import Thumbnail from '@site/src/components/Thumbnail';
|
||||
|
||||
# Connect Databases to Hasura GraphQL Engine
|
||||
|
||||
## Introduction
|
||||
|
||||
You can quickly and easily connect a new, existing, or demo database to Hasura GraphQL Engine in either Hasura Cloud or
|
||||
you can run Hasura Engine using Docker.
|
||||
|
||||
:::tip Connect multiple databases
|
||||
|
||||
You can also connect to multiple databases in order to build a unified GraphQL API.
|
||||
|
||||
:::
|
||||
|
||||
## Connect a database via the Hasura Console {#connect-database-v2-0}
|
||||
|
||||
<Tabs groupId="user-preference" className="api-tabs">
|
||||
<TabItem value="cloud" label="Hasura Cloud">
|
||||
|
||||
If you have [created your project with Hasura Cloud](/hasura-cloud/projects/create.mdx), click on the `Launch Console`
|
||||
button to open the Hasura Console in your browser.
|
||||
|
||||
<Thumbnail src="/img/databases/project_launch-console_2-17-0.png" alt="database setup with new database" />
|
||||
|
||||
Hasura Cloud does not host databases, but does provide integrations with which you can connect databases from many 3rd
|
||||
party managed cloud providers. Check out a [list of supported databases here](/databases/overview.mdx).
|
||||
|
||||
To get started quickly with a Postgres database, choose `Create New Database`:
|
||||
|
||||
<Thumbnail
|
||||
src="/img/projects/create-database-neon-2.15.png"
|
||||
alt="database setup with existing
|
||||
database"
|
||||
/>
|
||||
|
||||
Follow the prompts or [check out our detailed Neon connect page](/databases/postgres/neon.mdx). Hasura Cloud will
|
||||
integrate with your Neon account and manage the initial setup of a Postgres instance. You can always upgrade the
|
||||
instance and manage options later through your Neon account.
|
||||
|
||||
### Connect to an existing database
|
||||
|
||||
To use an existing database, choose `Connect existing database` and enter your database connection URL and enter your
|
||||
database connection string.
|
||||
|
||||
For help finding your particular connection string for your database provider check out our
|
||||
[databases page](/databases/overview.mdx).
|
||||
|
||||
<Thumbnail src="/img/projects/connect-database_console_2.15.png" alt="database setup with new database" />
|
||||
|
||||
You can connect to databases by using environment variables, the raw connection string or connection parameters. It is
|
||||
recommended to use environment variables for better security _(as connection details set via a string will be exposed as
|
||||
part of the Hasura Metadata)_ as well as to allow configuring different databases in different environments _(like
|
||||
staging or production)_ easily.
|
||||
|
||||
A database can be connected to using the `HASURA_GRAPHQL_DATABASE_URL` environment variable as well in which case it
|
||||
gets added automatically as a database named `default`.
|
||||
|
||||
### Allow connections from the Hasura Cloud IP {#cloud-projects-create-allow-nat-ip}
|
||||
|
||||
When using Hasura Cloud, you may need to adjust your connection settings of your database provider to allow connections
|
||||
from the Hasura Cloud IP address.
|
||||
|
||||
You can copy the IP address of your Hasura Engine instance from the copy icon in the `Hasura Cloud IP` field on the
|
||||
Project's details view which you can shortcut to by clicking on your Project name in the Console.
|
||||
|
||||
<Thumbnail src="/img/databases/cloud-console_shortcut-to-project-settings_2-17-0.png" alt="Hasura Cloud IP field" />
|
||||
|
||||
<Thumbnail src="/img/projects/project-general-ip-address_console_2.12.png" alt="Hasura Cloud IP field" />
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="docker" label="Docker">
|
||||
|
||||
If you've [spun up the Hasura Engine with Docker](/getting-started/docker-simple.mdx), you can access the Hasura Console
|
||||
by accessing it in a browser at the URL of your Hasura Engine instance, usually `http://localhost:8080`.
|
||||
|
||||
:::info Enable Hasura Console
|
||||
|
||||
To access the Hasura Console via and URL and not [via the CLI](/hasura-cli/commands/hasura_console.mdx) the
|
||||
`HASURA_GRAPHQL_ENABLE_CONSOLE` [environment variable](/deployment/graphql-engine-flags/reference.mdx##database-url) or
|
||||
`--enable-console` flag must be set to `true`.
|
||||
|
||||
:::
|
||||
|
||||
On the Hasura Console, navigate to the `Data` tab, you will see the "Connect Database" screen.
|
||||
|
||||
<Thumbnail
|
||||
src="/img/databases/databases_connect-database_2-17-0.png"
|
||||
alt="database setup with new database"
|
||||
width="1686px"
|
||||
/>
|
||||
|
||||
You can connect to databases by using environment variables, the raw connection string or connection parameters. It is
|
||||
recommended to use environment variables for better security _(as connection details set via a string will be exposed as
|
||||
part of the Hasura Metadata)_ as well as to allow configuring different databases in different environments _(like
|
||||
staging or production)_ easily.
|
||||
|
||||
A database can be connected to using the `HASURA_GRAPHQL_DATABASE_URL` environment variable as well in which case it
|
||||
gets added automatically as a database named default.
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Connect a database via the Hasura CLI or API
|
||||
|
||||
<Tabs groupId="user-preference" className="api-tabs">
|
||||
<TabItem value="cli" label="CLI">
|
||||
|
||||
In your `config v3` project, head to the `/metadata/databases/databases.yaml` file and add the database configuration as
|
||||
below. If you're using the `HASURA_GRAPHQL_DATABASE_URL` environment variable then the database will get automatically
|
||||
added and named default.
|
||||
|
||||
```yaml
|
||||
- name: <db_name>
|
||||
configuration:
|
||||
connection_info:
|
||||
database_url:
|
||||
from_env: <DB_URL_ENV_VAR>
|
||||
pool_settings:
|
||||
idle_timeout: 180
|
||||
max_connections: 50
|
||||
retries: 1
|
||||
tables: []
|
||||
functions: []
|
||||
```
|
||||
|
||||
Apply the Metadata by running:
|
||||
|
||||
```bash
|
||||
hasura metadata apply
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="api" label="API">
|
||||
|
||||
Depending on the type of database, you can add a database using the
|
||||
[sources Metadata API](/api-reference/metadata-api/source.mdx).
|
||||
|
||||
For example:
|
||||
|
||||
```http
|
||||
POST /v1/metadata HTTP/1.1
|
||||
Content-Type: application/json
|
||||
X-Hasura-Role: admin
|
||||
|
||||
{
|
||||
"type": "pg_add_source",
|
||||
"args": {
|
||||
"name": "<db_name>",
|
||||
"configuration": {
|
||||
"connection_info": {
|
||||
"database_url": {
|
||||
"from_env": "<DB_URL_ENV_VAR>"
|
||||
},
|
||||
"pool_settings": {
|
||||
"retries": 1,
|
||||
"idle_timeout": 180,
|
||||
"max_connections": 50
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
:::info On-the-fly connecting and removing of databases
|
||||
|
||||
In versions `v2.0.0` and above, databases can be connected and removed dynamically without having to restart the Hasura
|
||||
Engine instance.
|
||||
|
||||
:::
|
||||
|
||||
## Hasura Metadata storage
|
||||
|
||||
When using Hasura Cloud, Metadata is stored for you in separate data storage to your connected database(s). When using
|
||||
Docker, if you want to
|
||||
[store the Hasura Metadata on a separate database](/deployment/graphql-engine-flags/reference.mdx#metadata-database-url),
|
||||
you can use the `HASURA_GRAPHQL_METADATA_DATABASE_URL` env var to specify which database to use. By default, the Hasura
|
||||
Metadata is stored on the same database as specified in the `HASURA_GRAPHQL_DATABASE_URL` environment variable.
|
||||
|
||||
## Connect different Hasura instances to the same database
|
||||
|
||||
You can connect different Hasura instances (i.e. instances with different Metadata) to the same database as long as
|
||||
there are no [Event Triggers](/event-triggers/overview.mdx) in any of the Metadata. Event Triggers store their data in
|
||||
the underlying database and hence different instances acting on the same data can cause undefined behavior during
|
||||
run-time. This should not be a problem if the Hasura instances have the same Metadata.
|
||||
|
||||
To connect multiple Hasura instances to the same database, simply follow the steps above for
|
||||
[Connect to an existing database](#connect-to-an-existing-database) for each instance.
|
||||
|
||||
## Connecting to a database not exposed over the internet
|
||||
|
||||
[Contact us](https://hasura.io/contact-us/) for VPC peering and on-premise solutions.
|
||||
|
||||
## More databases
|
||||
|
||||
Support for more databases is coming soon. Stay up to date with [supported databases here](/databases/overview.mdx).
|
@ -15,7 +15,7 @@ real-world practices, user experiences, and challenges when managing enterprise-
|
||||
|
||||
### Recommended patterns
|
||||
|
||||
- Use the [Hasura CLI](/hasura-cli/index.mdx) to manage and export Metadata.
|
||||
- Use the [Hasura CLI](/hasura-cli/overview.mdx) to manage and export Metadata.
|
||||
|
||||
- The CLI exports [YAML files](/migrations-metadata-seeds/manage-metadata.mdx) which is much more source-control
|
||||
friendly than JSON (exported by the Console and API).
|
||||
@ -36,8 +36,8 @@ real-world practices, user experiences, and challenges when managing enterprise-
|
||||
|
||||
:::info Note
|
||||
|
||||
Hasura Cloud users can leverage the [GitHub integration](/hasura-cloud/ci-cd/github-integration.mdx) to
|
||||
automate deployments.
|
||||
Hasura Cloud users can leverage the [GitHub integration](/hasura-cloud/ci-cd/github-integration.mdx) to automate
|
||||
deployments.
|
||||
|
||||
:::
|
||||
|
||||
|
@ -119,7 +119,7 @@ permissions as the provided credentials in the connection string.
|
||||
|
||||
- Use database connections strings with the least privileges required for API operations.
|
||||
|
||||
- Configure [read replicas](/databases/connect-db/read-replicas.mdx) to route read-only operations (queries) to one (or
|
||||
- Configure [read replicas](/databases/database-config/read-replicas.mdx) to route read-only operations (queries) to one (or
|
||||
many) read replicas.
|
||||
|
||||
## Networking/API gateway
|
||||
|
@ -77,7 +77,7 @@ graphql-engine:
|
||||
:::info Note
|
||||
|
||||
The `HASURA_GRAPHQL_ADMIN_SECRET` should never be passed from the client to the Hasura GraphQL Engine as it would give
|
||||
the client full admin rights to your Hasura instance. See [Authentication & Authorization](/auth/index.mdx) for
|
||||
the client full admin rights to your Hasura instance. See [Authentication & Authorization](/auth/overview.mdx) for
|
||||
information on setting up authentication.
|
||||
|
||||
:::
|
||||
|
@ -117,7 +117,7 @@ spec:
|
||||
:::info Note
|
||||
|
||||
The `HASURA_GRAPHQL_ADMIN_SECRET` should never be passed from the client to the Hasura GraphQL Engine as it would give
|
||||
the client full admin rights to your Hasura instance. See [Authentication & Authorization](/auth/index.mdx) for
|
||||
the client full admin rights to your Hasura instance. See [Authentication & Authorization](/auth/overview.mdx) for
|
||||
information on setting up authentication.
|
||||
|
||||
:::
|
||||
|
@ -208,7 +208,7 @@ for JSON encoding-decoding.
|
||||
|
||||
### Connections per Read-Replica
|
||||
|
||||
The maximum number of Postgres connections per [read-replica](databases/connect-db/read-replicas.mdx) that can be opened
|
||||
The maximum number of Postgres connections per [read-replica](databases/database-config/read-replicas.mdx) that can be opened
|
||||
per stripe. When the maximum is reached we will block until a new connection becomes available, even if there is
|
||||
capacity in other stripes.
|
||||
|
||||
@ -242,7 +242,7 @@ List of domains, **including scheme (http/https) and port**, to allow for CORS.
|
||||
value will block requests from all other domains**.
|
||||
|
||||
| | |
|
||||
| ------------------- | ----------------------------------------------------------------------------------------------|
|
||||
| ------------------- | --------------------------------------------------------------------------------------------- |
|
||||
| **Flag** | `--cors-domain <DOMAINS>` |
|
||||
| **Env var** | `HASURA_GRAPHQL_CORS_DOMAIN` |
|
||||
| **Accepted values** | String (comma separated list of domains) |
|
||||
@ -407,7 +407,7 @@ Setting this enables or disables [anonymous telemetry](/policies/telemetry.mdx).
|
||||
|
||||
### Enabled APIs
|
||||
|
||||
List of [APIs](/api-reference/index.mdx) to be enabled on a Hasura GraphQL Engine instance.
|
||||
List of [APIs](/api-reference/overview.mdx) to be enabled on a Hasura GraphQL Engine instance.
|
||||
|
||||
| | |
|
||||
| ------------------- | ---------------------------------------------------- |
|
||||
@ -483,8 +483,8 @@ List of experimental features to be enabled.
|
||||
|
||||
### Graceful Shutdown Timeout
|
||||
|
||||
The timeout, expressed in seconds, to wait for in-flight events (such as [Event Triggers](/event-triggers/index.mdx) and
|
||||
[Scheduled Triggers](/scheduled-triggers/index.mdx)) and async actions to complete before the server shuts down
|
||||
The timeout, expressed in seconds, to wait for in-flight events (such as [Event Triggers](/event-triggers/overview.mdx)
|
||||
and [Scheduled Triggers](/scheduled-triggers/overview.mdx)) and async actions to complete before the server shuts down
|
||||
completely. If the in-flight events are not completed within the timeout, those events are marked as pending.
|
||||
|
||||
| | |
|
||||
@ -802,7 +802,7 @@ Whether to use TLS to connect to a caching [Redis instance](/enterprise/caching.
|
||||
|
||||
### Read Replica URL
|
||||
|
||||
The [URL for a read replica](/databases/connect-db/read-replicas.mdx#adding-read-replica-urls) of the database.
|
||||
The [URL for a read replica](/databases/database-config/read-replicas.mdx#adding-read-replica-urls) of the database.
|
||||
|
||||
:::warning Notice
|
||||
|
||||
@ -940,7 +940,7 @@ Stringify certain [Postgres numeric types](/schema/postgres/postgresql-types.mdx
|
||||
|
||||
:::
|
||||
|
||||
The number of stripes (connection pools) to maintain per [read replica](/databases/connect-db/read-replicas.mdx).
|
||||
The number of stripes (connection pools) to maintain per [read replica](/databases/database-config/read-replicas.mdx).
|
||||
|
||||
| | |
|
||||
| ------------------- | ----------------------------------------- |
|
||||
|
@ -7,7 +7,7 @@ keywords:
|
||||
- enterprise
|
||||
- source health check
|
||||
- source health
|
||||
sidebar_label: Source Health Check
|
||||
sidebar_label: Source Health Check ☁️
|
||||
sidebar_position: 20
|
||||
sidebar_class_name: cloud-icon
|
||||
---
|
||||
|
@ -1,60 +0,0 @@
|
||||
---
|
||||
description: Deploy Hasura GraphQL Engine
|
||||
title: Deploy Hasura GraphQL Engine
|
||||
sidebar_label: Deployment
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- deployment
|
||||
slug: index
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
import Deployment from '@site/static/icons/features/deployment.svg';
|
||||
|
||||
# <Deployment /> Deploy Hasura GraphQL Engine
|
||||
|
||||
## Deployment guides
|
||||
|
||||
This section contains guides to deploy the Hasura GraphQL Engine and connect it to a Postgres database.
|
||||
|
||||
If you're looking for quick deployment options, check out the following guides:
|
||||
|
||||
- [One-click deployment guides](/deployment/deployment-guides/index.mdx#one-click-deployment-guides)
|
||||
|
||||
The following is a list of all deployment guides:
|
||||
|
||||
- [Deployment guides](/deployment/deployment-guides/index.mdx#all-deployment-guides)
|
||||
|
||||
## Configuration
|
||||
|
||||
By default, Hasura GraphQL Engine runs in a very permissive mode for easier development. Check out the below pages to
|
||||
configure the Hasura GraphQL Engine for your production environment:
|
||||
|
||||
- [GraphQL Engine server configuration](/deployment/graphql-engine-flags/index.mdx)
|
||||
- [Postgres requirements](/deployment/postgres-requirements.mdx#postgres-permissions)
|
||||
- [Securing the GraphQL endpoint](/deployment/securing-graphql-endpoint.mdx)
|
||||
- [Enable HTTPS](/deployment/enable-https.mdx)
|
||||
- [Allow-list of operations](/security/allow-list.mdx)
|
||||
- [HTTP compression](/deployment/compression.mdx)
|
||||
- [Updating GraphQL Engine](/deployment/updating-graphql-engine.mdx)
|
||||
- [Downgrading GraphQL Engine](/deployment/downgrading.mdx)
|
||||
|
||||
## Logs
|
||||
|
||||
For access to Hasura GraphQL Engine logs, check the below page for details:
|
||||
|
||||
- [Logging](/deployment/logging.mdx)
|
||||
|
||||
## Production checklist
|
||||
|
||||
If you're moving your Hasura GraphQL Engine to production, consult the following guide:
|
||||
|
||||
- [Production checklist](/deployment/production-checklist.mdx)
|
||||
|
||||
:::info Security Announcements
|
||||
|
||||
Join the [Hasura Security Announcements](https://groups.google.com/forum/#!forum/hasura-security-announce) group for
|
||||
emails about security announcements.
|
||||
|
||||
:::
|
@ -28,7 +28,7 @@ Based on your deployment method, the Hasura GraphQL Engine logs can be accessed
|
||||
:::info Detailed Logging in Hasura Cloud
|
||||
|
||||
If you’re looking for more in-depth logging information, along with a Console for browsing logs, please see
|
||||
[Observability with Hasura Cloud](/observability/index.mdx).
|
||||
[Observability with Hasura Cloud](/observability/overview.mdx).
|
||||
|
||||
:::
|
||||
|
||||
@ -630,267 +630,6 @@ The `detail` field value is an object contains the following members.
|
||||
| `num_one_off_scheduled_events_fetched` | int | The count of total one-off scheduled events fetched |
|
||||
| `num_fetches` | int | The number of fetches happened within 10 minutes |
|
||||
|
||||
### **cron-event-generator-process** log structure
|
||||
|
||||
Every 10 minutes, the Hasura Engine logs the cron triggers fetched from metadata storage for events generation. The log
|
||||
also contains the number of times new triggers are fetched within the 10 minute timeframe.
|
||||
|
||||
```json
|
||||
{
|
||||
"detail": {
|
||||
"cron_triggers": [
|
||||
{
|
||||
"max_scheduled_time": "2023-01-31T13:18:00Z",
|
||||
"name": "every_two_minutes",
|
||||
"upcoming_events_count": 99
|
||||
}
|
||||
],
|
||||
"num_fetches": 10
|
||||
},
|
||||
"level": "info",
|
||||
"timestamp": "2023-01-31T15:31:55.773+0530",
|
||||
"type": "cron-event-generator-process"
|
||||
}
|
||||
```
|
||||
|
||||
The `type` in the log will be `cron-event-generator-process` and details of the cron event generator process will be
|
||||
under the `detail` key.
|
||||
|
||||
The `detail` field value is an object containing the following members.
|
||||
|
||||
| Name | Type | Description |
|
||||
| --------------- | ---------------------------------- | ------------------------------------------------ |
|
||||
| `cron_triggers` | List of `CronTriggerStats` objects | The list of cron triggers fetched |
|
||||
| `num_fetches` | int | The number of fetches happened within 10 minutes |
|
||||
|
||||
The `CronTriggerStats` object contains the following members.
|
||||
|
||||
| Name | Type | Description |
|
||||
| ----------------------- | ------ | ---------------------------------------------- |
|
||||
| `name` | string | The name of the cron trigger |
|
||||
| `upcoming_events_count` | int | The number of undelivered upcoming cron events |
|
||||
| `max_scheduled_time` | string | The timestamp of the cron event occurring last |
|
||||
|
||||
:::info Note
|
||||
|
||||
A new set of cron events will be generated only for triggers with fewer than 100 upcoming events. Thus, the
|
||||
`upcoming_events_count` will be always `< 100`.
|
||||
|
||||
:::
|
||||
|
||||
### **livequery-poller-log** structure {#livequery-poller-log}
|
||||
|
||||
The Hasura GraphQL Engine emits `livequery-poller-log` when a live query or streaming subscription is running. A
|
||||
subscription is run via a poller internally, which executes a multiplexed query on the database. Various internal
|
||||
metrics are emitted to this log.
|
||||
|
||||
Below, you can find examples of the `livequery-poller-log` as seen from the Community and Self-hosted Enterprise
|
||||
Editions:
|
||||
|
||||
<Tabs>
|
||||
<TabItem value='ce-log' label='Community Edition'>
|
||||
|
||||
```json
|
||||
{
|
||||
"detail": {
|
||||
"execution_batches": [
|
||||
{
|
||||
"batch_id": 1,
|
||||
"batch_response_size_bytes": 106,
|
||||
"db_execution_time": 0.001570364,
|
||||
"pg_execution_time": 0.001570364,
|
||||
"push_time": 0.000163488
|
||||
}
|
||||
],
|
||||
"generated_sql": "SELECT \"__subs\".\"result_id\" , \"__fld_resp\".\"root\" AS \"result\" FROM UNNEST(($1)::uuid[], ($2)::json[]) AS \"__subs\"(\"result_id\", \"result_vars\") LEFT OUTER JOIN LATERAL (SELECT json_build_object('test', \"_test\".\"root\" ) AS \"root\" FROM (SELECT coalesce(json_agg(\"root\" ), '[]' ) AS \"root\" FROM (SELECT row_to_json((SELECT \"_e\" FROM (SELECT \"_root.base\".\"id\" AS \"id\", \"_root.base\".\"name\" AS \"name\" ) AS \"_e\" ) ) AS \"root\" FROM (SELECT * FROM \"public\".\"test\" WHERE ('true') ) AS \"_root.base\" ) AS \"_root\" ) AS \"_test\" ) AS \"__fld_resp\" ON ('true') ",
|
||||
"kind": "live-query",
|
||||
"poller_id": "605369b0-69c4-44fb-b3a1-9897bae5007c",
|
||||
"role": "admin",
|
||||
"snapshot_time": 0.000032141,
|
||||
"source": "default",
|
||||
"subscriber_count": 1,
|
||||
"subscription_options": {
|
||||
"batch_size": 100,
|
||||
"refetch_delay": 1
|
||||
},
|
||||
"total_time": 0.001851686
|
||||
},
|
||||
"level": "info",
|
||||
"timestamp": "2023-02-06T14:36:46.194+0530",
|
||||
"type": "livequery-poller-log"
|
||||
}
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value='ee-log' label='Self-hosted Enterprise'>
|
||||
|
||||
```json
|
||||
{
|
||||
"detail": {
|
||||
"cohort_size": 1,
|
||||
"cohorts": [
|
||||
{
|
||||
"batch_id": 1,
|
||||
"cohort_id": "1f5e2cc6-56b9-4215-ab55-fadc725d3737",
|
||||
"cohort_variables": {
|
||||
"cursor": {},
|
||||
"query": {},
|
||||
"session": {},
|
||||
"synthetic": []
|
||||
},
|
||||
"response_size_bytes": 106,
|
||||
"subscribers": [
|
||||
{
|
||||
"operation_id": "2",
|
||||
"operation_name": "testSubs",
|
||||
"request_id": "b928d8f8-96bf-4274-a0a9- da8dce63183f",
|
||||
"subscriber_id": "350402f5-f2d5-4620-9f22-f320ab0da048",
|
||||
"websocket_id": "75dccf63-37d6-4f30-b840-2c56f0fab18e"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"execution_batch_size": 1,
|
||||
"execution_batches": [
|
||||
{
|
||||
"batch_id": 1,
|
||||
"batch_response_size_bytes": 106,
|
||||
"batch_size": 1,
|
||||
"db_execution_time": 0.002743811,
|
||||
"pg_execution_time": 0.002743811,
|
||||
"push_cohorts_time": 0.000212959
|
||||
}
|
||||
],
|
||||
"generated_sql": "SELECT \"__subs\".\"result_id\" , \"__fld_resp\".\"root\" AS \"result\" FROM UNNEST(($1)::uuid[], ($2):: json[]) AS \"__subs\"(\"result_id\", \"result_vars\") LEFT OUTER JOIN LATERAL (SELECT json_build_object('test', \"_test\".\"root\" ) AS \"root\" FROM (SELECT coalesce(json_agg(\"root\" ), '[]' ) AS \"root\" FROM (SELECT row_to_json((SELECT \"_e\" FROM (SELECT \"_root.base\".\"id\" AS \"id\", \"_root.base\".\"name\" AS \"name\" ) AS \"_e\" ) ) AS \"root\" FROM (SELECT * FROM \"public\".\"test\" WHERE ('true') ) AS \"_root. base\" ) AS \"_root\" ) AS \"_test\" ) AS \"__fld_resp\" ON ('true') /* field_name=test, parameterized_query_hash=678ff296b384af45bfa1d52af398de475f509250 */",
|
||||
"kind": "live-query",
|
||||
"parameterized_query_hash": "678ff296b384af45bfa1d52af398de475f509250",
|
||||
"poller_id": "70344ef5-8a52-4a78-b2ad-ef7ff1bd46f8",
|
||||
"role": "admin",
|
||||
"snapshot_time": 0.000108982,
|
||||
"source": "one",
|
||||
"subscriber_count": 1,
|
||||
"subscription_options": {
|
||||
"batch_size": 100,
|
||||
"refetch_delay": 1
|
||||
},
|
||||
"total_time": 0.003222237
|
||||
},
|
||||
"level": "info",
|
||||
"timestamp": "2023-02-06T14:43:34.536+0530",
|
||||
"type": "livequery-poller-log"
|
||||
}
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
The `type` is `livequery-poller-log` and internal details/metrics are nested in the `detail` key.
|
||||
|
||||
The `detail` field's value is an object containing the following properties:
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---------------------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `kind` | string | "live-query" or "streaming" |
|
||||
| `poller_id` | string | UUID that uniquely identifies the poller |
|
||||
| `subscriber_count` | number | Total number of subscribers in the poller |
|
||||
| `cohorts`\* | [[Cohort]](/deployment/logging.mdx#subscription-log-cohort) | List of cohorts |
|
||||
| `cohort_size`\* | number | Number of cohorts (length of the above list) |
|
||||
| `execution_batches` | [[ExecutionBatch]](/deployment/logging.mdx#subscription-log-execution-batch) | List of execution batches |
|
||||
| `execution_batch_size`\* | number | Number of execution batches (length of the above list) |
|
||||
| `total_time` | number | Total time (in seconds) spent on running the poller once (which may concurrently process more than one batch) and then pushing the results to each subscriber |
|
||||
| `snapshot_time` | number | The time taken (in seconds) to group identical subscribers in cohorts and then split cohorts into different batches |
|
||||
| `generated_sql` | string | The multiplexed SQL query to be run against database |
|
||||
| `parameterized_query_hash`\* | string | The [parameterized query hash](/deployment/logging.mdx#http-log-structure) of the query |
|
||||
| `subscription_options` | [SubscriptionOptions](/deployment/logging.mdx#subscription-log-config-options) | Subscription options configured (like refetch delay, batch size etc.) |
|
||||
| `source` | string | Name of the source on which the query is being run |
|
||||
| `role` | string | Role associated with the client that is making the subscription |
|
||||
|
||||
:::info FIELD AVAILABILITY
|
||||
|
||||
Fields marked with an asterisk(\*) are only available on Self-hosted Enterprise
|
||||
|
||||
:::
|
||||
|
||||
#### Cohort {#subscription-log-cohort}
|
||||
|
||||
A cohort is a batched group of subscribers running the same query with identical session and query variables. Each
|
||||
result pushed to a cohort is forwarded along to each of its subscribers.
|
||||
|
||||
The cohort field is an object with the following properties:
|
||||
|
||||
| Name | Type | Description |
|
||||
| --------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
|
||||
| `batch_id` | number | A monotonically increasing (from 1) batch number assigned to each batch in a cohort |
|
||||
| `cohort_id` | string | UUID that uniquely identifies a cohort |
|
||||
| `cohort_variables` | [CohortVariables](/deployment/logging.mdx#subscription-log-cohort-vars) | All the variables of the cohort. This includes query, session and cursor variables |
|
||||
| `response_size_bytes` | number | Response size in bytes |
|
||||
| `subscribers` | [[Subscriber]](/deployment/logging.mdx#subscription-log-subscriber) | List of subscribers |
|
||||
|
||||
#### Subscriber {#subscription-log-execution-batch}
|
||||
|
||||
A subscriber is a client running a subscription operation.
|
||||
|
||||
The subscriber field is an object with the following properties:
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---------------- | ------ | -------------------------------------------------------------------------- |
|
||||
| `operation_id` | string | Operation ID provided by the client (as per the Apollo websocket protocol) |
|
||||
| `operation_name` | string | Name of the GraphQL operation |
|
||||
| `request_id` | string | UUID generated by HGE for each operation request |
|
||||
| `subscriber_id` | string | UUID generated by HGE for the subscriber |
|
||||
| `websocket_id` | string | UUID generated by HGE for websocket connection of the client |
|
||||
|
||||
:::info SUBSCRIBER NOTES
|
||||
|
||||
- A `request_id` is generated on every operation sent by the client. This can include queries and mutations.
|
||||
- A `subscriber_id` is generated on every subscription operation sent by the client. Co-incidentally, a `request_id` is
|
||||
also generated.
|
||||
- A `websocket_id` is generated per client, when a client connects over websocket (irrespective of if they ever ran a
|
||||
subscription operation)
|
||||
|
||||
:::
|
||||
|
||||
#### Execution Batch {#subscription-log-execution-batch}
|
||||
|
||||
A cohort is further divided into batches (according to the
|
||||
[`HASURA_GRAPHQL_LIVE_QUERIES_MULTIPLEXED_BATCH_SIZE` config](/deployment/graphql-engine-flags/reference.mdx#multiplexed-batch-size))
|
||||
for concurrent execution.
|
||||
|
||||
The execution batch field is an object with the following properties:
|
||||
|
||||
| Name | Type | Description |
|
||||
| --------------------------- | ------ | ------------------------------------------------------------------------------------ |
|
||||
| `batch_id` | number | A monotonically increasing (from 1) batch number |
|
||||
| `batch_response_size_bytes` | number | Response size of the batch in bytes (which will be `null` in case of errors) |
|
||||
| `batch_size` | string | Number of cohorts in this batch |
|
||||
| `pg_execution_time` | number | Database execution time (in seconds) of the batch (present only in vanilla Postgres) |
|
||||
| `db_execution_time` | number | Database execution time (in seconds) of the batch |
|
||||
| `push_cohorts_time` | number | Time taken (in seconds) to push response to all cohorts in this batch |
|
||||
|
||||
#### Cohort Variables {#subscription-log-cohort-vars}
|
||||
|
||||
This includes various variables of the cohort. This includes query, session, cursor variables and synthetic variables.
|
||||
|
||||
This field is an object with the following properties:
|
||||
|
||||
| Name | Type | Description |
|
||||
| ----------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `query` | object | The variables provided along with the GraphQL query by the subscriber |
|
||||
| `session` | object | The session variables (`x-hasura-*`) resolved by Hasura during authentication |
|
||||
| `cursor` | object | The cursor variables in case of a streaming subscription. Empty in live query subscription |
|
||||
| `synthetic` | object | All SQL literals are converted to what are called synthetic variables. [See this for more details](https://github.com/hasura/graphql-engine-mono/blob/d96d7fa5aaf0c1e71d1c4c0fa8f0162abce39e18/server/src-lib/Hasura/GraphQL/Execute/Subscription/Plan.hs#L186-L205) |
|
||||
|
||||
#### Subscription Options {#subscription-log-config-options}
|
||||
|
||||
These are all configured options for a live query.
|
||||
|
||||
The `subscription_options` field is an object with the following properties:
|
||||
|
||||
| Name | Type | Description |
|
||||
| --------------- | ------ | ---------------------------------------------------------------------------------------------- |
|
||||
| `batch_size` | number | The batch size configured via `HASURA_GRAPHQL_LIVE_QUERIES_MULTIPLEXED_BATCH_SIZE` |
|
||||
| `refetch_delay` | number | The refetch interval configured via `HASURA_GRAPHQL_LIVE_QUERIES_MULTIPLEXED_REFETCH_INTERVAL` |
|
||||
|
||||
## Monitoring frameworks
|
||||
|
||||
You can integrate the logs emitted by the Hasura Engine with external monitoring tools for better visibility as per your
|
||||
|
81
docs/docs/deployment/overview.mdx
Normal file
81
docs/docs/deployment/overview.mdx
Normal file
@ -0,0 +1,81 @@
|
||||
---
|
||||
description: Hasura Deployment
|
||||
title: Overview
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- deployment
|
||||
- CI/CD
|
||||
- cloud
|
||||
- docker
|
||||
hide_table_of_contents: true
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
import Thumbnail from '@site/src/components/Thumbnail';
|
||||
import VersionedLink from '@site/src/components/VersionedLink';
|
||||
import Deployment from '@site/static/icons/features/deployment.svg';
|
||||
|
||||
# <Deployment /> Deploy Hasura GraphQL Engine
|
||||
|
||||
<div className="overview-header">
|
||||
<div className="overview-text">
|
||||
<p>
|
||||
To deploy the Hasura GraphQL Engine, we recommend using Hasura Cloud, which is a fully-managed, highly-optimized, production-ready,
|
||||
hosted option. With Hasura Cloud, you can deploy your GraphQL API in less than 60 seconds plus you get high availability,
|
||||
automatic upgrades, and observability out of the box. Alternatively, you can deploy the Hasura GraphQL Engine to a
|
||||
cloud provider of your choice using Docker or Kubernetes.
|
||||
</p>
|
||||
<p>
|
||||
Regardless of where you deploy, the Hasura GraphQL Engine is highly configurable, allowing you to tailor
|
||||
everything to your needs.
|
||||
</p>
|
||||
<h4>Quick Links</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<VersionedLink to="/getting-started/getting-started-cloud/">
|
||||
Deploy to Hasura Cloud in less than 60 seconds.
|
||||
</VersionedLink>
|
||||
</li>
|
||||
<li>
|
||||
<VersionedLink to="/deployment/graphql-engine-flags/index/">Learn about configuring Hasura.</VersionedLink>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<iframe
|
||||
src="https://www.youtube.com/embed/f4Jj_sqn1ww"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen
|
||||
/>
|
||||
</div>
|
||||
|
||||
## Deployment Topics
|
||||
|
||||
<div className="overview-gallery">
|
||||
<VersionedLink to="/getting-started/getting-started-cloud/">
|
||||
<div className="card">
|
||||
<h3>Hasura Cloud</h3>
|
||||
<p>In just a couple of clicks, connect your existing data and have a production-ready GraphQL API.</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/deployment/deployment-guides/index/">
|
||||
<div className="card">
|
||||
<h3>Deployment Guides</h3>
|
||||
<p>
|
||||
Deploy Hasura GraphQL Engine to a cloud provider of your choice using one of our guides. We have guides for AWS,
|
||||
GCP, Azure, DigitalOcean, and more.
|
||||
</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/deployment/deployment-guides/docker/">
|
||||
<div className="card">
|
||||
<h3>Self-hosted Docker</h3>
|
||||
<p>
|
||||
Not sure where to start? We have a guide to help you get up and running with Hasura GraphQL Engine on Docker,
|
||||
regardless of where you want to host.
|
||||
</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
</div>
|
@ -124,8 +124,8 @@ It's recommended to monitor resource usage patterns and vertically scale up the
|
||||
your workload, DB size etc. 4 CPUs with 8GB RAM is usually a good sweet spot to handle a wide variety of production
|
||||
workloads.
|
||||
|
||||
Horizontal **auto-scaling** can be set up based on CPU & memory. It's advisable to start with this, monitor it for a
|
||||
few days and see if there's a need to change based on your workload.
|
||||
Horizontal **auto-scaling** can be set up based on CPU & memory. It's advisable to start with this, monitor it for a few
|
||||
days and see if there's a need to change based on your workload.
|
||||
|
||||
However, you need to be aware of the total Postgres connections, too. The default `HASURA_GRAPHQL_PG_CONNECTIONS` value
|
||||
is `50`, meanwhile the default Postgres `max_connections` configuration is `100`. The Postgres server will easily be out
|
||||
@ -140,7 +140,7 @@ pg_max_connections >= hasura_nodes * hasura_pg_connections + event_nodes * event
|
||||
Observability tools help us track issues, alert us to errors, and allow us to monitor performance and hardware usage. It
|
||||
is critical in production. There are many open-source and commercial services. However, you may have to combine many
|
||||
tools because of the architectural complexity. For more information, check out our
|
||||
[observability section](/observability/index.mdx) and our
|
||||
[observability section](/observability/overview.mdx) and our
|
||||
[observability best practices](/deployment/best-practices/observability.mdx).
|
||||
|
||||
## Software architecture and best practices
|
||||
@ -198,7 +198,7 @@ Hardware has its limits. It's expensive to scale servers as well as optimize dat
|
||||
master-master replica, so it will be a bottleneck if you store all the data in one database. Therefore, you can divide
|
||||
your business logic into multiple smaller services, or microservices.
|
||||
|
||||
Hasura encourages microservices with [Remote Schemas](/remote-schemas/index.mdx). This can act as an API Gateway that
|
||||
Hasura encourages microservices with [Remote Schemas](/remote-schemas/overview.mdx). This can act as an API Gateway that
|
||||
routes to multiple, smaller GraphQL servers.
|
||||
|
||||
![hasura load-balancer](/img/deployment/hasura-microservices.png)
|
||||
|
@ -80,7 +80,7 @@ graphql-engine --database-url=<database-url> serve --enabled-apis=graphql
|
||||
By setting the above flag or env var, we are disabling the `metadata`, `pgdump` and `config` APIs. `health` and
|
||||
`version` APIs are public and cannot be disabled.
|
||||
|
||||
Read more about all the API types at the [API reference](/api-reference/index.mdx).
|
||||
Read more about all the API types at the [API reference](/api-reference/overview.mdx).
|
||||
|
||||
:::info Note
|
||||
|
||||
|
@ -25,8 +25,8 @@ access to your GraphQL endpoint and the Hasura Console:
|
||||
:::info Note
|
||||
|
||||
If you're looking at adding access control rules for your data to your GraphQL API then head to
|
||||
[Authentication / access control](/auth/index.mdx). You can also find more information about
|
||||
[Hasura security in general here](/security/index.mdx) and best practices
|
||||
[Authentication / access control](/auth/overview.mdx). You can also find more information about
|
||||
[Hasura security in general here](/security/overview.mdx) and best practices
|
||||
[here](/deployment/best-practices/security.mdx).
|
||||
|
||||
:::
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"label": "Hasura Enterprise",
|
||||
"label": "Hasura Enterprise 🏢",
|
||||
"position": 210,
|
||||
"className": "enterprise-icon"
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ Examples of `HASURA_GRAPHQL_REDIS_URL` and `HASURA_GRAPHQL_RATE_LIMIT_REDIS_URL`
|
||||
[Postgres permissions](/deployment/postgres-requirements.mdx#postgres-permissions).
|
||||
|
||||
- The `HASURA_GRAPHQL_ADMIN_SECRET` should never be passed from the client to the Hasura GraphQL Engine as it would give
|
||||
the client full admin rights to your Hasura instance. See [Authentication & Authorization](/auth/index.mdx) for
|
||||
the client full admin rights to your Hasura instance. See [Authentication & Authorization](/auth/overview.mdx) for
|
||||
information on setting up authentication.
|
||||
|
||||
- Convert confidential environment variables such as Postgres / Redis URLs, admin / metrics secrets to fetch from
|
||||
|
@ -68,7 +68,7 @@ graphql-engine:
|
||||
:::info Note
|
||||
|
||||
The `HASURA_GRAPHQL_ADMIN_SECRET` should never be passed from the client to the Hasura GraphQL Engine as it would give
|
||||
the client full admin rights to your Hasura instance. See [Authentication & Authorization](/auth/index.mdx) for
|
||||
the client full admin rights to your Hasura instance. See [Authentication & Authorization](/auth/overview.mdx) for
|
||||
information on setting up authentication.
|
||||
|
||||
:::
|
||||
|
@ -80,7 +80,7 @@ Examples of `HASURA_GRAPHQL_REDIS_URL` and `HASURA_GRAPHQL_RATE_LIMIT_REDIS_URL`
|
||||
[Postgres permissions](/deployment/postgres-requirements.mdx#postgres-permissions).
|
||||
|
||||
- The `HASURA_GRAPHQL_ADMIN_SECRET` should never be passed from the client to the Hasura GraphQL Engine as it would give
|
||||
the client full admin rights to your Hasura instance. See [Authentication & Authorization](/auth/index.mdx) for
|
||||
the client full admin rights to your Hasura instance. See [Authentication & Authorization](/auth/overview.mdx) for
|
||||
information on setting up authentication.
|
||||
|
||||
- Convert confidential environment variables such as Postgres / Redis URLs, admin / metrics secrets to fetch them from
|
||||
|
@ -86,7 +86,7 @@ Examples of `HASURA_GRAPHQL_REDIS_URL` and `HASURA_GRAPHQL_RATE_LIMIT_REDIS_URL`
|
||||
[Postgres permissions](/deployment/postgres-requirements.mdx#postgres-permissions).
|
||||
|
||||
- The `HASURA_GRAPHQL_ADMIN_SECRET` should never be passed from the client to the Hasura GraphQL Engine as it would give
|
||||
the client full admin rights to your Hasura instance. See [Authentication & Authorization](/auth/index.mdx) for
|
||||
the client full admin rights to your Hasura instance. See [Authentication & Authorization](/auth/overview.mdx) for
|
||||
information on setting up authentication.
|
||||
|
||||
- Move confidential environment variables such as Postgres / Redis URLs, admin / metrics secrets to fetch from
|
||||
|
@ -19,8 +19,8 @@ After following one of the Hasura EE get started guides:
|
||||
|
||||
- Head to `http://localhost:8080/console` to open the Hasura Console.
|
||||
- Log in using the admin secret key that you set.
|
||||
- Learn more about [connecting data sources](/databases/connect-db/index.mdx).
|
||||
- Check out the [Hasura Enterprise features](/enterprise/index.mdx).
|
||||
- Learn more about [connecting data sources](/databases/quickstart.mdx).
|
||||
- Check out the [Hasura Enterprise features](/enterprise/overview.mdx).
|
||||
|
||||
## Complete your production-readiness checklist (optional)
|
||||
|
||||
|
@ -1,48 +0,0 @@
|
||||
---
|
||||
sidebar_label: Hasura Enterprise (EE)
|
||||
description: Documentation for the Hasura Enterprise edition
|
||||
title: 'EE: Hasura Enterprise'
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- enterprise
|
||||
slug: index
|
||||
---
|
||||
|
||||
import Enterprise from '@site/static/icons/features/enterprise.svg';
|
||||
|
||||
# <Enterprise /> Hasura Enterprise
|
||||
|
||||
<div className="badge badge--primary heading-badge">Available on: Self-hosted Enterprise</div>
|
||||
|
||||
## Introduction
|
||||
|
||||
Hasura Enterprise Edition (EE) has built-in enterprise features for running Hasura in production. These features have
|
||||
key capabilities for observability, security and performance.
|
||||
|
||||
## Features
|
||||
|
||||
Hasura EE capabilities include all the features of the Hasura Open Source Community Edition plus:
|
||||
|
||||
- **Databases**
|
||||
- [Snowflake](/databases/snowflake/index.mdx)
|
||||
- [Amazon Athena](/databases/athena/index.mdx)
|
||||
- [MySQL](/databases/mysql/index.mdx)
|
||||
- **Performance**
|
||||
- [Caching](/enterprise/caching.mdx)
|
||||
- [Read Replicas](/databases/connect-db/read-replicas.mdx)
|
||||
- **Security**
|
||||
- [API Limiting](/security/api-limits.mdx)
|
||||
- [Role Based Allow List](/security/allow-list.mdx/#role-based-allow-list)
|
||||
- [Disable GraphQL Introspection](/security/disable-graphql-introspection.mdx)
|
||||
- [Multiple Admin Secrets](/security/multiple-admin-secrets.mdx)
|
||||
- [Multiple JWT Secrets](/security/multiple-jwt-secrets.mdx)
|
||||
- **Event Triggers**
|
||||
- [Auto Cleanup of Event Triggers](/event-triggers/clean-up/auto-cleanup.mdx)
|
||||
- **Observability**
|
||||
- [Logs](/deployment/logging.mdx)
|
||||
- [Metrics via Prometheus](/enterprise/metrics.mdx)
|
||||
- [Traces via OpenTelemetry](/enterprise/opentelemetry.mdx)
|
||||
|
||||
Hasura EE also has additional capabilities for SSO, tracing, and APM integrations. If you'd like to learn more, please
|
||||
[contact us](mailto:sales@hasura.io).
|
81
docs/docs/enterprise/overview.mdx
Normal file
81
docs/docs/enterprise/overview.mdx
Normal file
@ -0,0 +1,81 @@
|
||||
---
|
||||
description: Documentation for Hasura Enterprise Edition
|
||||
title: 'EE: Hasura Enterprise'
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- enterprise
|
||||
hide_table_of_contents: true
|
||||
sidebar_position: 1
|
||||
sidebar_label: Overview
|
||||
---
|
||||
|
||||
import Thumbnail from '@site/src/components/Thumbnail';
|
||||
import VersionedLink from '@site/src/components/VersionedLink';
|
||||
import Enterprise from '@site/static/icons/features/enterprise.svg';
|
||||
|
||||
# <Enterprise /> Hasura Enterprise
|
||||
|
||||
<div className="badge badge--primary heading-badge" style={{ marginBottom: `1rem` }}>
|
||||
Available on: Self-hosted Enterprise
|
||||
</div>
|
||||
|
||||
<div className="overview-header">
|
||||
<div className="overview-text">
|
||||
<p>
|
||||
The open-source version of Hasura is highly capable, but Hasura Enterprise Edition (EE) has additional built-in
|
||||
features for running Hasura in production on your own infrastructure. These features have key capabilities for observability, security,
|
||||
and performance.
|
||||
</p>
|
||||
<p>
|
||||
Hasura Enterprise Edition is available as a self-hosted product with support from the Hasura team. You can deploy
|
||||
the Hasura Enterprise Edition on your own infrastructure, or on a cloud provider of your choice.
|
||||
</p>
|
||||
<p>
|
||||
If you'd like to learn more, please <a href="mailto:sales@hasura.io">contact us</a>.
|
||||
</p>
|
||||
<h4>Quick Links</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<VersionedLink to="/enterprise/getting-started/quickstart-docker">
|
||||
Quickstart with Docker.
|
||||
</VersionedLink>
|
||||
</li>
|
||||
<li>
|
||||
<VersionedLink to="/enterprise/upgrade-ce-to-ee/">
|
||||
Upgrade from Hasura CE to Hasura Enterprise.
|
||||
</VersionedLink>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<iframe
|
||||
src="https://www.youtube.com/embed/QE3mTzE9a3o"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen
|
||||
/>
|
||||
</div>
|
||||
|
||||
## Using Hasura Enterprise Edition
|
||||
|
||||
<div className="overview-gallery">
|
||||
<VersionedLink to="/enterprise/getting-started/quickstart-aws-ecs/">
|
||||
<div className="card">
|
||||
<h3>Quickstart with AWS ECS</h3>
|
||||
<p>Learn how to deploy Hasura Enterprise Edition on AWS ECS.</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/enterprise/caching/">
|
||||
<div className="card">
|
||||
<h3>GraphQL Caching</h3>
|
||||
<p>Learn how to enable GraphQL caching in Hasura Enterprise Edition to supercharge performance.</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/enterprise/metrics/">
|
||||
<div className="card">
|
||||
<h3>Configure Prometheus</h3>
|
||||
<p>Learn how to configure Prometheus in Hasura Enterprise Edition to monitor your GraphQL API.</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
</div>
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
sidebar_label: Auto cleanup
|
||||
sidebar_label: Auto cleanup ☁️🏢
|
||||
description: Cleanup Event Trigger logs for Hasura Cloud/Enterprise Edition
|
||||
title: 'Auto cleanup of Event Trigger logs'
|
||||
keywords:
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
sidebar_label: Create an Event Trigger
|
||||
sidebar_position: 1
|
||||
sidebar_position: 1.5
|
||||
description: Create an Event Trigger with Hasura
|
||||
keywords:
|
||||
- hasura
|
||||
@ -20,6 +20,21 @@ import Thumbnail from '@site/src/components/Thumbnail';
|
||||
Event Triggers can be created using the Hasura Console, Hasura CLI, or Metadata APIs. Currently, support for event
|
||||
triggers exists for Postgres and MSSQL databases.
|
||||
|
||||
:::info Note
|
||||
|
||||
- Event Triggers are supported for **Postgres and MS SQL Server** databases.
|
||||
- Event webhook notifications will be delivered at least once, and may arrive out of order with respect to the
|
||||
underlying event.
|
||||
|
||||
:::
|
||||
|
||||
:::caution Caveat on different Hasura instances connected to the same database
|
||||
|
||||
Event Triggers store their data in the underlying database and hence different instances acting on the same data can
|
||||
cause undefined behavior during run-time. This should not be a problem if the Hasura instances have the same metadata.
|
||||
|
||||
:::
|
||||
|
||||
## Creating triggers
|
||||
|
||||
<Tabs groupId="user-preference" className="api-tabs">
|
||||
|
@ -1,59 +0,0 @@
|
||||
---
|
||||
description: Manage Event Triggers with Hasura
|
||||
title: Event Triggers
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- event trigger
|
||||
slug: index
|
||||
---
|
||||
|
||||
import Thumbnail from '@site/src/components/Thumbnail';
|
||||
import EventTriggers from '@site/static/icons/features/event_triggers.svg';
|
||||
|
||||
# <EventTriggers /> Event Triggers
|
||||
|
||||
## Introduction
|
||||
|
||||
Hasura can be used to create Event Triggers on tables in the database. Event Triggers reliably capture events on
|
||||
specified tables and invoke HTTP webhooks to carry out any custom logic.
|
||||
|
||||
<Thumbnail
|
||||
src="/img/event-triggers/data-triggers-arch.png"
|
||||
alt="Hasura Event Trigger architecture"
|
||||
width="900px"
|
||||
className="no-shadow"
|
||||
/>
|
||||
|
||||
Events can be of the following types:
|
||||
|
||||
- INSERT: When a row is inserted into a table
|
||||
- UPDATE: When a row is updated in a table
|
||||
- DELETE: When a row is deleted from a table
|
||||
- MANUAL: Using the Console or API, an event can be triggered manually on a row
|
||||
|
||||
:::info Note
|
||||
|
||||
- Event Triggers are supported for **Postgres and MS SQL Server** databases.
|
||||
- Event webhook notifications will be delivered at least once, and may arrive out of order with respect to the
|
||||
underlying event.
|
||||
|
||||
:::
|
||||
|
||||
:::caution Caveat on different Hasura instances connected to the same database
|
||||
|
||||
Event Triggers store their data in the underlying database and hence different instances acting on the same data can
|
||||
cause undefined behavior during run-time. This should not be a problem if the Hasura instances have the same metadata.
|
||||
|
||||
:::
|
||||
|
||||
## Learn more
|
||||
|
||||
- [Creating an Event Trigger](/event-triggers/create-trigger.mdx)
|
||||
- [Event Trigger payload](/event-triggers/payload.mdx)
|
||||
- [REST Connectors for Event Triggers](/event-triggers/rest-connectors.mdx)
|
||||
- [Invoke trigger manually](/event-triggers/invoke-trigger-manually.mdx)
|
||||
- [Using serverless functions](/event-triggers/serverless.mdx)
|
||||
- [Event Trigger samples](/event-triggers/samples.mdx)
|
||||
- [Clean up event data](/event-triggers/clean-up/index.mdx)
|
||||
- [Remove Event Triggers](/event-triggers/remove-event-triggers.mdx)
|
72
docs/docs/event-triggers/overview.mdx
Normal file
72
docs/docs/event-triggers/overview.mdx
Normal file
@ -0,0 +1,72 @@
|
||||
---
|
||||
description: Hasura Event Triggers
|
||||
title: Overview
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- event triggers
|
||||
hide_table_of_contents: true
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
import VersionedLink from '@site/src/components/VersionedLink';
|
||||
import EventTriggers from '@site/static/icons/features/event_triggers.svg';
|
||||
import Thumbnail from '@site/src/components/Thumbnail';
|
||||
|
||||
# <EventTriggers /> Event Triggers
|
||||
|
||||
<div className="overview-header">
|
||||
<div className="overview-text">
|
||||
<p>
|
||||
Hasura Event triggers are a way to automate asynchronous logic when changes are made in a connected database.
|
||||
</p>
|
||||
<p>
|
||||
Event Triggers can be configured to activate when there is an <code>INSERT</code>, <code>UPDATE</code> or
|
||||
<code>DELETE</code> event in a table.
|
||||
Additionally, you can manually trigger an event through a button set up in the Hasura Console.
|
||||
</p>
|
||||
<h4>Quick Links</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<VersionedLink to="/event-triggers/quickstart">Quickstart with Event Triggers.</VersionedLink>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<iframe
|
||||
src="https://www.youtube.com/embed/9vZeQ5tHiQo"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Thumbnail
|
||||
className="no-shadow overview-img"
|
||||
src="/img/event-triggers/data-triggers-arch.png"
|
||||
alt="Hasura Event Trigger architecture"
|
||||
width="100%"
|
||||
/>
|
||||
|
||||
## Event Trigger Links
|
||||
|
||||
<div className="overview-gallery">
|
||||
<VersionedLink to="/event-triggers/payload/">
|
||||
<div className="card">
|
||||
<h3>Payload structure</h3>
|
||||
<p>Check out the format and structure of the request payload.</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/event-triggers/serverless/">
|
||||
<div className="card">
|
||||
<h3>Call a serverless endpoint</h3>
|
||||
<p>Call serverless functions with Event Triggers to not have to manage any dedicated infrastructure.</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/event-triggers/invoke-trigger-manually/">
|
||||
<div className="card">
|
||||
<h3>Invoke a trigger manually</h3>
|
||||
<p>Optionally set an Event Trigger to be invoked with a button in the Console.</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
</div>
|
77
docs/docs/event-triggers/quickstart.mdx
Normal file
77
docs/docs/event-triggers/quickstart.mdx
Normal file
@ -0,0 +1,77 @@
|
||||
---
|
||||
description: Quickstart with Event Triggers
|
||||
title: Quickstart
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- event triggers
|
||||
sidebar_position: 1.3
|
||||
---
|
||||
|
||||
import Thumbnail from '@site/src/components/Thumbnail';
|
||||
import SampleAppBlock from '@site/src/components/SampleAppBlock';
|
||||
|
||||
# Quickstart Event Triggers
|
||||
|
||||
Let's imagine that we want to send a welcome email to every new user who signs up. We can do this by creating an Event
|
||||
Trigger that calls out to a webhook whenever a new user is inserted into the `users` table. The webhook payload will
|
||||
contain the user's email address, and we can use this in the endpoint which we create to send them the welcome email.
|
||||
|
||||
<SampleAppBlock />
|
||||
|
||||
## Step 1: Navigate to Event Triggers {#step-2}
|
||||
|
||||
To create an Event Trigger, navigate to the `Event` tab in the Console and click the `Create` button while on the
|
||||
`Event Triggers` tab in the left navigation.
|
||||
|
||||
<Thumbnail src="/img/event-triggers/event-triggers_main-screen_2-19-0.png" alt="Click create for new Action" />
|
||||
|
||||
## Step 2: Create a new Event Trigger {#step-3}
|
||||
|
||||
On the Event Trigger creation page, input the name of the trigger, `send_welcome_email`, and select the database, schema
|
||||
and table that the trigger will be listening to. In this case we'll be listening to the `users` table for an INSERT
|
||||
event.
|
||||
|
||||
For the endpoint to call when the event is triggered, we'll use the `https://httpbin.org/post` endpoint. This is a demo
|
||||
endpoint which will just return a `200` success status code and the data that we initially sent it.
|
||||
|
||||
For now, ignore `Auto-cleanup Event Logs`, `Advanced Settings` and `Configure REST Connectors`.
|
||||
|
||||
Click `Create Event Trigger` to create the Event Trigger.
|
||||
|
||||
<Thumbnail src="/img/event-triggers/event-triggers_create-event-trigger_2-19-0.png" alt="Click create for new Action" />
|
||||
|
||||
## Step 3: Test the Event Trigger {#step-4}
|
||||
|
||||
Now that we've created the Event Trigger, let's test it out by inserting a new user into the `users` table. To do this,
|
||||
navigate to the `Data` tab in the Console and click the `Insert Row` tab in the `users` table. Insert some dummy data
|
||||
and click `Save`.
|
||||
|
||||
<Thumbnail
|
||||
src="/img/event-triggers/event-triggers_insert-user-dummy-data_2-19-0.png"
|
||||
alt="Click create for new Action"
|
||||
/>
|
||||
|
||||
## Step 4: Check the Event Logs {#step-5}
|
||||
|
||||
Navigate back to the `send_welcome_email` Event Trigger and click the `Processed Events` tab. You should see a new log
|
||||
showing a successfully delivered event as it received a `200` status code as the response. You can inspect the `Request`
|
||||
and `Response` tabs to see exactly what data was sent to and received from the `httpbin.org` endpoint.
|
||||
|
||||
<Thumbnail src="/img/event-triggers/event-triggers_processed-events_2-19-0.png" alt="Click create for new Action" />
|
||||
|
||||
## Recap
|
||||
|
||||
What just happened? Congrats! You just called a remote endpoint asynchronously when something happened in your database
|
||||
and your user (theoretically) received a welcome email. 🎉
|
||||
|
||||
In a real world scenario, you would create a custom endpoint to send the welcome email, but in this example we showed
|
||||
you just the mechanics of how to create an Event Trigger and test it out.
|
||||
|
||||
You can enable your Event Triggers for any table and event type, INSERT, UPDATE or DELETE, and you can also enable the
|
||||
[manual invocation of your Event Trigger via a button in the Console](/event-triggers/invoke-trigger-manually.mdx).
|
||||
|
||||
You can also thoroughly customize your Event Triggers to your needs using the
|
||||
[`Retry Configuration`](/event-triggers/create-trigger.mdx/#retry-logic),
|
||||
[`Advanced Settings`](/event-triggers/create-trigger.mdx#advanced-settings) and
|
||||
[`Configure REST Connectors`](/event-triggers/rest-connectors.mdx) options.
|
@ -37,7 +37,7 @@ import FAQ from '@site/static/icons/features/faq.svg';
|
||||
|
||||
## What databases does Hasura support? {#faq-db}
|
||||
|
||||
Check out the list of [compatible databases](/databases/index.mdx#supported-databases).
|
||||
Check out the list of [compatible databases](/databases/overview.mdx).
|
||||
|
||||
## How does Hasura work? {#faq-how-hasura-works}
|
||||
|
||||
@ -69,7 +69,7 @@ The easiest and fastest way to get Hasura up and running quickly is by using our
|
||||
## What does my first-time demo experience look like?
|
||||
|
||||
Using the Hasura Console, click on the Data tab and connect up a new Postgres database from our partner company
|
||||
[Neon](/databases/connect-db/cloud-databases/neon.mdx). Then create tables, insert some demo data and test out some
|
||||
[Neon](/databases/postgres/neon.mdx). Then create tables, insert some demo data and test out some
|
||||
queries and mutations using the GraphiQL interface in the API tab. Alternatively, from your connected database in the
|
||||
Data tab, try one of our demo templates from the Template Gallery which can demonstrate key Hasura features for you
|
||||
quickly. If you already have an existing database with tables and data you can also just have Hasura connect to it,
|
||||
@ -82,9 +82,9 @@ popularity due to its unique features, benefits and advantages over REST APIs an
|
||||
|
||||
As opposed to multiple disparate endpoints with REST APIs, GraphQL uses one `POST`-enabled endpoint which can service
|
||||
many types of data requests from the client. Queries, mutations and subscriptions are made with a simple and intuitive
|
||||
syntax which describes the shape of the resulting data, so you know exactly what you're getting back. This
|
||||
declarative syntax makes it easier to understand and reason about the code and allows for more complex, nested, joined,
|
||||
queries to be written in a simple, clear and concise way.
|
||||
syntax which describes the shape of the resulting data, so you know exactly what you're getting back. This declarative
|
||||
syntax makes it easier to understand and reason about the code and allows for more complex, nested, joined, queries to
|
||||
be written in a simple, clear and concise way.
|
||||
|
||||
GraphQL allows developers to retrieve only the data they need and nothing more, resolving problems with over and
|
||||
under-fetching. This can lead to faster and more efficient performance and reduced network traffic.
|
||||
@ -96,8 +96,8 @@ GraphQL has a thriving ecosystem of libraries, tools, and services that make it
|
||||
things like code generators, testing frameworks, and middleware.
|
||||
|
||||
Overall, GraphQL is a powerful tool for building APIs that are flexible, efficient, and easy to use. Its popularity
|
||||
continues to grow, and it is likely to become an increasingly important part of more developers and businesses
|
||||
toolkits in the coming years.
|
||||
continues to grow, and it is likely to become an increasingly important part of more developers and businesses toolkits
|
||||
in the coming years.
|
||||
|
||||
## How do I manage my database once it's connected to Hasura?
|
||||
|
||||
@ -134,15 +134,16 @@ or a similar CI/CD service to build a custom deployment pipeline for your Hasura
|
||||
|
||||
## How can I preview changes to my Hasura instance?
|
||||
|
||||
With [Preview Apps](/hasura-cloud/ci-cd/preview-apps.mdx) on Hasura Cloud you can automatically create an app on
|
||||
Hasura Cloud for every pull request you make to your GitHub repo enabling quick and easy testing of changes as you work.
|
||||
With [Preview Apps](/hasura-cloud/ci-cd/preview-apps.mdx) on Hasura Cloud you can automatically create an app on Hasura
|
||||
Cloud for every pull request you make to your GitHub repo enabling quick and easy testing of changes as you work.
|
||||
|
||||
## How would I work collaboratively with my team using Hasura?
|
||||
|
||||
Using [Projects](/hasura-cloud/projects/index.mdx) in Hasura Cloud you are able to add collaborators and assign each different access
|
||||
permissions on your instance. Since the Hasura [Metadata and Migrations](/migrations-metadata-seeds/index.mdx) can be
|
||||
committed to version control, you can also use the user permissions systems of a version control host (eg: GitHub) in
|
||||
order to control how your team collaborates on your Hasura Project.
|
||||
Using [Projects](/hasura-cloud/projects/index.mdx) in Hasura Cloud you are able to add collaborators and assign each
|
||||
different access permissions on your instance. Since the Hasura
|
||||
[Metadata and Migrations](/migrations-metadata-seeds/overview.mdx) can be committed to version control, you can also use
|
||||
the user permissions systems of a version control host (eg: GitHub) in order to control how your team collaborates on
|
||||
your Hasura Project.
|
||||
|
||||
## How do I connect business logic or extend the GraphQL schema? {#faq-business-logic}
|
||||
|
||||
@ -156,7 +157,7 @@ the GraphQL schema that Hasura exposes. This is useful not just when you have le
|
||||
transactional or application logic, but also when you want to build and serve custom logic with cloud-native code
|
||||
deployed as containers or serverless functions.
|
||||
|
||||
- Read more about [Hasura Actions](/actions/index.mdx).
|
||||
- Read more about [Hasura Actions](/actions/overview.mdx).
|
||||
|
||||
### Hasura Event Triggers:
|
||||
|
||||
@ -166,7 +167,7 @@ pieces of logic to events, this is especially useful if you’re thinking about
|
||||
applications.
|
||||
|
||||
- Read more about this architecture at [https://3factor.app](https://3factor.app).
|
||||
- Read more about Event Triggers in the Hasura [docs](/event-triggers/index.mdx).
|
||||
- Read more about Event Triggers in the Hasura [docs](/event-triggers/overview.mdx).
|
||||
- Go through a quick tutorial on how to set Event Triggers up at [https://learn.hasura.io](https://learn.hasura.io).
|
||||
|
||||
### GraphQL APIs via Hasura Remote Schemas:
|
||||
@ -176,7 +177,7 @@ custom logic, or if you’d like to extend your overall GraphQL API with a “su
|
||||
may not directly own, you can use “Remote Schemas” in Hasura to bring in GraphQL services as data & logic providers to
|
||||
your GraphQL API.
|
||||
|
||||
- Read more about [Remote Schemas](/remote-schemas/index.mdx).
|
||||
- Read more about [Remote Schemas](/remote-schemas/overview.mdx).
|
||||
|
||||
### Stored procedures / functions in the database:
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
---
|
||||
sidebar_label: Quickstart with Hasura using Docker
|
||||
title: 'Quickstart with Docker'
|
||||
sidebar_position: 3
|
||||
description: Get started with Hasura using Docker
|
||||
keywords:
|
||||
@ -103,17 +104,17 @@ CRUD GraphQL API for our Postgres database which we could then easily query, mut
|
||||
|
||||
The Hasura CLI is a powerful tool that helps you manage your Hasura project and is recommended for the majority of
|
||||
development workflows. It helps track and manage your
|
||||
[Hasura Metadata and Migrations](/migrations-metadata-seeds/index.mdx) and commit them to version control and allows you
|
||||
to quickly move between environments like development and production.
|
||||
[Hasura Metadata and Migrations](/migrations-metadata-seeds/overview.mdx) and commit them to version control and allows
|
||||
you to quickly move between environments like development and production.
|
||||
|
||||
### Database operations
|
||||
|
||||
We omitted the CLI steps in this guide for the sake of simplicity and brevity, but in a typical new project, you would
|
||||
always include the CLI setup steps.
|
||||
|
||||
Every developer working with Hasura should have the Hasura CLI installed. You can do so by
|
||||
[following this guide](/hasura-cli/install-hasura-cli.mdx) and learn more by checking out our
|
||||
[Advanced Hasura course](https://hasura.io/learn/graphql/hasura-advanced/introduction/).
|
||||
Every developer working with Hasura should have the [Hasura CLI installed](/hasura-cli/install-hasura-cli.mdx). You can
|
||||
quickly get up and running with a new project [using the CLI quickstart](/hasura-cli/quickstart.mdx) and learn more by
|
||||
checking out our [Advanced Hasura course](https://hasura.io/learn/graphql/hasura-advanced/introduction/).
|
||||
|
||||
:::
|
||||
|
||||
@ -124,14 +125,14 @@ Every developer working with Hasura should have the Hasura CLI installed. You ca
|
||||
|
||||
- There are several options for the implementation of business logic, depending on your use case.
|
||||
|
||||
- [Actions](/actions/index.mdx): Actions can be used if you'd like to extend your GraphQL schema by integrating with a
|
||||
REST endpoint.
|
||||
- [Remote Schemas](/remote-schemas/index.mdx): If you have an existing GraphQL server or if you're comfortable with
|
||||
- [Actions](/actions/overview.mdx): Actions can be used if you'd like to extend your GraphQL schema by integrating
|
||||
with a REST endpoint.
|
||||
- [Remote Schemas](/remote-schemas/overview.mdx): If you have an existing GraphQL server or if you're comfortable with
|
||||
implementing one, you can use Remote Schemas.
|
||||
- [Event Triggers](/event-triggers/index.mdx): To trigger a serverless function based on a database event, use Event
|
||||
Triggers.
|
||||
- [Scheduled Triggers](/scheduled-triggers/index.mdx): Scheduled Triggers are used to execute custom business logic at
|
||||
specific points in time.
|
||||
- [Event Triggers](/event-triggers/overview.mdx): To trigger a serverless function based on a database event, use
|
||||
Event Triggers.
|
||||
- [Scheduled Triggers](/scheduled-triggers/overview.mdx): Scheduled Triggers are used to execute custom business logic
|
||||
at specific points in time.
|
||||
|
||||
- If you're new to database modeling, check out these guides:
|
||||
|
||||
@ -140,16 +141,9 @@ Every developer working with Hasura should have the Hasura CLI installed. You ca
|
||||
- [Querying data](/queries/postgres/index.mdx): Use GraphQL queries to query data from your GraphQL API.
|
||||
- [Inserting data](/mutations/postgres/index.mdx): Use GraphQL mutations to insert data into your GraphQL API.
|
||||
|
||||
- **Security Announcements**: Join the [Hasura Security Announcements](https://groups.google.com/forum/#!forum/hasura-security-announce) group for
|
||||
emails about security announcements.
|
||||
|
||||
- **Security Announcements**: Join the
|
||||
[Hasura Security Announcements](https://groups.google.com/forum/#!forum/hasura-security-announce) group for emails
|
||||
about security announcements.
|
||||
|
||||
- We release new features every month. Sign up for our newsletter by using the link below. We send newsletters only once
|
||||
a month. <https://hasura.io/newsletter/>.
|
||||
|
||||
:::info Additional Resources
|
||||
|
||||
Get Started with Hasura today -
|
||||
[Watch video guide](https://hasura.io/events/webinar/get-started-with-hasura/?pg=docs&plcmt=body&cta=getting-started&tech=).
|
||||
|
||||
:::
|
||||
|
@ -1,13 +1,13 @@
|
||||
---
|
||||
description: Quickstart with Hasura Cloud
|
||||
title: 'Cloud: Quickstart with Hasura Cloud'
|
||||
title: 'Quickstart with Hasura Cloud'
|
||||
sidebar_position: 2
|
||||
keywords:
|
||||
- hasura
|
||||
- cloud
|
||||
- docs
|
||||
- signup
|
||||
sidebar_label: Quickstart with Hasura Cloud
|
||||
sidebar_label: Quickstart with Hasura Cloud ☁️
|
||||
sidebar_class_name: cloud-icon
|
||||
---
|
||||
|
||||
@ -68,28 +68,8 @@ Click `Connect Database`.
|
||||
|
||||
<Thumbnail src="/img/getting-started/connect-db-cloud.png" alt="Enter URL for existing database" width="1000px" />
|
||||
|
||||
If your database is hosted via any of the following managed cloud database services, check out their respective detailed
|
||||
guides to get the database connection URL and any other steps required to ensure connectivity from Hasura Cloud:
|
||||
|
||||
- [Aiven Postgres](/databases/connect-db/cloud-databases/aiven.mdx)
|
||||
- [AlloyDB Postgres](/databases/connect-db/cloud-databases/alloy.mdx)
|
||||
- [AWS RDS Aurora Postgres](/databases/connect-db/cloud-databases/aws-aurora.mdx)
|
||||
- [AWS RDS Postgres](/databases/connect-db/cloud-databases/aws-postgres.mdx)
|
||||
- [Azure Cosmos DB](/databases/connect-db/cloud-databases/azure-cosmos.mdx)
|
||||
- [Azure MS SQL](/databases/connect-db/cloud-databases/mssql.mdx)
|
||||
- [Azure Postgres](/databases/connect-db/cloud-databases/azure.mdx)
|
||||
- [Crunchy Postgres](/databases/connect-db/cloud-databases/crunchy.mdx)
|
||||
- [DigitalOcean Postgres](/databases/connect-db/cloud-databases/digital-ocean.mdx)
|
||||
- [ElephantSQL Postgres](/databases/connect-db/cloud-databases/elephant.mdx)
|
||||
- [EnterpriseDB (BigAnimal) Postgres](/databases/connect-db/cloud-databases/enterprisedb.mdx)
|
||||
- [GCP Postgres](/databases/connect-db/cloud-databases/gcp.mdx)
|
||||
- [Heroku Postgres](/databases/connect-db/cloud-databases/heroku.mdx)
|
||||
- [Neon Postgres](/databases/connect-db/cloud-databases/neon.mdx)
|
||||
- [Railway Postgres](/databases/connect-db/cloud-databases/railway.mdx)
|
||||
- [Render Postgres](/databases/connect-db/cloud-databases/render.mdx)
|
||||
- [Supabase Postgres](/databases/connect-db/cloud-databases/supabase.mdx)
|
||||
- [TimescaleDB Cloud](/databases/connect-db/cloud-databases/timescale-cloud.mdx)
|
||||
- [YugabyteDB](/databases/connect-db/cloud-databases/yugabyte.mdx)
|
||||
Check out our [extensive list of databases](/databases/overview.mdx) that Hasura Cloud supports in order to get the
|
||||
database connection URL and for other steps required to ensure connectivity from Hasura Cloud.
|
||||
|
||||
## Step 4: Try out Hasura
|
||||
|
||||
@ -142,22 +122,24 @@ For a full hands-on tour of Hasura, check out our
|
||||
|
||||
### Database operations
|
||||
|
||||
- [Databases overview](/databases/overview.mdx)
|
||||
- [Database modeling](/schema/postgres/index.mdx): Learn how to model your database schema, as well as how to extend it.
|
||||
- [Querying data](/queries/postgres/index.mdx): Use GraphQL queries to query data from your GraphQL API.
|
||||
- [Inserting data](/mutations/postgres/index.mdx): Use GraphQL mutations to insert data into your GraphQL API.
|
||||
- [Postgres permissions](/deployment/postgres-requirements.mdx#managed-pg-permissions)
|
||||
|
||||
### Business logic
|
||||
|
||||
There are several options for the implementation of business logic, depending on your use case.
|
||||
|
||||
- [Actions](/actions/index.mdx): Actions can be used if you'd like to extend your GraphQL schema by integrating with a
|
||||
REST endpoint.
|
||||
- [Remote Schemas](/remote-schemas/index.mdx): If you have an existing GraphQL server or if you're comfortable with
|
||||
- [Actions](/actions/overview.mdx): Actions can be used if you'd like to extend your GraphQL schema by integrating with
|
||||
a REST endpoint.
|
||||
- [Remote Schemas](/remote-schemas/overview.mdx): If you have an existing GraphQL server or if you're comfortable with
|
||||
implementing one, you can use Remote Schemas.
|
||||
- [Event Triggers](/event-triggers/index.mdx): To trigger a serverless function based on a database event, use event
|
||||
- [Event Triggers](/event-triggers/overview.mdx): To trigger a serverless function based on a database event, use event
|
||||
triggers.
|
||||
- [Scheduled Triggers](/scheduled-triggers/index.mdx): Scheduled Triggers are used to execute custom business logic at
|
||||
specific points in time.
|
||||
- [Scheduled Triggers](/scheduled-triggers/overview.mdx): Scheduled Triggers are used to execute custom business logic
|
||||
at specific points in time.
|
||||
|
||||
### Manage Hasura Cloud project
|
||||
|
||||
@ -166,13 +148,3 @@ You can click the gear icon in the Hasura Cloud dashboard to manage your Hasura
|
||||
[custom domains](/hasura-cloud/projects/domains.mdx)).
|
||||
|
||||
<Thumbnail src="/img/getting-started/project-manage.png" alt="Project actions" width="860px" />
|
||||
|
||||
:::info Additional Resources
|
||||
|
||||
Get Started with Hasura today -
|
||||
[Watch video guide](https://hasura.io/events/webinar/get-started-with-hasura/?pg=docs&plcmt=body&cta=getting-started&tech=).
|
||||
|
||||
:::
|
||||
|
||||
- [Cloud databases guides](/databases/connect-db/cloud-databases/index.mdx)
|
||||
- [Postgres permissions](/deployment/postgres-requirements.mdx#managed-pg-permissions)
|
||||
|
@ -23,7 +23,7 @@ engine for powering your API.
|
||||
Given a database, the Hasura GraphQL Engine automatically generates a GraphQL schema and processes GraphQL queries,
|
||||
subscriptions and mutations.
|
||||
|
||||
By default, Hasura supports [PostgreSQL and multiple other databases](/databases/index.mdx#supported-databases).
|
||||
By default, Hasura supports [PostgreSQL and multiple other databases](/databases/overview.mdx).
|
||||
|
||||
## Tracking Tables & Schema Generation
|
||||
|
||||
@ -53,7 +53,7 @@ When you track a table in the Hasura GraphQL Engine, it automatically generates
|
||||
|
||||
## Views
|
||||
|
||||
When you track a view with a [database which supports views](/databases/index.mdx#schema) in Hasura GraphQL Engine,
|
||||
When you track a view with a [database which supports views](/databases/feature-support.mdx) in Hasura GraphQL Engine,
|
||||
it also automatically generates the same as the above but without the `_by_pk` fields. Depending on the type of
|
||||
view created, Hasura may not generate the `insert`, `update` and `delete` mutation fields.
|
||||
|
||||
|
@ -1,67 +0,0 @@
|
||||
---
|
||||
title: Get started
|
||||
description: Get started with Hasura
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- start
|
||||
- core
|
||||
- cloud
|
||||
- get started
|
||||
slug: index
|
||||
---
|
||||
|
||||
import HeadingIcon from '@site/src/components/HeadingIcon';
|
||||
import Basics from '@site/static/icons/features/basics.svg';
|
||||
|
||||
# <Basics /> Get Started
|
||||
|
||||
## Introduction
|
||||
|
||||
To use the Hasura GraphQL Engine, you'll need to:
|
||||
|
||||
- Deploy the Hasura GraphQL Engine, with access to a Postgres database to store its metadata.
|
||||
- Connect new/existing database(s) and set up and test your GraphQL API using the Hasura Console UI (also possible via
|
||||
CLI or API).
|
||||
- Consume the generated GraphQL API from your client apps.
|
||||
|
||||
You have a couple of options when getting started.
|
||||
|
||||
### Hasura Cloud
|
||||
|
||||
[Hasura Cloud](https://cloud.hasura.io) is the preferred choice when getting started. Hasura Cloud is a hosted service
|
||||
for Hasura GraphQL Engine projects with added features for reliability and security. If you're looking for the least
|
||||
friction between trying out Hasura and moving into production,
|
||||
[check out this quickstart guide](/getting-started/getting-started-cloud.mdx) and **get started for free**.
|
||||
|
||||
### Docker Compose
|
||||
|
||||
Alternatively, if you'd like to get a local version up and running that you can eventually deploy to a host of your
|
||||
choice, [check out our quickstart using Docker Compose](/getting-started/docker-simple.mdx). At its heart, Hasura is
|
||||
open-source and within minutes you'll have a fully functional Hasura GraphQL Engine instance running locally with which
|
||||
you can experiment. If you're looking to learn more about Hasura GraphQL Engine's core features and see if it's right
|
||||
for you, consider this option.
|
||||
|
||||
### Supported databases
|
||||
|
||||
Regardless of which option above you choose, Hasura GraphQL Engine supports:
|
||||
|
||||
- [Postgres](/databases/postgres/index.mdx)
|
||||
- [MS SQL Server](/databases/ms-sql-server/index.mdx)
|
||||
- [Citus / Hyperscale](/databases/postgres/citus-hyperscale-postgres/index.mdx)
|
||||
- [BigQuery](/databases/bigquery/index.mdx)
|
||||
- [Snowflake](/databases/snowflake/index.mdx)
|
||||
- [Amazon Athena](/databases/athena/index.mdx)
|
||||
- [MySQL Alpha](/databases/mysql/index.mdx)
|
||||
|
||||
<!-- Remove the admonition below? -->
|
||||
|
||||
:::info Additional Resources
|
||||
|
||||
Get Started with Hasura today -
|
||||
[Watch video guide](https://hasura.io/events/webinar/get-started-with-hasura/?pg=docs&plcmt=body&cta=getting-started&tech=).
|
||||
|
||||
Additionally, check out our [Hasura Basics](https://hasura.io/learn/graphql/hasura/introduction/) course for a
|
||||
step-by-step deep dive!
|
||||
|
||||
:::
|
49
docs/docs/getting-started/overview.mdx
Normal file
49
docs/docs/getting-started/overview.mdx
Normal file
@ -0,0 +1,49 @@
|
||||
---
|
||||
description: Get started with Hasura
|
||||
title: Overview
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- get started
|
||||
- docker
|
||||
- cloud
|
||||
hide_table_of_contents: true
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
import Thumbnail from '@site/src/components/Thumbnail';
|
||||
import VersionedLink from '@site/src/components/VersionedLink';
|
||||
import Basics from '@site/static/icons/features/basics.svg';
|
||||
|
||||
# <Basics /> Getting Started with Hasura
|
||||
|
||||
<div className="overview-header">
|
||||
<div className="overview-text">
|
||||
<p>
|
||||
The Hasura GraphQL Engine is a blazingly-fast GraphQL server that gives you instant, real-time GraphQL APIs over many popular databases and other data sources.
|
||||
|
||||
|
||||
You can quickly get started with Hasura by using <a href="https://cloud.hasura.io">Hasura Cloud</a>, our hosted platform, or by running
|
||||
it on your own infrastructure.
|
||||
</p>
|
||||
<h4>Quick Links</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<VersionedLink to="/getting-started/getting-started-cloud">Get started using Hasura Cloud.</VersionedLink>
|
||||
</li>
|
||||
<li>
|
||||
Get started using <VersionedLink to="/getting-started/docker-simple">Docker</VersionedLink> or check out one of our <VersionedLink to="/deployment/deployment-guides/index">deployment guides.</VersionedLink>
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
To learn more about the functionalities of Hasura, check out <VersionedLink to="/getting-started/how-it-works/index/">how it works</VersionedLink>.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<iframe
|
||||
src="https://www.youtube.com/embed/XDGw-uQKTOc"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen
|
||||
/>
|
||||
</div>
|
@ -10,7 +10,7 @@ keywords:
|
||||
- public
|
||||
- graphQL
|
||||
- graphiQL
|
||||
sidebar_label: GraphQL API Explorer
|
||||
sidebar_label: GraphQL API Explorer ☁️
|
||||
sidebar_position: 240
|
||||
sidebar_class_name: cloud-icon
|
||||
# adding index slug in case this root doc becomes a directory later
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"label": "Commands",
|
||||
"position": 2
|
||||
"position": 3
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ When using the Hasura CLI, you'll pass various values to different commands. The
|
||||
|
||||
:::info Note
|
||||
|
||||
The order of precedence by which the CLI processes these values is flag -> environment variables -> `.env` file
|
||||
values -> configuration file values -> default.
|
||||
The order of precedence by which the CLI processes these values is flag -> environment variables -> `.env` file values
|
||||
-> configuration file values -> default.
|
||||
|
||||
In the sections below, we'll explain how to configure the CLI for each of these use cases.
|
||||
|
||||
@ -103,8 +103,8 @@ defaults to `.env` if you don't provide it.
|
||||
|
||||
It's important to note that this will not override an environment variable that already exists.
|
||||
|
||||
As an example, the command below will read environment variables from the `production.env` file present at the
|
||||
project's root directory.
|
||||
As an example, the command below will read environment variables from the `production.env` file present at the project's
|
||||
root directory.
|
||||
|
||||
```bash
|
||||
hasura console --envfile production.env
|
||||
@ -130,11 +130,11 @@ the CLI:
|
||||
| `HASURA_GRAPHQL_ACCESS_KEY` | `access_key` | Access key for Hasura GraphQL Engine. Note: Deprecated. Use admin secret instead. |
|
||||
| `HASURA_GRAPHQL_INSECURE_SKIP_TLS_VERIFY` | `insecure_skip_tls_verify` | Skip verifying SSL certificate for the Hasura endpoint. Useful if you have a self-singed certificate and don't have access to the CA cert. |
|
||||
| `HASURA_GRAPHQL_CERTIFICATE_AUTHORITY` | `certificate_authority` | Path to the CA certificate for validating the self-signed certificate for the Hasura endpoint. |
|
||||
| `HASURA_GRAPHQL_API_PATHS_QUERY` | `api_paths.query` | Schema/ Metadata API endpoint. More details at [Schema / Metadata API (Deprecated)](/api-reference/index.mdx#schema-metadata-api). |
|
||||
| `HASURA_GRAPHQL_API_PATHS_GRAPHQL` | `api_paths.graphql` | GraphQL API endpoint. More details at [GraphQL API](/api-reference/index.mdx#graphql-api). |
|
||||
| `HASURA_GRAPHQL_API_PATHS_CONFIG` | `api_paths.config` | Config API endpoint. More details at [Config API](/api-reference/index.mdx#config-api)`. |
|
||||
| `HASURA_GRAPHQL_API_PATHS_PG_DUMP` | `api_paths.pg_dump` | PG Dump API endpoint. More details at [pg_dump API](/api-reference/index.mdx#pg-dump-api). |
|
||||
| `HASURA_GRAPHQL_API_PATHS_VERSION` | `api_paths.version` | Version API endpoint. More details at [RESTified GraphQL API](/api-reference/index.mdx#version-api). |
|
||||
| `HASURA_GRAPHQL_API_PATHS_QUERY` | `api_paths.query` | Schema/ Metadata API endpoint. More details at [Schema / Metadata API (Deprecated)](/api-reference/overview.mdx#schema-metadata-api). |
|
||||
| `HASURA_GRAPHQL_API_PATHS_GRAPHQL` | `api_paths.graphql` | GraphQL API endpoint. More details at [GraphQL API](/api-reference/overview.mdx#graphql-api). |
|
||||
| `HASURA_GRAPHQL_API_PATHS_CONFIG` | `api_paths.config` | Config API endpoint. More details at [Config API](/api-reference/overview.mdx#config-api)`. |
|
||||
| `HASURA_GRAPHQL_API_PATHS_PG_DUMP` | `api_paths.pg_dump` | PG Dump API endpoint. More details at [pg_dump API](/api-reference/overview.mdx#pg-dump-api). |
|
||||
| `HASURA_GRAPHQL_API_PATHS_VERSION` | `api_paths.version` | Version API endpoint. More details at [RESTified GraphQL API](/api-reference/overview.mdx#version-api). |
|
||||
| `HASURA_GRAPHQL_METADATA_DIRECTORY` | `metadata_directory` | Defines the directory where the Metadata files were stored. |
|
||||
| `HASURA_GRAPHQL_MIGRATIONS_DIRECTORY` | `migrations_directory` | Defines the directory where the migration files were stored. |
|
||||
| `HASURA_GRAPHQL_SEEDS_DIRECTORY` | `seeds_directory` | Defines the directory where the seed files were stored. |
|
||||
|
@ -1,51 +0,0 @@
|
||||
---
|
||||
title: Hasura CLI
|
||||
description: Use Hasura's command line tooling
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- CLI
|
||||
slug: index
|
||||
---
|
||||
|
||||
import CLI from '@site/static/icons/features/cli.svg';
|
||||
|
||||
# <CLI /> Hasura CLI
|
||||
|
||||
## Introduction
|
||||
|
||||
The Hasura CLI is a command-line tool you can use to manage your Hasura instances.
|
||||
|
||||
We offer two primary methods for working with your Hasura instances: the Hasura Console and the Hasura CLI. While the
|
||||
Console is robust and provides an easy-to-navigate GUI for interacting with your project, the CLI offers a more powerful
|
||||
interface for managing your project.
|
||||
|
||||
The CLI is useful for:
|
||||
|
||||
- [managing Metadata](/migrations-metadata-seeds/manage-metadata.mdx).
|
||||
- [creating and applying Migrations](/migrations-metadata-seeds/manage-migrations.mdx).
|
||||
- integrating with your CI/CD pipeline.
|
||||
- automating tasks.
|
||||
|
||||
You can use the CLI to initialize a new Hasura Project from the very beginning, or you can use it to manage an
|
||||
existing one.
|
||||
|
||||
## Installation
|
||||
|
||||
Install the Hasura CLI by executing the following command in your terminal:
|
||||
|
||||
```bash
|
||||
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash
|
||||
```
|
||||
|
||||
For more details, check out our [installation guide](/hasura-cli/install-hasura-cli.mdx).
|
||||
|
||||
## Usage
|
||||
|
||||
The CLI has a number of commands you can use to manage your project. You can see the full list of commands by running:
|
||||
`hasura --help`.
|
||||
|
||||
There are many subcommands too; you can see the available subcommands and their arguments by running a command with the
|
||||
`--help` flag, for example: `hasura metadata --help`.
|
||||
|
||||
After installing, we suggest getting started by heading to the [CLI commands reference](/hasura-cli/commands/index.mdx).
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
sidebar_label: Install / Uninstall
|
||||
sidebar_position: 1
|
||||
sidebar_position: 3
|
||||
description: Install the Hasura CLI on Linux, Mac OS, Windows
|
||||
keywords:
|
||||
- hasura
|
||||
@ -80,7 +80,7 @@ curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | VERSION
|
||||
Download the binary `cli-hasura-windows-amd64.exe` available under `Assets` of the latest release from the GitHub
|
||||
release page :
|
||||
|
||||
<Link to='https://github.com/hasura/graphql-engine/releases'>https://github.com/hasura/graphql-engine/releases</Link>
|
||||
<Link to="https://github.com/hasura/graphql-engine/releases">https://github.com/hasura/graphql-engine/releases</Link>
|
||||
|
||||
Rename the downloaded file to `hasura`. You can add the path to the environment variable `PATH` for making `hasura`
|
||||
accessible globally.
|
||||
@ -98,7 +98,8 @@ To add command auto-completion in your shell, refer to the
|
||||
### Install through npm
|
||||
|
||||
The Hasura CLI is available as an [npm package](https://www.npmjs.com/package/hasura-cli) which wraps the compiled
|
||||
binary and is **independently maintained by members of the community. Hasura does not offer maintenance or support for this package**.
|
||||
binary and is **independently maintained by members of the community. Hasura does not offer maintenance or support for
|
||||
this package**.
|
||||
|
||||
## Uninstall the Hasura CLI
|
||||
|
||||
|
77
docs/docs/hasura-cli/overview.mdx
Normal file
77
docs/docs/hasura-cli/overview.mdx
Normal file
@ -0,0 +1,77 @@
|
||||
---
|
||||
title: Hasura CLI
|
||||
description: Use Hasura's command line tooling
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- CLI
|
||||
hide_table_of_contents: true
|
||||
sidebar_position: 1
|
||||
sidebar_label: Overview
|
||||
---
|
||||
|
||||
import Thumbnail from '@site/src/components/Thumbnail';
|
||||
import VersionedLink from '@site/src/components/VersionedLink';
|
||||
import CLI from '@site/static/icons/features/cli.svg';
|
||||
|
||||
# <CLI /> Hasura CLI
|
||||
|
||||
<div className="overview-header">
|
||||
<div className="overview-text">
|
||||
<p>
|
||||
We offer two primary methods for working with your Hasura instances: the Hasura Console and the Hasura CLI. While
|
||||
the Console provides an easy-to-use GUI for interacting with your project, the CLI offers a powerful, text-based
|
||||
interface for managing your project.
|
||||
</p>
|
||||
<p>
|
||||
The Hasura CLI is a command line tool that acts as an interface to the Hasura GraphQL Engine's Metadata API,
|
||||
providing a set of commands that you can use to create, migrate, and manage your Hasura projects.
|
||||
</p>
|
||||
<h4>Quick Links</h4>
|
||||
<ul>
|
||||
<li>
|
||||
<VersionedLink to="/hasura-cli/quickstart/">Create a project with the Hasura CLI in 60 seconds.</VersionedLink>
|
||||
</li>
|
||||
<li>
|
||||
<VersionedLink to="/hasura-cli/commands/index/">View all the available commands.</VersionedLink>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<iframe
|
||||
src="https://www.youtube.com/embed/MnYhMZBSY-A"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen
|
||||
/>
|
||||
</div>
|
||||
|
||||
## Using the CLI
|
||||
|
||||
<div className="overview-gallery">
|
||||
<VersionedLink to="/hasura-cli/install-hasura-cli/">
|
||||
<div className="card">
|
||||
<h3>Install the Hasura CLI</h3>
|
||||
<p>Learn how to install the Hasura CLI using the binaries or a package manager.</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/hasura-cli/commands/hasura_console/">
|
||||
<div className="card">
|
||||
<h3>
|
||||
The <code>hasura console</code> command
|
||||
</h3>
|
||||
<p>
|
||||
Learn how to use the <code>hasura console</code> command to launch the Hasura Console via the CLI and track
|
||||
Metadata changes.
|
||||
</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
<VersionedLink to="/hasura-cli/config-reference/">
|
||||
<div className="card">
|
||||
<h3>Configure the CLI</h3>
|
||||
<p>
|
||||
Learn how to configure the Hasura CLI to connect to your Hasura instance and to use the Hasura CLI with multiple
|
||||
projects.
|
||||
</p>
|
||||
</div>
|
||||
</VersionedLink>
|
||||
</div>
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"label": "Hasura Pro CLI",
|
||||
"position": 20
|
||||
"position": 5
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ keywords:
|
||||
- docs
|
||||
- command line interface
|
||||
- cli
|
||||
sidebar_label: Hasura Pro CLI
|
||||
sidebar_label: Hasura Pro CLI ☁️
|
||||
sidebar_class_name: cloud-icon
|
||||
---
|
||||
|
||||
|
@ -14,7 +14,7 @@ sidebar_position: 2
|
||||
|
||||
## Install the Hasura Pro CLI plugin
|
||||
|
||||
The Hasura Pro CLI is distributed as a plugin to the [Hasura CLI](/hasura-cli/index.mdx).
|
||||
The Hasura Pro CLI is distributed as a plugin to the [Hasura CLI](/hasura-cli/overview.mdx).
|
||||
|
||||
:::warning Note
|
||||
|
||||
|
280
docs/docs/hasura-cli/quickstart.mdx
Normal file
280
docs/docs/hasura-cli/quickstart.mdx
Normal file
@ -0,0 +1,280 @@
|
||||
---
|
||||
description: Create a new project, manage Metadata, apply Migrations and more with the Hasura CLI
|
||||
keywords:
|
||||
- hasura
|
||||
- docs
|
||||
- CLI
|
||||
- getting started
|
||||
- quickstart
|
||||
sidebar_label: Quickstart
|
||||
sidebar_position: 2
|
||||
toc_max_heading_level: 2
|
||||
---
|
||||
|
||||
import Thumbnail from '@site/src/components/Thumbnail';
|
||||
|
||||
# Quickstart Hasura CLI
|
||||
|
||||
The Hasura CLI is a command line tool that helps you create a new project, manage Metadata, apply Migrations, and more.
|
||||
In this guide, we will create a new project using the Hasura CLI. We will also see how to add a data source, track
|
||||
tables, and deploy the project to another environment.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before continuing, please make sure you have the following:
|
||||
|
||||
- [The Hasura CLI](/hasura-cli/install-hasura-cli.mdx) installed
|
||||
- [Docker](https://docs.docker.com/get-docker/) installed and running
|
||||
|
||||
## Step 1: Init the local project
|
||||
|
||||
Let's create a new project locally called `cli-demo`:
|
||||
|
||||
```bash
|
||||
hasura init cli-demo
|
||||
```
|
||||
|
||||
This will create a new directory called `cli-demo` with the following structure:
|
||||
|
||||
```bash
|
||||
cli-demo
|
||||
├── config.yaml
|
||||
├── migrations
|
||||
├── metadata
|
||||
├── seeds
|
||||
```
|
||||
|
||||
:::info What if I already have a project?
|
||||
|
||||
If you followed our [Quickstart with Docker](/getting-started/docker-simple.mdx), you'll already have a local project.
|
||||
In that case, in the project's directory, you can run the following command to initialize the current directory as a
|
||||
Hasura project:
|
||||
|
||||
```bash
|
||||
hasura init .
|
||||
```
|
||||
|
||||
Then, [skip to step 3](#step-3-run-the-hasura-console).
|
||||
|
||||
:::
|
||||
|
||||
## Step 2: Get the docker compose file and start the containers
|
||||
|
||||
The `docker-compose.yaml` file contains the configuration for the Hasura GraphQL Engine and a Postgres database. If you
|
||||
haven't yet followed our [getting started guide for Docker](/getting-started/docker-simple.mdx), inside the `cli-demo`
|
||||
directory, run:
|
||||
|
||||
```bash
|
||||
curl https://raw.githubusercontent.com/hasura/graphql-engine/master/install-manifests/docker-compose/docker-compose.yaml > docker-compose.yaml
|
||||
```
|
||||
|
||||
<div id="pg-admonition">
|
||||
|
||||
:::info Why does the docker-compose.yaml file contain the Postgres container?
|
||||
|
||||
Curious? [Read this](#why-do-i-need-to-include-the-postgres-container-in-the-docker-composeyaml-file) in the recap to
|
||||
find out why.
|
||||
|
||||
:::
|
||||
|
||||
</div>
|
||||
|
||||
Now, start the containers:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
## Step 3: Run the Hasura Console
|
||||
|
||||
If you've followed our [simple getting started guide for Docker](/getting-started/docker-simple.mdx), you'll already be
|
||||
familiar with the Hasura Console. However, the way we access the Console is slightly different when using the Hasura
|
||||
CLI. Instead of opening your browser and navigating to `http://localhost:8080/console`, we'll use the Hasura CLI to open
|
||||
the Console in our browser. In the directory containing your project, run:
|
||||
|
||||
```bash
|
||||
hasura console
|
||||
```
|
||||
|
||||
<div id="console-admonition">
|
||||
|
||||
:::info Why are we opening the Console from the CLI?
|
||||
|
||||
Curious? [Read this](#why-are-we-opening-the-console-from-the-cli) in the recap to find out why.
|
||||
|
||||
:::
|
||||
|
||||
</div>
|
||||
|
||||
## Step 4: Add a data source
|
||||
|
||||
Now that we have the Hasura Console open, let's add a data source. Click on the `Data` tab in the top navigation bar.
|
||||
Our `docker-compose.yaml` file already contains the `PG_DATABASE_URL` environment variable which is set equal to a
|
||||
connection string for the local Postgres database running in a container:
|
||||
|
||||
```yaml
|
||||
PG_DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
|
||||
```
|
||||
|
||||
We'll enter the name `default` for the ` Database Display Name` field. This name is used to identify the data source in
|
||||
Hasura's Metadata and is not your database's name. Should you choose to use the `HASURA_GRAPHQL_DATABASE_URL`
|
||||
environment variable instead, `default` is the default name assigned to your data source by Hasura.
|
||||
|
||||
Next, we'll choose `Environment Variable` from the `Connect Database Via` options; enter `PG_DATABASE_URL` as the name:
|
||||
|
||||
<Thumbnail src="/img/cli/cli_getting-started-add-data-source_2.2.png" alt="Add a data source" width="1000px" />
|
||||
|
||||
This will add the local Postgres database running in a container as a data source. Later, we'll see that we can use the
|
||||
same environment variable - with different values - to connect to a different database on either our staging or
|
||||
production environments.
|
||||
|
||||
Click `Connect Database`.
|
||||
|
||||
<div id="string-admonition">
|
||||
|
||||
:::info Why aren't we just pasting in a connection string?
|
||||
|
||||
Curious? [Read this](#why-arent-we-just-pasting-in-a-connection-string) in the recap to find out why.
|
||||
|
||||
:::
|
||||
|
||||
</div>
|
||||
|
||||
## Step 5: Add some data and track the tables
|
||||
|
||||
Now that we have a data source, let's add some data and track the tables. From the `Data` tab, click the `SQL` option on
|
||||
the left-hand navigation. If you already have some seed data, you can paste it in the editor. Otherwise, you can use the
|
||||
SQL below this image to create a table called `users` and insert some data:
|
||||
|
||||
<Thumbnail src="/img/cli/cli_getting-started-add-seed-data_2.2.png" alt="Add seed data" width="1000px" />
|
||||
|
||||
```sql
|
||||
CREATE TABLE users (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
email TEXT NOT NULL UNIQUE
|
||||
);
|
||||
|
||||
INSERT INTO users (name, email) VALUES ('John', 'john.doe@hasura.io');
|
||||
INSERT INTO users (name, email) VALUES ('Jane', 'jane.doe@hasura.io');
|
||||
```
|
||||
|
||||
After pasting the seed data, check the `Track this` and `This is a migration` boxes before clicking the `Run` button.
|
||||
This will create the `users` table, insert the data, and track the table in the Metadata. Optionally, you can include a
|
||||
name (in our example, `add_users`) for the Migration, which the GraphQL Engine appends to the end of the Migration's
|
||||
version number. This is useful if you're working on a team and want to keep track of the changes you're making.
|
||||
|
||||
If we navigate to our `Data` tab, we'll see that the `users` table has been added to the `Tables` section:
|
||||
|
||||
<Thumbnail src="/img/cli/cli_getting-started-new-users_2.2.png" alt="Add seed data" width="1000px" />
|
||||
|
||||
Additionally, if we look inside our `migrations` directory, we'll see that a new Migration - complete with `up` and
|
||||
`down` sql files - has been created with a timestamped version number and our name for the Migration:
|
||||
|
||||
```bash
|
||||
cli-demo
|
||||
├── config.yaml
|
||||
├── migrations
|
||||
│ └── 1675957424387_add_users
|
||||
│ ├── down.sql
|
||||
│ └── up.sql
|
||||
├── metadata
|
||||
├── seeds
|
||||
```
|
||||
|
||||
## Step 6: Init a new git repository
|
||||
|
||||
While this is a basic example, we've achieved a lot in just a few steps. Let's commit our changes to Git so we can
|
||||
deploy our project to another environment.
|
||||
|
||||
```bash
|
||||
git init
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
```
|
||||
|
||||
With our repository initialized, we can now deploy our project to another environment. Depending on where you're
|
||||
deploying to, you'll need to use a different method. You can pick up right where we've left off in the next section.
|
||||
|
||||
## Step 7: Deploy to another environment
|
||||
|
||||
If you're deploying to Hasura Cloud, you can use the Hasura CLI or our
|
||||
[GitHub integration](/hasura-cloud/ci-cd/github-integration.mdx). If you're deploying to a different environment, you'll
|
||||
need to use the Hasura CLI.
|
||||
|
||||
### Deploy to Hasura Cloud
|
||||
|
||||
If you're deploying to Hasura Cloud, you can use the Hasura CLI or the GitHub integration. We recommend the latter as
|
||||
it's an easier way to deploy your project and allows you the benefits of version control. If you're using the GitHub
|
||||
integration, you'll need to push your changes to a GitHub repository.
|
||||
|
||||
**Picking up from the previous section, we'll push our changes to GitHub**:
|
||||
|
||||
```bash
|
||||
git remote add origin <your-git-repo-url>
|
||||
git branch -M main
|
||||
git push -u origin main
|
||||
```
|
||||
|
||||
From here, you can follow the instructions in the
|
||||
[GitHub integration guide](/hasura-cloud/ci-cd/github-integration.mdx#initial-setup) to deploy your project to Hasura
|
||||
Cloud. With this connection in place, you can iterate and develop your project locally - and then push your changes to
|
||||
GitHub to deploy to Hasura Cloud 🎉
|
||||
|
||||
Head down to the [recap section](#recap) to learn more about some of the design decisions we made in this guide.
|
||||
|
||||
:::info Curious about testing your changes?
|
||||
|
||||
Hasura Cloud can be used as a staging or production environment. If you're curious about testing your project in a
|
||||
staging environment, consider our [Preview Apps](/hasura-cloud/ci-cd/preview-apps.mdx) feature.
|
||||
|
||||
:::
|
||||
|
||||
### Deploy to a hosted environment
|
||||
|
||||
If you're deploying to a provider other than Hasura Cloud, you can use your own CI/CD pipeline or the Hasura CLI.
|
||||
Assuming you have a Hasura instance running, you can use the following command to deploy your project:
|
||||
|
||||
```bash
|
||||
hasura deploy --endpoint http://your-other-instance.com --admin-secret your-admin-secret
|
||||
```
|
||||
|
||||
This command will will apply the local changes of your Metadata and Migrations to the remote Hasura instance running at
|
||||
`http://your-other-instance.com` using the `your-admin-secret` as the admin secret.
|
||||
|
||||
## Recap
|
||||
|
||||
What did you just do? Well, in just a few steps, you've created a new local project, added a data source, and deployed
|
||||
your project to another environment! 🎉
|
||||
|
||||
If you're curious about why we did some of the things we did, read on for some answers to common questions.
|
||||
|
||||
### Why do I need to include the Postgres container in the docker-compose.yaml file?
|
||||
|
||||
If you're not using a Postgres database as one of your data sources, you'll still need to include the Postgres container
|
||||
in the `docker-compose.yaml` file. This is because the Hasura GraphQL Engine requires a Postgres database to store its
|
||||
Metadata. [Click here to head back up to Step 2](#pg-admonition).
|
||||
|
||||
### Why are we opening the Console from the CLI?
|
||||
|
||||
So that the Metadata and Migrations are tracked in the local project directory, we need to use the Hasura CLI to open
|
||||
the Console. The Console served directly by the Hasura GraphQL Engine in Docker will not track any changes to the
|
||||
Metadata or Migrations. [Click here to head back up to Step 3](#console-admonition).
|
||||
|
||||
### Why aren't we just pasting in a connection string?
|
||||
|
||||
The Hasura CLI allows you to manage your project using
|
||||
[environment variables](/deployment/graphql-engine-flags/reference.mdx). This means that you can use the same project
|
||||
directory on different environments and not have to worry about updating different values in your CI/CD pipeline. This
|
||||
is ideal for iterating on your database's schema and data locally before deploying to another environment (e.g., staging
|
||||
or production).
|
||||
|
||||
If we were to paste in a connection string, we'd have to change that value - to match the database used by an
|
||||
environment - every time we wanted to deploy our project to a different environment.
|
||||
|
||||
Hasura Cloud does not host databases. If you don't already have a database hosted somewhere, take a look at our list of
|
||||
[cloud databases](/databases/overview.mdx) to quickly get started.
|
||||
|
||||
Additionally, it's a security vulnerability to store connection strings in version control. These values are safer in an
|
||||
`.env` file or the environment variables wherever your project is deployed.
|
||||
[Click here to head back up to Step 4](#string-admonition).
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"label": "Hasura Cloud",
|
||||
"position": 200
|
||||
"label": "Hasura Cloud ☁️",
|
||||
"position": 200,
|
||||
"className": "cloud-icon"
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"label": "Account management",
|
||||
"label": "Account management ☁️",
|
||||
"position": 30,
|
||||
"className": "cloud-icon"
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"label": "Billing",
|
||||
"label": "Billing ☁️",
|
||||
"position": 20,
|
||||
"className": "cloud-icon"
|
||||
}
|
||||
|
@ -25,9 +25,9 @@ Hasura Cloud projects are billed based on the amount of data that passes through
|
||||
the operations that are performed by you, your apps, or your clients.
|
||||
|
||||
The data pass-through is calculated by analyzing the logs that are sent from your project. All data transfer from Hasura
|
||||
Cloud to external networks - such as your database server, external webhooks for [Actions](/actions/index.mdx),
|
||||
[Event Triggers](/event-triggers/index.mdx), [Scheduled Triggers](/scheduled-triggers/index.mdx) or your
|
||||
[Remote Schema](/remote-schemas/index.mdx) - is accounted for in Hasura Cloud billing.
|
||||
Cloud to external networks - such as your database server, external webhooks for [Actions](/actions/overview.mdx),
|
||||
[Event Triggers](/event-triggers/overview.mdx), [Scheduled Triggers](/scheduled-triggers/overview.mdx) or your
|
||||
[Remote Schema](/remote-schemas/overview.mdx) - is accounted for in Hasura Cloud billing.
|
||||
|
||||
We account for the following types of logs in Hasura Cloud data pass-through:
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user