1、准备服务器
Ubuntu 20.04
CPU:4核
内存:8G
硬盘:SSD 200G
2、配置Graph Node服务器环境
root@ip-172-93-12-156:~# apt update
root@ip-172-93-12-156:~# apt upgrade
root@ip-172-93-12-156:~# apt-get -y install apt-transport-https ca-certificates curl software-properties-common
#安裝docker
root@ip-172-93-12-156:~# curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
OK
root@ip-172-93-12-156:~# add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
root@ip-172-93-12-156:~# apt install docker-ce docker-ce-cli containerd.io
root@ip-172-93-12-156:~# systemctl enable docker
Synchronizing state of docker.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable docker
root@ip-172-93-12-156:~# systemctl start docker
root@ip-172-93-12-156:~# systemctl status docker
# 安装jq
root@ip-172-93-12-156:~# apt-get install jq
# 安装docker-compose
root@ip-172-93-12-156:~# curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
root@ip-172-93-12-156:~# chmod +x /usr/local/bin/docker-compose
root@ip-172-93-12-156:~# docker-compose --version
docker-compose version 1.25.5, build 8a1c60f6
3、部署graphql-node
root@ip-172-93-12-156:~# mkdir -p /data/docker-compose && cd /data/docker-compose
root@ip-172-93-12-156:/data/docker-compose# git clone https://github.com/graphprotocol/graph-node/ && cd graph-node/docker
root@ip-172-93-12-156:/data/docker-compose/graph-node/docker# sh ./setup.sh
Creating network "docker_default" with the default driver
Pulling ipfs (ipfs/go-ipfs:v0.10.0)...
v0.10.0: Pulling from ipfs/go-ipfs
b2d221698d1d: Pull complete
fdc50948eb42: Pull complete
a39bc673d3ca: Pull complete
409b0ef9eb9e: Pull complete
8ea8a7147bda: Pull complete
e4fac4b52fc3: Pull complete
c3a75419e5e1: Pull complete
7714de00c2f6: Pull complete
a207692d1630: Pull complete
bc244498409c: Pull complete
7b6cb3389315: Pull complete
143e77cd0ad8: Pull complete
Digest: sha256:881201083640829bf45e6eb0bd2019ec5fe2c142c852ab84b563682bb1f11c9b
Status: Downloaded newer image for ipfs/go-ipfs:v0.10.0
Pulling postgres (postgres:)...
latest: Pulling from library/postgres
a603fa5e3b41: Pull complete
02d7a77348fd: Pull complete
16b62ca80c8f: Pull complete
fbd795da1fe1: Pull complete
9c68de39d930: Pull complete
2e441a95082c: Pull complete
1c97f440fe14: Pull complete
87a3f78bc5d1: Pull complete
264b18cba666: Pull complete
bea1513c492d: Pull complete
ed48cace97fa: Pull complete
e3c377e275ff: Pull complete
86fa351e30cb: Pull complete
Digest: sha256:766e8867182b474f02e48c7b1a556d12ddfa246138ddc748d70c891bf2873d82
Status: Downloaded newer image for postgres:latest
Pulling graph-node (graphprotocol/graph-node:)...
latest: Pulling from graphprotocol/graph-node
f6e04ba65310: Pull complete
e03e5210fa6e: Pull complete
d04a30793764: Pull complete
5de72d3251de: Pull complete
90d4c07b2784: Pull complete
7565b6dc48d0: Pull complete
Digest: sha256:3b9ca6bf98abd97b1083821490481b95e68d4559baa0e7fe2b9c16100ca2b4ec
Status: Downloaded newer image for graphprotocol/graph-node:latest
Creating docker_postgres_1 ... done
Creating docker_ipfs_1 ... done
Creating docker_graph-node_1 ... done
Starting graph-node ... done
Host IP: 172.18.0.1
./setup.sh: 37: function: not found
root@ip-172-93-12-156:/data/docker-compose/graph-node/docker# vim docker-compose.yml
root@ip-172-93-12-156:/data/docker-compose/graph-node/docker# docker-compose up -d
Starting docker_ipfs_1 ... done
Starting docker_postgres_1 ... done
Recreating docker_graph-node_1 ... done
root@ip-172-93-12-156:/data/docker-compose/graph-node/docker# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fbeb45bd7846 graphprotocol/graph-node "/bin/sh -c start" 11 seconds ago Up 10 seconds 0.0.0.0:8000-8001->8000-8001/tcp, :::8000-8001->8000-8001/tcp, 0.0.0.0:8020->8020/tcp, :::8020->8020/tcp, 0.0.0.0:8030->8030/tcp, :::8030->8030/tcp, 0.0.0.0:8040->8040/tcp, :::8040->8040/tcp docker_graph-node_1
a8a09590fa25 postgres "docker-entrypoint.s…" About a minute ago Up 22 seconds 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp docker_postgres_1
809ac66236bf ipfs/go-ipfs:v0.10.0 "/sbin/tini -- /usr/…" About a minute ago Up 22 seconds 4001/tcp, 8080-8081/tcp, 4001/udp, 0.0.0.0:5001->5001/tcp, :::5001->5001/tcp docker_ipfs_1