Skip to content
This repository has been archived by the owner on Sep 13, 2018. It is now read-only.

Adds docker-compose #2

Merged
merged 4 commits into from
Jun 19, 2018
Merged
Changes from 2 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
52 changes: 52 additions & 0 deletions docker-compose/README.md
Original file line number Diff line number Diff line change
@@ -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:
- "8080:8080"
links:
- "postgres:postgres"
command: >
/bin/sh -c "
sleep 5;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this sleep required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because raven needs to wait for the postgres server to come up. It crashes otherwise. Do you know a better way?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it can keep restarting right? Just like with kubernetes. "Eventually" everything will be up.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think restarting will happen on docker compose. May be docker stack.

Isn't there a way of mentioning dependencies?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a way in the older version, but it isn't available now docker/compose#4305. Now you have to write a wrapper script or something to check whether dependent services are up or not.
https://docs.docker.com/compose/startup-order/

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:8080
```

## Console

Open the console and start exploring APIs / manage tables/views:
```bash
hasura console
```