mirror of
https://github.com/zhigang1992/graphql-engine.git
synced 2026-05-25 10:23:36 +08:00
update digitalocean guide to include marketplace (#1706)
This commit is contained in:
committed by
Rikin Kachhia
parent
17183caed4
commit
efc97c0b5c
@@ -24,7 +24,7 @@ All resources mentioned in this guide can be deployed using the one-click button
|
||||
|
||||
.. tab:: With a new Postgres Server
|
||||
|
||||
.. image:: http://azuredeploy.net/deploybutton.png
|
||||
.. image:: https://azuredeploy.net/deploybutton.png
|
||||
:width: 200px
|
||||
:alt: azure_deploy_button_new_pg
|
||||
:class: no-shadow
|
||||
@@ -35,7 +35,7 @@ All resources mentioned in this guide can be deployed using the one-click button
|
||||
|
||||
.. tab:: With an existing Postgres Server
|
||||
|
||||
.. image:: http://azuredeploy.net/deploybutton.png
|
||||
.. image:: https://azuredeploy.net/deploybutton.png
|
||||
:width: 200px
|
||||
:alt: azure_deploy_button_existing_pg
|
||||
:class: no-shadow
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
Hasura GraphQL Engine DigitalOcean One-click App
|
||||
================================================
|
||||
Hasura GraphQL Engine One-click App on DigitalOcean Marketplace
|
||||
===============================================================
|
||||
|
||||
.. contents:: Table of contents
|
||||
:backlinks: none
|
||||
:depth: 1
|
||||
:local:
|
||||
|
||||
Hasura GraphQL Engine is available as a One-click app on DigitalOcean. It is
|
||||
packed with a Postgres database and `Caddy <https://caddyserver.com/>`__
|
||||
webserver for easy and automatic HTTPS using Let's Encrypt.
|
||||
|
||||
Hasura GraphQL Engine is available as a One-click app on the DigitalOcean
|
||||
Marketplace. It is packed with a `Postgres <https://www.postgresql.org/>`__
|
||||
database and `Caddy <https://caddyserver.com/>`__ webserver for easy and
|
||||
automatic HTTPS using `Let's Encrypt <https://letsencrypt.org/>`__.
|
||||
|
||||
Quickstart
|
||||
----------
|
||||
@@ -17,40 +17,43 @@ Quickstart
|
||||
1. Create a Hasura One-click Droplet
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Click the button below to create a new Hasura GraphQL Engine Droplet on
|
||||
DigitalOcean using One-Click App. (``Ctrl+Click`` to open in a new tab)
|
||||
Click the button below to create a new Hasura GraphQL Engine Droplet through
|
||||
DigitalOcean Marketplace. For first time users, the link also contains a
|
||||
referral code with gives you $100 over days. A $5 droplet is good enough to
|
||||
support most workloads. (``Ctrl+Click`` to open in a new tab)
|
||||
|
||||
.. image:: https://graphql-engine-cdn.hasura.io/img/create_hasura_droplet.png
|
||||
:width: 300px
|
||||
:alt: do_create_droplet_button
|
||||
:class: no-shadow
|
||||
:target: https://cloud.digitalocean.com/droplets/new?image=hasura-18-04&utm_source=hasura&utm_campaign=docs
|
||||
:target: https://marketplace.digitalocean.com/apps/hasura?action=deploy&refcode=c4d9092d2c48&utm_source=hasura&utm_campaign=docs
|
||||
|
||||
2. Open console
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
Once Hasura GraphQL Engine One-Click Droplet is ready, you can visit the Droplet
|
||||
IP to open the Hasura console, where you can create tables, explore GraphQL APIs
|
||||
etc. Note that it might take 1 or 2 minutes for everything to start running.
|
||||
Once Hasura GraphQL Engine Droplet is ready, you can visit the Droplet IP to
|
||||
open the Hasura console, where you can create tables, explore GraphQL APIs etc.
|
||||
Note that it might take 1 or 2 minutes for everything to start running.
|
||||
|
||||
The Hasura console will be at:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
http://your_droplet_ip/console
|
||||
http://<your_droplet_ip>/console
|
||||
|
||||
|
||||
The GraphQL Endpoint will be:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
http://your_droplet_ip/v1alpha1/graphql
|
||||
http://<your_droplet_ip>/v1alpha1/graphql
|
||||
|
||||
|
||||
A Postgres database is also provisioned on the Droplet. Using the console, you
|
||||
can create a table on this Postgres instance and make your first GraphQL query.
|
||||
|
||||
.. image:: https://graphql-engine-cdn.hasura.io/heroku-repo/assets/hasura_console.png
|
||||
:class: no-shadow
|
||||
:alt: Hasura console
|
||||
|
||||
3. Create a table
|
||||
@@ -70,6 +73,7 @@ Navigate to ``Data -> Create table`` on the console and create a table called ``
|
||||
Choose ``id`` as the Primary key and click the ``Create`` button.
|
||||
|
||||
.. image:: https://graphql-engine-cdn.hasura.io/heroku-repo/assets/hasura_create_table.png
|
||||
:class: no-shadow
|
||||
:alt: Hasura console - create table
|
||||
|
||||
4. Insert sample data
|
||||
@@ -86,6 +90,7 @@ Once the table is created, go to the ``Insert Row`` tab and insert some sample r
|
||||
Black Widow
|
||||
|
||||
.. image:: https://graphql-engine-cdn.hasura.io/heroku-repo/assets/hasura_insert_row.png
|
||||
:class: no-shadow
|
||||
:alt: Hasura console - insert data
|
||||
|
||||
5. Try out GraphQL
|
||||
@@ -103,12 +108,13 @@ Switch to the ``GraphiQL`` tab on top and execute the following GraphQL query:
|
||||
}
|
||||
|
||||
.. image:: https://graphql-engine-cdn.hasura.io/heroku-repo/assets/hasura_graphql_query.png
|
||||
:class: no-shadow
|
||||
:alt: Hasura console - GraphiQL
|
||||
|
||||
Secure the GraphQL endpoint
|
||||
---------------------------
|
||||
|
||||
By default Hasura is exposed without any secret key. Anyone can read and write
|
||||
By default Hasura is exposed without any admin secret. Anyone can read and write
|
||||
to your database using GraphQL. When deploying to production, you should secure
|
||||
the endpoint by adding an admin secret key and then setting up permission rules on
|
||||
tables.
|
||||
@@ -119,7 +125,7 @@ To add an admin secret key, follow the steps given below:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ssh root@your_droplet_ip
|
||||
ssh root@<your_droplet_ip>
|
||||
|
||||
|
||||
2. Goto ``/etc/hasura`` directory:
|
||||
@@ -151,7 +157,7 @@ To add an admin secret key, follow the steps given below:
|
||||
docker-compose up -d
|
||||
|
||||
|
||||
That's it. Visit the console at ``http://your_droplet_ip/console`` and it should
|
||||
That's it. Visit the console at ``http://<your_droplet_ip>/console`` and it should
|
||||
prompt for the admin secret key. Further API requests can be made by adding the
|
||||
following header:
|
||||
|
||||
@@ -164,7 +170,7 @@ Adding a domain & Enabling HTTPS
|
||||
--------------------------------
|
||||
|
||||
If you own a domain, you can enable HTTPS on this Droplet by mapping the domain
|
||||
to the Droplet's IP. The One-Click Droplet is configured with Caddy which is an
|
||||
to the Droplet's IP. The Hasura GraphQL Droplet is configured with Caddy which is an
|
||||
HTTP/2 web server with automatic HTTPS using Let's Encrypt.
|
||||
|
||||
1. Go to your domain's DNS dashboard and add an A record mapping the domain to the Droplet IP.
|
||||
@@ -172,7 +178,7 @@ HTTP/2 web server with automatic HTTPS using Let's Encrypt.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ssh root@your_droplet_ip
|
||||
ssh root@<your_droplet_ip>
|
||||
|
||||
|
||||
3. Goto ``/etc/hasura`` directory:
|
||||
@@ -206,20 +212,21 @@ HTTP/2 web server with automatic HTTPS using Let's Encrypt.
|
||||
docker-compose restart caddy
|
||||
|
||||
|
||||
Visit ``https://your_domain/console`` to visit the Hasura console.
|
||||
Visit ``https://<your_domain>/console`` to visit the Hasura console.
|
||||
|
||||
Updating to the latest version
|
||||
------------------------------
|
||||
|
||||
When a new version of GraphQL Engine is released, you can upgrade to it by just
|
||||
changing the version tag in docker-compose.yaml. You can find the latest
|
||||
releases on the GitHub releases page.
|
||||
releases on the `GitHub releases page
|
||||
<https://github.com/hasura/graphql-engine/releases>`__.
|
||||
|
||||
1. Connect to the Droplet via SSH:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ssh root@your_droplet_ip
|
||||
ssh root@<your_droplet_ip>
|
||||
|
||||
|
||||
2. Goto ``/etc/hasura`` directory:
|
||||
@@ -250,25 +257,28 @@ releases on the GitHub releases page.
|
||||
docker-compose up -d
|
||||
|
||||
|
||||
Using a different database
|
||||
--------------------------
|
||||
Using DigitalOcean Managed Postgres Database
|
||||
--------------------------------------------
|
||||
|
||||
1. Connect to the Droplet via SSH:
|
||||
1. Create a new Postgres Database from DigitalOcean Console, preferably in the
|
||||
same region as the Droplet.
|
||||
2. Once the database is created, under the "Overview" tab, from the "Connection
|
||||
Details" section, choose "Connection string" from the dropdown.
|
||||
3. "Connection string" is the "Database URL" - copy it.
|
||||
4. Connect to the Droplet via SSH:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ssh root@your_droplet_ip
|
||||
ssh root@<your_droplet_ip>
|
||||
|
||||
|
||||
2. Goto ``/etc/hasura`` directory:
|
||||
5. Goto ``/etc/hasura`` directory:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cd /etc/hasura
|
||||
|
||||
3. Setup the database that you wish to use, preferably via Docker Compose
|
||||
|
||||
4. Edit ``docker-compose.yaml`` and change the database URL:
|
||||
6. Edit ``docker-compose.yaml`` and change the database URL:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@@ -276,16 +286,20 @@ Using a different database
|
||||
|
||||
...
|
||||
# change the url to use a different database
|
||||
HASURA_GRAPHQL_DATABASE_URL: postgres://<new-database-url>/<new-database-name>
|
||||
HASURA_GRAPHQL_DATABASE_URL: <database-url>
|
||||
...
|
||||
|
||||
# type ESC followed by :wq to save and quit
|
||||
|
||||
.. note::
|
||||
Similarly, database URL can be changed to connect to any other Postgres
|
||||
database.
|
||||
|
||||
Hasura GraphQL engine needs access permissions to your Postgres database as described in
|
||||
:doc:`Postgres permissions <../../deployment/postgres-permissions>`
|
||||
.. note::
|
||||
|
||||
If you're using Hasura with a restricted database user, make sure you go
|
||||
through :doc:`Postgres permissions <../../deployment/postgres-permissions>`
|
||||
to configure all required permissions. (Not applicable with the default
|
||||
connection string with DO Managed Postgres)
|
||||
|
||||
Logs
|
||||
----
|
||||
@@ -295,7 +309,7 @@ Logs
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
ssh root@your_droplet_ip
|
||||
ssh root@<your_droplet_ip>
|
||||
|
||||
|
||||
2. Goto ``/etc/hasura`` directory:
|
||||
@@ -313,3 +327,8 @@ Logs
|
||||
Where ``<container_name>`` is one of ``graphql-engine``, ``postgres`` or
|
||||
``caddy``.
|
||||
|
||||
Troubleshooting
|
||||
---------------
|
||||
|
||||
Logs should be able to help you in most scenarios. If it doesn't, feel free to
|
||||
talk to us on `Discord <https://discord.gg/hasura>`__.
|
||||
|
||||
@@ -6,7 +6,7 @@ Guides: Deployment
|
||||
:depth: 1
|
||||
:local:
|
||||
|
||||
- :doc:`Digital Ocean One-click App <digital-ocean-one-click>`
|
||||
- :doc:`Digital Ocean One-click App on Marketplace <digital-ocean-one-click>`
|
||||
- :doc:`Azure Container Instances with Postgres <azure-container-instances-postgres>`
|
||||
- :doc:`Google Cloud Platform with Kubernetes Engine and Cloud SQL <google-kubernetes-engine-cloud-sql>`
|
||||
- `Blog: Instant GraphQL on AWS RDS <https://blog.hasura.io/instant-graphql-on-aws-rds-1edfb85b5985>`__
|
||||
@@ -21,7 +21,7 @@ Guides: Deployment
|
||||
:titlesonly:
|
||||
:hidden:
|
||||
|
||||
DigitalOcean One-click App <digital-ocean-one-click>
|
||||
DigitalOcean One-click App on Marketplace <digital-ocean-one-click>
|
||||
Azure Container Instances with Postgres <azure-container-instances-postgres>
|
||||
Google Cloud Platform with Kubernetes Engine and Cloud SQL <google-kubernetes-engine-cloud-sql>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user