From 049162eb93f73647206ddf24a809d9325b3c2c48 Mon Sep 17 00:00:00 2001 From: Shahidh K Muhammed Date: Thu, 22 Nov 2018 14:15:49 +0530 Subject: [PATCH 1/7] update installation manifests to have explicit enable console --- .../azure-resource-manager/azuredeploy.json | 14 ++++++++------ .../docker-compose-postgis/docker-compose.yaml | 7 +++---- .../docker-compose/docker-compose.yaml | 7 +++---- install-manifests/docker-run/docker-run.sh | 7 +++---- install-manifests/kubernetes/deployment.yaml | 4 ++-- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/install-manifests/azure-resource-manager/azuredeploy.json b/install-manifests/azure-resource-manager/azuredeploy.json index 34793b60c7dd0..415408434038e 100644 --- a/install-manifests/azure-resource-manager/azuredeploy.json +++ b/install-manifests/azure-resource-manager/azuredeploy.json @@ -147,12 +147,6 @@ "name": "[variables('containerName')]", "properties": { "image": "[variables('containerImage')]", - "command": [ - "graphql-engine", - "serve", - "--server-port", - "80" - ], "ports": [ { "protocol": "TCP", @@ -163,6 +157,14 @@ { "name": "HASURA_GRAPHQL_DATABASE_URL", "secureValue": "[concat('postgres://', variables('adminUser'), '%40', variables('serverName'), ':', parameters('urlEncodedAdminPassword'), '@', reference(resourceId('Microsoft.DBforPostgreSQL/servers', variables('serverName'))).fullyQualifiedDomainName, ':5432/', variables('dbName'))]" + }, + { + "name": "HASURA_GRAPHQL_ENABLE_CONSOLE", + "value": "true" + }, + { + "name": "HASURA_GRAPHQL_SERVER_PORT", + "value": "80" } ], "resources": { diff --git a/install-manifests/docker-compose-postgis/docker-compose.yaml b/install-manifests/docker-compose-postgis/docker-compose.yaml index 79c57a91b3c4a..285c2926d29ad 100644 --- a/install-manifests/docker-compose-postgis/docker-compose.yaml +++ b/install-manifests/docker-compose-postgis/docker-compose.yaml @@ -14,9 +14,8 @@ services: restart: always environment: HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:@postgres:5432/postgres - command: - - graphql-engine - - serve - - --enable-console + HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set to "false" to disable console + ## uncomment next line to set an access key + # HASURA_GRAPHQL_ACCESS_KEY: mysecretaccesskey volumes: db_data: diff --git a/install-manifests/docker-compose/docker-compose.yaml b/install-manifests/docker-compose/docker-compose.yaml index eca1567239c6b..819a66567bce3 100644 --- a/install-manifests/docker-compose/docker-compose.yaml +++ b/install-manifests/docker-compose/docker-compose.yaml @@ -14,9 +14,8 @@ services: restart: always environment: HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:@postgres:5432/postgres - command: - - graphql-engine - - serve - - --enable-console + HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set to "false" to disable console + ## uncomment next line to set an access key + # HASURA_GRAPHQL_ACCESS_KEY: mysecretaccesskey volumes: db_data: diff --git a/install-manifests/docker-run/docker-run.sh b/install-manifests/docker-run/docker-run.sh index 9fb0203da45a4..ddc41f90acfcb 100755 --- a/install-manifests/docker-run/docker-run.sh +++ b/install-manifests/docker-run/docker-run.sh @@ -1,6 +1,5 @@ #! /bin/bash docker run -d -p 8080:8080 \ - hasura/graphql-engine:v1.0.0-alpha29 \ - graphql-engine \ - --database-url postgres://username:password@hostname:port/dbname \ - serve --enable-console + -e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@hostname:port/dbname \ + -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \ + hasura/graphql-engine:v1.0.0-alpha29 \ No newline at end of file diff --git a/install-manifests/kubernetes/deployment.yaml b/install-manifests/kubernetes/deployment.yaml index 99096b0f7daa7..66e4cf775bdfd 100644 --- a/install-manifests/kubernetes/deployment.yaml +++ b/install-manifests/kubernetes/deployment.yaml @@ -21,11 +21,11 @@ spec: - image: hasura/graphql-engine:v1.0.0-alpha29 imagePullPolicy: IfNotPresent name: hasura - command: ["graphql-engine"] - args: ["serve", "--enable-console"] env: - name: HASURA_GRAPHQL_DATABASE_URL value: postgres://username:password@hostname:port/dbname + - name: HASURA_GRAPHQL_ENABLE_CONSOLE + value: "true" ports: - containerPort: 8080 protocol: TCP From dee9b8bb8abfabe29e354b86dddf654c738fd61d Mon Sep 17 00:00:00 2001 From: Shahidh K Muhammed Date: Thu, 22 Nov 2018 14:16:27 +0530 Subject: [PATCH 2/7] remove enable console from server dockerfile --- server/packaging/build/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/packaging/build/Dockerfile b/server/packaging/build/Dockerfile index c2bcc5ac828e8..9cd54e19214ce 100644 --- a/server/packaging/build/Dockerfile +++ b/server/packaging/build/Dockerfile @@ -1,4 +1,3 @@ FROM scratch COPY rootfs/ / -ENV HASURA_GRAPHQL_ENABLE_CONSOLE=true -CMD ["graphql-engine", "serve"] +CMD ["graphql-engine", "serve"] \ No newline at end of file From ecc2bd3d353ac85f42cf0bb7c95f28dcd813c478 Mon Sep 17 00:00:00 2001 From: Shahidh K Muhammed Date: Thu, 22 Nov 2018 14:25:57 +0530 Subject: [PATCH 3/7] update docs to take all config as env vars --- .../manual/deployment/docker/index.rst | 27 +++++++++---------- .../docker/securing-graphql-endpoint.rst | 17 ++++++------ 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/docs/graphql/manual/deployment/docker/index.rst b/docs/graphql/manual/deployment/docker/index.rst index 8e3b5a01e6e30..4f21e94e9a156 100644 --- a/docs/graphql/manual/deployment/docker/index.rst +++ b/docs/graphql/manual/deployment/docker/index.rst @@ -26,19 +26,18 @@ Step 2: Configure the docker-run.sh script Check the sample docker run command in ``docker-run.sh``. -Edit the ``--database-url`` flag value, so that you can connect to your Postgres instance. +Edit the ``HASURA_GRAPHQL_DATABASE_URL`` env var value, so that you can connect to your Postgres instance. .. code-block:: bash :emphasize-lines: 5 #! /bin/bash docker run -d -p 8080:8080 \ - hasura/graphql-engine:latest \ - graphql-engine \ - --database-url postgres://username:password@hostname:port/dbname \ - serve --enable-console + -e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@hostname:port/dbname \ + -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \ + hasura/graphql-engine:latest -Examples of ``database-url``: +Examples of ``HASURA_GRAPHQL_DATABASE_URL``: - ``postgres://admin:password@localhost:5432/my-db`` - ``postgres://admin:@localhost:5432/my-db`` *(if there is no password)* @@ -58,10 +57,9 @@ Examples of ``database-url``: #! /bin/bash docker run -d --net=host \ - hasura/graphql-engine:latest \ - graphql-engine \ - --database-url postgres://username:password@hostname:port/dbname \ - serve --enable-console + -e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@hostname:port/dbname \ + -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \ + hasura/graphql-engine:latest .. tab:: Docker for Mac @@ -69,14 +67,13 @@ Examples of ``database-url``: the host's Postgres service. This is what your command should look like: .. code-block:: bash - :emphasize-lines: 5 + :emphasize-lines: 3 #! /bin/bash docker run -d -p 8080:8080 \ - hasura/graphql-engine:latest \ - graphql-engine \ - --database-url postgres://username:password@host.docker.internal:port/dbname \ - serve --enable-console + -e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@host.docker.internal:port/dbname \ + -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \ + hasura/graphql-engine:latest Step 3: Run the hasura docker container --------------------------------------- diff --git a/docs/graphql/manual/deployment/docker/securing-graphql-endpoint.rst b/docs/graphql/manual/deployment/docker/securing-graphql-endpoint.rst index f8194e12f7803..f212c1426dc18 100644 --- a/docs/graphql/manual/deployment/docker/securing-graphql-endpoint.rst +++ b/docs/graphql/manual/deployment/docker/securing-graphql-endpoint.rst @@ -4,19 +4,18 @@ Securing the GraphQL endpoint (Docker) To make sure that your GraphQL endpoint and the Hasura console are not publicly accessible, you need to configure an access key. -Run the docker command with an access-key flag ----------------------------------------------- +Run the docker command with an access-key env var +------------------------------------------------- .. code-block:: bash - :emphasize-lines: 7 + :emphasize-lines: 5 #! /bin/bash - docker run -p 8080:8080 \ - hasura/graphql-engine:latest \ - graphql-engine \ - --database-url postgres://username:password@hostname:port/dbname \ - serve \ - --access-key mysecretkey + docker run -d -p 8080:8080 \ + -e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@hostname:port/dbname \ + -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \ + -e HASURA_GRAPHQL_ACCESS_KEY=mysecretkey \ + hasura/graphql-engine:latest .. note:: From b0c627769ed7f4ba5a1fa350829d9517152d88ab Mon Sep 17 00:00:00 2001 From: Shahidh K Muhammed Date: Thu, 22 Nov 2018 14:31:51 +0530 Subject: [PATCH 4/7] change indentation --- .../manual/deployment/docker/index.rst | 24 +++++++++---------- .../docker/securing-graphql-endpoint.rst | 8 +++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/graphql/manual/deployment/docker/index.rst b/docs/graphql/manual/deployment/docker/index.rst index 4f21e94e9a156..f479bf5258624 100644 --- a/docs/graphql/manual/deployment/docker/index.rst +++ b/docs/graphql/manual/deployment/docker/index.rst @@ -29,13 +29,13 @@ Check the sample docker run command in ``docker-run.sh``. Edit the ``HASURA_GRAPHQL_DATABASE_URL`` env var value, so that you can connect to your Postgres instance. .. code-block:: bash - :emphasize-lines: 5 + :emphasize-lines: 3 #! /bin/bash docker run -d -p 8080:8080 \ - -e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@hostname:port/dbname \ - -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \ - hasura/graphql-engine:latest + -e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@hostname:port/dbname \ + -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \ + hasura/graphql-engine:latest Examples of ``HASURA_GRAPHQL_DATABASE_URL``: @@ -57,9 +57,9 @@ Examples of ``HASURA_GRAPHQL_DATABASE_URL``: #! /bin/bash docker run -d --net=host \ - -e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@hostname:port/dbname \ - -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \ - hasura/graphql-engine:latest + -e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@hostname:port/dbname \ + -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \ + hasura/graphql-engine:latest .. tab:: Docker for Mac @@ -69,11 +69,11 @@ Examples of ``HASURA_GRAPHQL_DATABASE_URL``: .. code-block:: bash :emphasize-lines: 3 - #! /bin/bash - docker run -d -p 8080:8080 \ - -e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@host.docker.internal:port/dbname \ - -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \ - hasura/graphql-engine:latest + #! /bin/bash + docker run -d -p 8080:8080 \ + -e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@host.docker.internal:port/dbname \ + -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \ + hasura/graphql-engine:latest Step 3: Run the hasura docker container --------------------------------------- diff --git a/docs/graphql/manual/deployment/docker/securing-graphql-endpoint.rst b/docs/graphql/manual/deployment/docker/securing-graphql-endpoint.rst index f212c1426dc18..14bd1aab0898d 100644 --- a/docs/graphql/manual/deployment/docker/securing-graphql-endpoint.rst +++ b/docs/graphql/manual/deployment/docker/securing-graphql-endpoint.rst @@ -12,10 +12,10 @@ Run the docker command with an access-key env var #! /bin/bash docker run -d -p 8080:8080 \ - -e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@hostname:port/dbname \ - -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \ - -e HASURA_GRAPHQL_ACCESS_KEY=mysecretkey \ - hasura/graphql-engine:latest + -e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@hostname:port/dbname \ + -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \ + -e HASURA_GRAPHQL_ACCESS_KEY=mysecretkey \ + hasura/graphql-engine:latest .. note:: From ebbb1f5e5bc9f6c98d6f905ca6862bdb27e875d7 Mon Sep 17 00:00:00 2001 From: Shahidh K Muhammed Date: Thu, 22 Nov 2018 16:02:54 +0530 Subject: [PATCH 5/7] update azure docs --- .../deployment/azure-container-instances-postgres.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 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 8bd39e54a8a33..f8e8fe13f8326 100644 --- a/docs/graphql/manual/guides/deployment/azure-container-instances-postgres.rst +++ b/docs/graphql/manual/guides/deployment/azure-container-instances-postgres.rst @@ -129,8 +129,9 @@ Launch Hasura using a container instance: --name hasura-graphql-engine \ --image hasura/graphql-engine \ --dns-name-label "" \ - --ports 8080 \ - --secure-environment-variables "HASURA_GRAPHQL_DATABASE_URL=" + --ports 80 \ + --environment-variables "HASURA_GRAPHQL_SERVER_PORT"="80" "HASURA_GRAPHQL_ENABLE_CONSOLE"="true" \ + --secure-environment-variables "HASURA_GRAPHQL_DATABASE_URL"="" ```` should be replaced by the following format: @@ -168,7 +169,7 @@ Visit the following URL for the Hasura Console: .. code:: - http://.westus.azurecontainer.io:8080/console + http://.westus.azurecontainer.io/console Replace ```` with the label given earlier. From 6dd1ad9452202c6980088dd694beed1be7834e2b Mon Sep 17 00:00:00 2001 From: Shahidh K Muhammed Date: Thu, 22 Nov 2018 16:24:45 +0530 Subject: [PATCH 6/7] update image version in azure template --- install-manifests/azure-resource-manager/azuredeploy.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-manifests/azure-resource-manager/azuredeploy.json b/install-manifests/azure-resource-manager/azuredeploy.json index 415408434038e..5f237b32a4c66 100644 --- a/install-manifests/azure-resource-manager/azuredeploy.json +++ b/install-manifests/azure-resource-manager/azuredeploy.json @@ -84,7 +84,7 @@ "firewallRuleName": "allow-all-azure-firewall-rule", "containerGroupName": "[concat(parameters('name'), '-container-group')]", "containerName": "hasura-graphql-engine", - "containerImage": "hasura/graphql-engine:v1.0.0-alpha28" + "containerImage": "hasura/graphql-engine:v1.0.0-alpha29" }, "resources": [ { From 8c3bfb91b9034f97e157eb672fd0ad0e15683412 Mon Sep 17 00:00:00 2001 From: rikinsk Date: Fri, 23 Nov 2018 14:27:03 +0530 Subject: [PATCH 7/7] fix typo in server flag doc --- .../manual/deployment/graphql-engine-flags/reference.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/graphql/manual/deployment/graphql-engine-flags/reference.rst b/docs/graphql/manual/deployment/graphql-engine-flags/reference.rst index da98566145e7d..18eb8e1cf3353 100644 --- a/docs/graphql/manual/deployment/graphql-engine-flags/reference.rst +++ b/docs/graphql/manual/deployment/graphql-engine-flags/reference.rst @@ -77,8 +77,7 @@ These are the environment variables which are available: .. code-block:: none HASURA_GRAPHQL_DATABASE_URL Postgres database URL - ://:@:/ + ://:@:/ Example: postgres://admin:mypass@mydomain.com:5432/mydb HASURA_GRAPHQL_SERVER_PORT Port on which graphql-engine should be served