フリーランス 技術調査ブログ

フリーランス/エンジニア Ruby Python Nodejs Vuejs React Dockerなどの調査技術調査の備忘録

dockerでhasura環境を構築する

はじめに

  • Djangoからhasuraに移設して劇的にパフォーマンスが向上した記事をみて試したくなり、インストールしてみる。 hasura.io

公式サイトのインストール手順

  • 下記の内容を参考にインストールしてみる hasura.io

hasuraのdocker環境の準備

  • フォルダの作成
# mkdir hasura
  • フォルダの中に移動
# cd hasura/
  • docker-compose.yamlをダウンロードする
# wget https://raw.githubusercontent.com/hasura/graphql-engine/stable/install-manifests/docker-compose/docker-compose.yaml
  • docker-compose.ymlが設置されいてることを確認する
# ls
docker-compose.yaml

docker-composeコマンドで起動

# docker-compose up -d
Creating network "hasura_default" with the default driver
Creating volume "hasura_db_data" with default driver
Pulling postgres (postgres:12)...
12: Pulling from library/postgres
bf5952930446: Pull complete
9577476abb00: Pull complete
2bd105512d5c: Pull complete
b1cd21c26e81: Pull complete
34a7c86cf8fc: Pull complete
274e7b0c38d5: Pull complete
3e831b350d37: Pull complete
38fa0d496534: Pull complete
31a8349609a4: Pull complete
14e4c2a4b7b7: Pull complete
964acfa02beb: Pull complete
31b1f20dffc0: Pull complete
14771c2930e9: Pull complete
2f30edd0ce8a: Pull complete
Digest: sha256:a06e6e6e519b7a329c419f8221edec66cfc45511e8b80e262c12103ba745cf19
Status: Downloaded newer image for postgres:12
Pulling graphql-engine (hasura/graphql-engine:v1.3.0)...
v1.3.0: Pulling from hasura/graphql-engine
be32038682b3: Pull complete
Digest: sha256:45a57d1e3170c6ca06b0c8f979822daafd77461e888daf3db584032aa1f821ba
Status: Downloaded newer image for hasura/graphql-engine:v1.3.0
Creating hasura_postgres_1 ... done
Creating hasura_graphql-engine_1 ... done

起動確認

  • docker psコマンドを実行するとhasuraと‘postgresSQL‘が起動していることを確認できる
# docker ps
CONTAINER ID        IMAGE                          COMMAND                  CREATED             STATUS              PORTS                                                              NAMES
fa85a7d95aa2        hasura/graphql-engine:v1.3.0   "graphql-engine serve"   5 minutes ago       Up 5 minutes        0.0.0.0:8080->8080/tcp                                             hasura_graphql-engine_1
5c4817d1d792        postgres:12                    "docker-entrypoint.s…"   5 minutes ago       Up 5 minutes        5432/tcp       

ブラウザでアクセス

  • http://localhost:8080/consoleにアクセスすると下記のブラウザで確認できる f:id:PX-WING:20200814213935p:plain

`