From 9a162278fa352a362f2b88827bd20f5eb79fcb8d Mon Sep 17 00:00:00 2001 From: Karthik Venkateswaran Date: Thu, 14 Jun 2018 20:53:25 +0530 Subject: [PATCH 1/4] Adds docker-compose --- docker-compose/README.md | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 docker-compose/README.md diff --git a/docker-compose/README.md b/docker-compose/README.md new file mode 100644 index 0000000..09a200e --- /dev/null +++ b/docker-compose/README.md @@ -0,0 +1,52 @@ +# Hasura GraphQL Engine using docker-compose + +## Prerequisites + +- [Docker](https://docs.docker.com/install/) +- [Docker Compose](https://docs.docker.com/compose/install/#install-compose) + +## Deploy + +- Create a docker-compose.yaml file and copy the below configuration into the file. + ```yaml + version: '3.6' + services: + postgres: + image: postgres + environment: + - "POSTGRES_PASSWORD:mysecretpassword" + volumes: + - db_data:/var/lib/postgresql/data + raven: + image: hasuranightly/raven:94a0141 + ports: + - "9000:8080" + links: + - "postgres:postgres" + command: > + /bin/sh -c " + sleep 5; + raven --database-url postgres://postgres:mysecretpassword@postgres:5432/postgres serve; + " + volumes: + db_data: + + ``` + +- Run `docker-compose up -d` to start the Hasura GraphQL Engine. + +## Configure + +(Assuming you have already executed `hasura init`) + +- Edit `config.yaml` and add `endpoint` + ```yaml + endpoint: http://localhost:9000 + ``` + +## Console + +Open the console and start exploring APIs / manage tables/views: +```bash +hasura console +``` From 67040783ed7da473ad327585271d5c5b916897d9 Mon Sep 17 00:00:00 2001 From: Karthik Venkateswaran Date: Fri, 15 Jun 2018 14:08:32 +0530 Subject: [PATCH 2/4] Updates raven to listen on port 8080 --- docker-compose/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose/README.md b/docker-compose/README.md index 09a200e..0855bcd 100644 --- a/docker-compose/README.md +++ b/docker-compose/README.md @@ -20,7 +20,7 @@ raven: image: hasuranightly/raven:94a0141 ports: - - "9000:8080" + - "8080:8080" links: - "postgres:postgres" command: > @@ -41,7 +41,7 @@ - Edit `config.yaml` and add `endpoint` ```yaml - endpoint: http://localhost:9000 + endpoint: http://localhost:8080 ``` ## Console From 69d963bd27798db7cf82eeb32ffa0098962f845d Mon Sep 17 00:00:00 2001 From: Karthik Venkateswaran Date: Fri, 15 Jun 2018 14:19:56 +0530 Subject: [PATCH 3/4] Moves docker-compose configuration into a seperate file --- docker-compose/README.md | 28 +--------------------------- docker-compose/docker-compose.yaml | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 27 deletions(-) create mode 100644 docker-compose/docker-compose.yaml diff --git a/docker-compose/README.md b/docker-compose/README.md index 0855bcd..b0fcca8 100644 --- a/docker-compose/README.md +++ b/docker-compose/README.md @@ -7,33 +7,7 @@ ## Deploy -- Create a docker-compose.yaml file and copy the below configuration into the file. - ```yaml - version: '3.6' - services: - postgres: - image: postgres - environment: - - "POSTGRES_PASSWORD:mysecretpassword" - volumes: - - db_data:/var/lib/postgresql/data - raven: - image: hasuranightly/raven:94a0141 - ports: - - "8080:8080" - links: - - "postgres:postgres" - command: > - /bin/sh -c " - sleep 5; - raven --database-url postgres://postgres:mysecretpassword@postgres:5432/postgres serve; - " - volumes: - db_data: - - ``` - -- Run `docker-compose up -d` to start the Hasura GraphQL Engine. +- Run `docker-compose up -d` inside `docker-compose` directory to start the Hasura GraphQL Engine. ## Configure diff --git a/docker-compose/docker-compose.yaml b/docker-compose/docker-compose.yaml new file mode 100644 index 0000000..ba09c78 --- /dev/null +++ b/docker-compose/docker-compose.yaml @@ -0,0 +1,21 @@ +version: '3.6' +services: + postgres: + image: postgres + environment: + - "POSTGRES_PASSWORD:mysecretpassword" + volumes: + - db_data:/var/lib/postgresql/data + raven: + image: hasuranightly/raven:94a0141 + ports: + - "8080:8080" + links: + - "postgres:postgres" + command: > + /bin/sh -c " + sleep 5; + raven --database-url postgres://postgres:mysecretpassword@postgres:5432/postgres serve; + " +volumes: + db_data: From 4e874c4b04ebdca37b05f0e68f994b59aa391c1e Mon Sep 17 00:00:00 2001 From: Aravind Shankar Date: Wed, 20 Jun 2018 00:10:55 +0530 Subject: [PATCH 4/4] removed sleep, changed links to depends_on --- docker-compose/docker-compose.yaml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docker-compose/docker-compose.yaml b/docker-compose/docker-compose.yaml index ba09c78..c62ca70 100644 --- a/docker-compose/docker-compose.yaml +++ b/docker-compose/docker-compose.yaml @@ -5,17 +5,19 @@ services: environment: - "POSTGRES_PASSWORD:mysecretpassword" volumes: - - db_data:/var/lib/postgresql/data + - db_data:/var/lib/postgresql/data raven: image: hasuranightly/raven:94a0141 ports: - "8080:8080" - links: - - "postgres:postgres" + depends_on: + - "postgres" + restart: always + environment: + - "POSTGRES_PASSWORD:mysecretpassword" command: > /bin/sh -c " - sleep 5; - raven --database-url postgres://postgres:mysecretpassword@postgres:5432/postgres serve; + raven --database-url postgres://postgres:$${POSTGRES_PASSWORD}@postgres:5432/postgres serve; " volumes: db_data: