这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
35 changes: 16 additions & 19 deletions docs/graphql/manual/deployment/docker/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
:emphasize-lines: 3

#! /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)*
Expand All @@ -58,25 +57,23 @@ 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

If your Postgres database is running on ``localhost``, use ``host.docker.internal`` as hostname to access
the host's Postgres service. This is what your command should look like:

.. 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@host.docker.internal:port/dbname \
serve --enable-console
: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

Step 3: Run the hasura docker container
---------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ These are the environment variables which are available:
.. code-block:: none

HASURA_GRAPHQL_DATABASE_URL Postgres database URL
<postgres/postgresql>://<user>:<password>@<host>:<port>/<db-
name>
<postgres/postgresql>://<user>:<password>@<host>:<port>/<db-name>
Example: postgres://admin:mypass@mydomain.com:5432/mydb
HASURA_GRAPHQL_SERVER_PORT Port on which graphql-engine should be served

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ Launch Hasura using a container instance:
--name hasura-graphql-engine \
--image hasura/graphql-engine \
--dns-name-label "<dns-name-label>" \
--ports 8080 \
--secure-environment-variables "HASURA_GRAPHQL_DATABASE_URL=<database-url>"
--ports 80 \
--environment-variables "HASURA_GRAPHQL_SERVER_PORT"="80" "HASURA_GRAPHQL_ENABLE_CONSOLE"="true" \
--secure-environment-variables "HASURA_GRAPHQL_DATABASE_URL"="<database-url>"

``<database-url>`` should be replaced by the following format:

Expand Down Expand Up @@ -168,7 +169,7 @@ Visit the following URL for the Hasura Console:

.. code::

http://<dns-name-label>.westus.azurecontainer.io:8080/console
http://<dns-name-label>.westus.azurecontainer.io/console

Replace ``<dns-name-label>`` with the label given earlier.

Expand Down
16 changes: 9 additions & 7 deletions install-manifests/azure-resource-manager/azuredeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down Expand Up @@ -147,12 +147,6 @@
"name": "[variables('containerName')]",
"properties": {
"image": "[variables('containerImage')]",
"command": [
"graphql-engine",
"serve",
"--server-port",
"80"
],
"ports": [
{
"protocol": "TCP",
Expand All @@ -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": {
Expand Down
7 changes: 3 additions & 4 deletions install-manifests/docker-compose-postgis/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
7 changes: 3 additions & 4 deletions install-manifests/docker-compose/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
7 changes: 3 additions & 4 deletions install-manifests/docker-run/docker-run.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions install-manifests/kubernetes/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions server/packaging/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
FROM scratch
COPY rootfs/ /
ENV HASURA_GRAPHQL_ENABLE_CONSOLE=true
CMD ["graphql-engine", "serve"]
CMD ["graphql-engine", "serve"]