From efc97c0b5c737d080bac00f954593032da7d9d62 Mon Sep 17 00:00:00 2001 From: Shahidh K Muhammed Date: Thu, 7 Mar 2019 12:40:16 +0530 Subject: [PATCH] update digitalocean guide to include marketplace (#1706) --- .../azure-container-instances-postgres.rst | 4 +- .../deployment/digital-ocean-one-click.rst | 89 +++++++++++-------- .../manual/guides/deployment/index.rst | 4 +- 3 files changed, 58 insertions(+), 39 deletions(-) diff --git a/docs/graphql/manual/guides/deployment/azure-container-instances-postgres.rst b/docs/graphql/manual/guides/deployment/azure-container-instances-postgres.rst index 32526f9f..1960f2ce 100644 --- a/docs/graphql/manual/guides/deployment/azure-container-instances-postgres.rst +++ b/docs/graphql/manual/guides/deployment/azure-container-instances-postgres.rst @@ -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 diff --git a/docs/graphql/manual/guides/deployment/digital-ocean-one-click.rst b/docs/graphql/manual/guides/deployment/digital-ocean-one-click.rst index bd7c2c21..af06a741 100644 --- a/docs/graphql/manual/guides/deployment/digital-ocean-one-click.rst +++ b/docs/graphql/manual/guides/deployment/digital-ocean-one-click.rst @@ -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 `__ -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 `__ +database and `Caddy `__ webserver for easy and +automatic HTTPS using `Let's Encrypt `__. 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:///console The GraphQL Endpoint will be: .. code-block:: bash - http://your_droplet_ip/v1alpha1/graphql + http:///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@ 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:///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@ 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:///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 +`__. 1. Connect to the Droplet via SSH: .. code-block:: bash - ssh root@your_droplet_ip + ssh root@ 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@ -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:/// + HASURA_GRAPHQL_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@ 2. Goto ``/etc/hasura`` directory: @@ -313,3 +327,8 @@ Logs Where ```` 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 `__. diff --git a/docs/graphql/manual/guides/deployment/index.rst b/docs/graphql/manual/guides/deployment/index.rst index 504aab0d..85a00df5 100644 --- a/docs/graphql/manual/guides/deployment/index.rst +++ b/docs/graphql/manual/guides/deployment/index.rst @@ -6,7 +6,7 @@ Guides: Deployment :depth: 1 :local: -- :doc:`Digital Ocean One-click App ` +- :doc:`Digital Ocean One-click App on Marketplace ` - :doc:`Azure Container Instances with Postgres ` - :doc:`Google Cloud Platform with Kubernetes Engine and Cloud SQL ` - `Blog: Instant GraphQL on AWS RDS `__ @@ -21,7 +21,7 @@ Guides: Deployment :titlesonly: :hidden: - DigitalOcean One-click App + DigitalOcean One-click App on Marketplace Azure Container Instances with Postgres Google Cloud Platform with Kubernetes Engine and Cloud SQL