1.准备
确保Docker
和Docker Compose
已安装
2.根目录下创建hasura文件夹
pwd //查看当前所处的路径 cd .. mkdir hasura cd hasura
3.获取the docker-compose文件
wget https://raw.githubusercontent.com/hasura/graphql-engine/stable/install-manifests/docker-compose/docker-compose.yaml
4.启动
$ docker-compose up -d
5.检查容器是否在运行
$ docker ps CONTAINER ID IMAGE ... CREATED STATUS PORTS ... 097f58433a2b hasura/graphql-engine ... 1m ago Up 1m 8080->8080/tcp ... b0b1aac0508d postgres ... 1m ago Up 1m 5432/tcp ...
6.访问
http://localhost:8080/console
7.备注,确保8080端口已开放,阿里云需要配置安全组
8.默认情况没有登录验证,我们设置登录密码123
docker-compose.yaml文件中添加如下
HASURA_GRAPHQL_ADMIN_SECRET: 123
备注:对端口修改后,发现无法正常访问,遂取消修改
参考连接:
https://hasura.io/docs/1.0/graphql/core/deployment/deployment-guides/docker.html#docker-secure
https://hasura.io/docs/1.0/graphql/manual/deployment/deployment-guides/docker.html#deployment-docker