Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2c810e9
fix(docs): update version (#331)
skrdgraph Oct 20, 2022
4ba1c95
[Docs] Access Control Lists : add the command and random keys (#333)
Rajakavitha1 Oct 27, 2022
4096ae4
[Docs] Encryption at Rest: added a note for macOS (#334)
Rajakavitha1 Oct 27, 2022
d01e2ed
docs(release): Dgraph v22.0.0 release (#335)
MichelDiz Oct 31, 2022
b05f66c
Cherry pick/v22.0/glossary (#364)
rderbier Dec 14, 2022
004bba5
Cherry pick/v22.0/glossary update (#387)
rderbier Jan 13, 2023
5e9f635
Merge branch 'release/v22.0'
rderbier Jan 17, 2023
3fa1a02
Revamp(install) : merge to v22.0 (#409)
rderbier Jan 18, 2023
ce08046
change build script for branches (#425)
rderbier Jan 27, 2023
84c8c49
Algolia/v22.0 (#427)
rderbier Jan 30, 2023
3804b5c
Algolia/v22.0 (#429)
rderbier Jan 31, 2023
b91145a
Algolia/v22.0 (#430)
rderbier Jan 31, 2023
fae5fb3
Algolia/v22.0 (#431)
rderbier Jan 31, 2023
43b6bbc
remove graphql overview and references (#433)
rderbier Feb 1, 2023
6cda032
remove graphql overview and references (#434)
rderbier Feb 1, 2023
b95fd77
add v22.0.2 (#435)
rderbier Feb 1, 2023
97665b4
Revamp/import data (#437)
rderbier Feb 1, 2023
d43480f
Dgraph overview diagram (#438)
rderbier Feb 1, 2023
034c80b
upgrade hugo version to 0.91 (#443)
rderbier Feb 2, 2023
568aaa9
Docs(Lambda): Fix incorrect environment variable example (#449)
matthewmcneely Feb 10, 2023
15c3c6f
move type-system (#452)
rderbier Feb 13, 2023
68de9f6
[REVAMP]: move predicate types (ex schema) to DQL section (#454)
rderbier Feb 14, 2023
5a3f415
Revamp/howto drop data (#451)
rderbier Feb 14, 2023
a9ee580
Revamp/mutation syntax (#459)
rderbier Feb 14, 2023
399de45
revamp doc home (#463)
rderbier Feb 14, 2023
84068c6
Delete .hugo_build.lock
rderbier Feb 14, 2023
e992f39
ignore lock files
rderbier Feb 14, 2023
86d1133
graphql quickstart (#465)
rderbier Feb 15, 2023
4717578
avoid conflicts with cloud doc urls
rderbier Feb 15, 2023
a9c8f4c
re-organize graphql section (#466)
rderbier Feb 15, 2023
bc84b61
correct api ref
rderbier Feb 15, 2023
67a437d
move cloud pages in this repo (#468)
rderbier Feb 16, 2023
e8dbca7
move cloud folder
rderbier Feb 16, 2023
4071053
gqlschema section update (#471)
rderbier Feb 16, 2023
b095c41
Split info from the predicate page (#473)
rderbier Feb 16, 2023
9d6ee1f
avoid conflict with cloud site
rderbier Feb 17, 2023
6c0232f
Merge branch 'main' into revamp/cloud-section
rderbier Feb 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ aliases = ["/contribute"]
</div>
<div class="item">
<div class="icon"><i class="lni lni-cloud" aria-hidden="true"></i></div>
<a href="{{< relref "/cloud">}}">
<a href="{{< relref "/dgraphcloud">}}">
<h2>Dgraph Cloud</h2>
<p>
Run Dgraph in the Cloud.
Expand Down
85 changes: 85 additions & 0 deletions content/dgraphcloud/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
+++
title = "Dgraph Cloud"
[menu.main]
identifier = "cloud"
weight = 9
+++

<div class="landing">
<div class="hero">
<h1></h1>
<p>
Dgraph Cloud gives you the power of Dgraph database with the convenience of a fully-managed service.
</p>
<p>To learn more about Dgraph, see <a href="{{< relref "dgraph-overview.md">}}">Dgraph Database Overview</a>.</p>
<img class="hero-deco" src="images/hero-deco.png" />
</div>
<div class="item">
<div class="icon"><i class="lni lni-play" aria-hidden="true"></i></div>
<a href="{{< relref "cloud-quick-start.md">}}">
<h2>Dgraph Cloud Quick Start</h2>
<p>
Get started with a simple "to-do" list app built on Dgraph Cloud
</p>
</a>
</div>
<div class="item">
<div class="icon"><i class="lni lni-rocket" aria-hidden="true"></i></div>
<a href="{{< relref "advanced-queries.md">}}">
<h2>Advanced Queries with DQL</h2>
<p>
Generate advanced queries to interact with your database using the HTTP or gRPC endpoint
</p>
</a>
</div>
<div class="item">
<div class="icon"><i class="lni lni-package" aria-hidden="true"></i></div>
<a href="{{< relref "cloud-api/overview.md">}}">
<h2>Dgraph Cloud API</h2>
<p>
Programmatically launch and manage your Cloud backups.
</p>
</a>
</div>

<div class="item">
<div class="icon"><i class="lni lni-shield" aria-hidden="true"></i></div>
<a href="{{< relref "security.md">}}">
<h2>Secure Your Endpoint</h2>
<p>
Tips for securing your Dgraph Cloud backend
</p>
</a>
</div>
<div class="item">
<div class="icon"><i class="lni lni-cogs" aria-hidden="true"></i></div>
<a href="{{< relref "migrating-from-hosted-dgraph.md">}}">
<h2>Migrate from Self-Managed Dgraph</h2>
<p>
Easily migrate your app's existing Dgraph backend to Dgraph Cloud
</p>
</a>
</div>
<div class="item">
<div class="icon"><i class="lni lni-control-panel" aria-hidden="true"></i></div>
<a href="{{< relref "admin/_index.md">}}">
<h2>Administer Your Backend</h2>
<p>
Programmatically set and update your schema, import or export your data, and switch or clone your Dgraph Cloud backend
</p>
</a>
</div>

</div>

<style>
ul.contents {
display: none;
}
</style>

You might also be interested in:

- [Dgraph GraphQL Schema Reference](https://dgraph.io/docs/graphql/schema/schema-overview), which lists all the types and directives supported by Dgraph
- [Dgraph GraphQL API Reference](https://dgraph.io/docs/graphql/api/api-overview), which serves as a guide to using your new `/graphql` endpoint

7 changes: 7 additions & 0 deletions content/dgraphcloud/admin/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
+++
title = "Administering Your Backend"
weight = 15
[menu.main]
identifier = "cloud-admin"
parent = "cloud"
+++
31 changes: 31 additions & 0 deletions content/dgraphcloud/admin/authentication.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
+++
title = "Authentication"
weight = 2
[menu.main]
parent = "cloud-admin"
+++

Administrating your Dgraph Cloud using the `/query`, `/mutate`, `/commit`, `/admin`, `/admin/slash`, or `/alter` endpoints on Dgraph Cloud. Also, bypassing Anonymous Access restrictions on the `/graphql` endpoint requires an API key. You can generate a new API key from Dgraph Cloud by selecting the ["Settings" button](https://cloud.dgraph.io/_/settings) from the sidebar, and then clicking the **Add API Key** button. Keep your API key safe, it will not be accessible once you leave the page.

![Dgraph Cloud: Add an API Key](/images/cloud-4.png)

There are two types of API keys: *client* and *admin*.

- **Client API keys** can only be used to perform query, mutation, and commit operations.
- **Admin API keys** can be used to perform both client operations and admin operations like drop data, destroy backend, and update schema.

{{% notice "note" %}}
Either Client API keys or Admin API keys can be used to bypass [Anonymous Access](/security) restrictions.
{{% /notice %}}

![Dgraph Cloud: Select API Key Role](/images/cloud-5.png)
<br>
<br>
All admin API requests must be authenticated by passing the API key as the 'Dg-Auth' header to every HTTP request. You can verify that your API key works by using the following HTTP example.

```
curl 'https://<your-backend>/admin' \
-H 'Dg-Auth: <your-api-key>' \
-H 'Content-Type: application/json' \
--data-binary '{"query":"{ getGQLSchema { schema } }"}'
```
12 changes: 12 additions & 0 deletions content/dgraphcloud/admin/clone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
+++
title = "Cloning Backend"
weight = 7
[menu.main]
parent = "cloud-admin"
+++

Cloning a backend allows making a copy of an existing backend. The clone will be created with all the data and schema of the original backend present at the time of cloning. The clone will have its own endpoint and will be independent of the original backend once it is created. Any further changes in either backends will not reflect in the other. Currently, a clone can only be created in the same zone as that of the original backend.

In order to clone your backend, click on the <kbd>Clone Backend</kbd> button under the [Settings](https://cloud.dgraph.io/_/settings) tab in the dashboard's sidebar.

You can also perform the restore operation on an existing backend if you have an unused backend or want to reuse an existing endpoint. But note that the restore operation will drop all the existing data along with schema on the current backend and replace it with the original backend's data and schema.
36 changes: 36 additions & 0 deletions content/dgraphcloud/admin/drop-data.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
+++
title = "Dropping Data from your Backend"
weight = 5
[menu.main]
parent = "cloud-admin"
+++

It is possible to drop all data from your Dgraph Cloud backend, and start afresh while retaining the same endpoint. Be careful, as this operation is not reversible, and all data will be lost. It is highly recommended that you [export](/admin/import-export) your data before you drop your data.

In order to drop all data while retaining the schema, click the <kbd>Drop Data</kbd> button under the [Schema](https://cloud.dgraph.io/_/schema) tab in the sidebar.

![Drop Data](/images/drop-data.png)

### Dropping Data Programmatically

In order to do this, call the `dropData` mutation on `/admin/slash`. As an example, if your GraphQL endpoint is `https://frozen-mango.us-west-2.aws.cloud.dgraph.io/graphql`, then the admin endpoint for schema will be at `https://frozen-mango.us-west-2.aws.cloud.dgraph.io/admin/slash`.

Please note that this endpoint requires [Authentication](/admin/authentication).

Please see the following curl as an example.

```
curl 'https://<your-backend>/admin/slash' \
-H 'X-Auth-Token: <your-token>' \
-H 'Content-Type: application/graphql' \
--data-binary 'mutation { dropData(allData: true) { response { code message } } }'
```

If you would like to drop the schema along with the data, then you can set the `allDataAndSchema` flag.

```
curl 'https://<your-backend>/admin/slash' \
-H 'X-Auth-Token: <your-token>' \
-H 'Content-Type: application/graphql' \
--data-binary 'mutation { dropData(allDataAndSchema: true) { response { code message } } }'
```
156 changes: 156 additions & 0 deletions content/dgraphcloud/admin/import-export.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
+++
title = "Importing and Exporting data from Dgraph Cloud"
weight = 4
[menu.main]
parent = "cloud-admin"
+++

You can export your data from one Dgraph Cloud backend, and then import this data back into another Dgraph instance or Dgraph Cloud Backend.

## Exporting Data

You can export your data using JSON format. To do this, call the `export` mutation on `/admin/slash`. As an example, if your GraphQL endpoint is at `https://frozen-mango.us-west-2.aws.cloud.dgraph.io/graphql`, then the `/admin` endpoint for the schema is at `https://frozen-mango.us-west-2.aws.cloud.dgraph.io/admin/slash`.

{{% notice "note" %}}
The `/admin/slash` endpoint requires [Authentication](/admin/authentication).
{{% /notice %}}

The following is an example of a GraphQL mutation to export data to JSON.

```graphql
mutation {
export {
response { code message }
exportId
taskId
}
}
```
Make sure to keep your `exportId` and `taskId` safe as you will need them for getting the signed URLs in order to download your export files. These URLs will be returned in the `signedUrls` output field and **they expire after 48 hours**.

Export will usually return 3 files:
* `g01.gql_schema.gz`: The GraphQL schema file. This file can be re-imported via the [Schema APIs](/admin/schema)
* `g01.json.gz`: the data from your instance, which can be imported via live loader
* `g01.schema.gz`: This file is the internal Dgraph schema. If you have set up your backend with a GraphQL schema, then you should be able to ignore this file.

The following is an example of GraphQL query to check the status of the export and get the signed URLs for downloanding your export files.

```graphql
query {
exportStatus (
exportId:"<paste-your-exportId>"
taskId: "<paste-your-taskId>"
){
kind
lastUpdated
signedUrls
status
}
}
```
## Exporting Data with Multi-Tenancy feature enabled

{{% notice "note" %}}
With Multi-Tenancy feature enabled, for any GraphQL request you will need to provide the `accessJWT` for the specific user in the `X-Dgraph-AccessToken` header.
{{% /notice %}}

You can trigger two types of exports:
* cluster-wide export: this is an export of the entire backend (including all namespaces). This request can be only triggered by the [*Guardian of Galaxy*](https://dgraph.io/docs/enterprise-features/multitenancy/#guardians-of-the-galaxy) users.
* namespace-specific export: this is an export of a specific namespace. This request can be triggered by the *Guardian of Galaxy* users and by the *Guardian of Namespace* users.

### Cluster-wide Exports

This can only be done by the *Guardian of Galaxy* users (AKA Super Admin), the steps are:

1. Get the `accessJWT` token for the *Guardian of Galaxy* user. Send the following GraphQL mutation to the `/admin` endpoint:
```graphql
mutation login($userId: String, $password: String, $namespace: Int) {
login(userId: $userId, password: $password, namespace: $namespace) {
response {
accessJWT
refreshJWT
}
}
}
```
Your variables should be referring to the *Guardian of Galaxy* user:
```json
{
"userId": "groot",
"password": "password",
"namespace": 0
}
```
2. Once obtained the `accessJWT` token you need to pass it in `X-Dgraph-AccessToken` Header and only then you can send the following GraphQL mutation to `/admin/slash` endpoint:
```graphql
mutation {
export (namespace: -1) {
response { code message }
exportId
taskId
}
}
```
3. Once done, you can now send the following GraqhQL mutation to get the `signedUrls` from where you can download your export files:
```graphql
query {
exportStatus (
exportId:"<paste-your-exportId>"
taskId: "<paste-your-taskId>"
){
kind
lastUpdated
signedUrls
status
}
}
```

### Namespace-specific Exports

Namespace-specific exports can be triggered by the *Guardian of Galaxy* users. In this case you can follow the same steps for the cluster-wide exports and replace the namespace value from `-1` to the namespace you want to export. It's important that you get the `accessJWT` token for the *Guardian of Galaxy* user and pass it in the `X-Dgraph-AccessToken` header.

E.g. if you want to export the namespace `0x123` your GraphQL request sent to the `/admin/slash` endpoint would look like:
```graphql
mutation {
export (namespace: 123) {
response { code message }
exportId
taskId
}
}
```
You can also trigger namespace-specific export using the *Guardian of Namespace* users, in this case there is no need to specify any namespace in the GraphQL request as these users can only export their own namespace. It's important that you get the `accessJWT` token for the *Guardian of Namespace* user and pass it in the `X-Dgraph-AccessToken` header.

The GraphQL request sent to the `/admin/slash` endpoint would be:
```graphql
mutation {
export {
response { code message }
exportId
taskId
}
}
```

## Importing data with Live Loader

It is possible to import data into a Dgraph Cloud backend using [live loader](https://dgraph.io/docs/deploy/#live-loader). In order to import data, do the following steps:

1. First import your schema into your Dgraph Cloud backend, using either the [Schema API](/admin/schema) or via [the Schema Page](https://cloud.dgraph.io/_/schema).
2. Log into Dgraph Cloud, and find your backend's `gRPC Endpoint` on the Settings page. This will look like `frozen-mango.grpc.us-west-1.aws.cloud.dgraph.io:443`

{{% notice "note" %}}
The gRPC endpoint URL must have the string `.grpc.` added after the domain prefix. Without this change, Live Loader will not be able to find the endpoint.
{{% /notice %}}

3. Run the live loader as follows:

```
docker run -it --rm -v /path/to/g01.json.gz:/tmp/g01.json.gz dgraph/dgraph:v21.03-slash \
dgraph live --slash_grpc_endpoint=<grpc-endpoint>:443 -f /tmp/g01.json.gz -t <api-token>
```

{{% notice "note" %}}
Running this via Docker requires you to use an unreleased tag (either `master` or `v21.03-slash`).
{{% /notice %}}
Loading