MIP ãã¹ãããããžã®å¯Ÿå¿ãšããŠããµãŒããŒã«ä»¥äžã®æ§é ã®ãµãŒãã¹ã皌åãããã¯ãšãªãµãŒãã¹ãæ§ã ãªãã§ãŒã³ã§æäŸããŸãã
ä»åã®æ§æã§ã¯ãContabo Cloud VPS XL 1 å°ãåããŠæ§æãäœãããšã«ããŸããïŒãã§ãŒã³æ°ãå¢ããã°å¢ããã»ã©ãè² è·ãå³ãããªãå¯èœæ§ããããŸãããã®å Žåãé©å®ãµãŒããŒæ°ãå¢ãããŸãïŒã æ¢ã«ãGnosisãã§ãŒã³ã§ã¯ã¡ã€ã³ãããã§ã®ã¯ãšãªæäŸãéå§ãããŠããŸãããã®ãã©ã³ãã§ã¯ããããŸã§ãã¹ããããçšã®ãµãŒãã¹æäŸäœå¶ãšããŸãïŒç®¡çãããããããã§ããããããããªãã§ãïŒã ãŸããããŒããã©ã³ãµãŒãšã㊠traefik ããdocker swarm ã® WebUI ãšã㊠swarmpit/portainer ãã€ã³ã¹ããŒã«ããŸãã
æç¶ãã¯ã以äžã®ãšããã§ãã
- VPS ãå¥çŽãã
- ENS(goerli), ãã¡ã€ã³(gunu-node.comã¿ãããªãã€)ãååŸãã
- VPS ã®åæèšå®ãããïŒhttps://ayame.space/2021/03/ubuntu-20-04-initialize/ ã® Docker ç°å¢ã®æ§ç¯çŽåãŸã§ãããããã°ååïŒ
- docker ãã€ã³ã¹ããŒã«ãã
- github ã¬ããã¯ããŒã³ãã
- 以äžã®ããã¥ã¡ã³ãã«åŸãèšå®ãã
- åãã確èªãã
- ã¬ããžããªã®æŽæ°ããã£ããšãã«æŽæ°ãã
ããã§ã¯ãæåã® 1~3 ãçç¥ãã4 ãããã£ãŠãããŸãã 2 ã«ã€ããŠã®ã¿ã泚æç¹ããããŸãã ãã¡ã€ã³çŽä»ãã¯ã次ã®ããã«è¡ãªã£ãŠãã ããã
ãµãŒãã¹å | ãã¡ã€ã³ | å²åœ IP |
---|---|---|
traefik | traefik.sld.tld | ãµãŒããŒïŒãããŒãžã£ãŒïŒã® IP |
swarmpit | swarmpit.sld.tld | ãµãŒããŒïŒãããŒãžã£ãŒïŒã® IP |
portainer | swarmpit.sld.tld | ãµãŒããŒïŒãããŒãžã£ãŒïŒã® IP |
prometheus | prometheus.sld.tld | ãµãŒããŒïŒãããŒãžã£ãŒïŒã® IP |
grafana | grafana.sld.tld | ãµãŒããŒïŒãããŒãžã£ãŒïŒã® IP |
indexer | indexer.sld.tld | ãµãŒããŒïŒãããŒãžã£ãŒïŒã® IP |
indexer-arbitrum | indexer-arb.sld.tld | ãµãŒããŒïŒãããŒãžã£ãŒïŒã® IP |
ç®æ¬¡ã¯ä»¥äžã®ãšããã§ãã
- mip-docker-swarm
docker ã¯ã次ã®ã³ãã³ãããµãŒããŒäžã§å®è¡ããŠãã€ã³ã¹ããŒã«ããŸãããã
curl -fsSL https://get.docker.com/ | sh
次ã«ã
sudo usermod -aG docker [ãŠãŒã¶ãŒå]
sudo service docker restart
ãå®æœããã¿ãŒããã«ãéããªãããŸããããããã«ãããé root ãŠãŒã¶ãŒã§ã docker ã䜿çšã§ããããã«ãªããŸããã
ãã®ã¬ãã®ã¹ã¯ãªããã§ã»ãŒã€ã³ã¹ããŒã«ã¯å®äºããã®ã§ã次ã®é çªã§ã³ãŒããå ¥ããŠãããŸãããã
sudo apt-get install -y git
git clone https://github.com/liray-unendlich/mip-docker-swarm.git
cd mip-docker-swarm
git checkout testnet
cp example.env .env
ãããŸã§ã§ãã³ãŒãã®ããŠã³ããŒããå®äºããŸããã æåŸã®è¡ã§ãexample.env ã.env ãšããŠã³ããŒããŸããã®ã§ã.env ãèªåçšã®èšå®ã«å€æŽããŸãããã 詳ããã¯ã envãã¡ã€ã«ã®èšå®äºé ã«ã€ã㊠ã確èªãã ããã
ãããŸã§ã®MIPã¬ããžããªãšæ§é ãå€ãã£ãã®ã§ããããŸã§åãããŠããæ¹ã¯ã次ã®ã³ãã³ãã䜿ã£ãŠããŒã¿ãåé€ããŸãããã
docker stack rm $(docker stack ls --format "{{.Name}}")
rm -r ~/mip-docker-swarm/data/postgres/*
ããã§ã¯ãã¹ã¯ãªããã䜿ã£ãŠããµãŒããŒããšã®åæèšå®ïŒdocker swarm ã®èšå®çšïŒãè¡ããŸãããã ãŸãã次ã®ã³ãã³ããããµãŒã㌠äžã§å®æœããŸãã
chmod +x init-manager.sh
bash init-manager.sh
ã¹ã¯ãªããå®è¡æã管çè ãã¹ã¯ãŒãã®å ¥åãå¿ èŠãšãªããŸãããã®ã¹ã¯ãªããã«ãã£ãŠãdocker swarm ã®ã¯ã©ã¹ã¿ãŒãçæãããtraefik/swarmpit/portainer/prometheus/grafana ãã€ã³ã¹ããŒã«ããŸããããµãŒããŒã®åäœãé©åã«ãªãããŠãããã確èªãããããWeb UI(Swarmpit/Portainer)ã確èªããŸãããã
envãã¡ã€ã«ã®èšå®äºé ã«ã€ã㊠ã§èšå®ãã"swarmpit.sld.tld/portainer.sld.tld"ã«æ¥ç¶ããŠã¿ãŸãããããããšãæåã«ã¢ã«ãŠã³ãèšå®ãèŠæ±ãããåŸããã°ã€ã³ã§ããããã«ãªãã¯ãã§ããããã§ã¯ãè€æ°ã®ãµãŒããŒã«ãŸããã£ãŠåãã¯ã©ã¹ã¿ãŒã®ãµãŒããŒã®åŠçç¶æ³ãããã»ã¹ç¶æ³ã確èªããããšãåºæ¥ãŸãïŒäžã«äŸç»åã匵ãä»ããŠããŸãïŒãåŸã§åæèšå®ããããã€ã³ããã¯ã¹ãµãŒããŒã®èšå®ã®ãã°ããæ§ã ãªèšå®ã WebUI ããå€æŽã§ããŸãã
次ã«ãå¿ èŠãªãµãŒãã¹ãšãªãã以äž4ãµãŒãã¹ã皌åãããŸãã
- ã€ã³ããã¯ã¹ããŒãïŒã¯ãšãªããŒããå¿ èŠãšããã€ã³ããã¯ã¹æžã¿ããŒã¿ãæäŸããïŒ
- ã¯ãšãªããŒãïŒã€ã³ããã¯ã¹ãµãŒãã¹ã«ã¯ãšãªããŒã¿ãæäŸããïŒ
- ã€ã³ãã¯ãµãŒãšãŒãžã§ã³ãïŒGraph Networkãšæ¥ç¶ããã€ã³ããã¯ã¹ããŒãã®ç®¡çãè¡ãïŒ
- ã€ã³ãã¯ãµãŒãµãŒãã¹ïŒGraph Networkãšæ¥ç¶ããã¯ãšãªæäŸãè¡ãïŒ ãã®ãµãŒãã¹ã皌åãããããã«ã次ã®ã³ãã³ãããµãŒããŒäžã§å®è¡ããå¿ èŠãªèšå®ãã¡ã€ã«ã®æŽæ°ãå§ããŸãããã
cp graph-node-config/config.tmpl graph-node-config/config.toml
nano graph-node-config/config.toml
ãã®ã³ãã³ãã«ããã次ã®ç»åã®ãããªç»é¢ã衚瀺ãããã¯ãã§ãã
ãã®ãã¡ã€ã«ã¯ãã€ã³ããã¯ã¹ããŒãåã³ã¯ãšãªããŒãããæ§ã ãªãã§ãŒã³ã§é©åã«ããŒã¿ãååŸããããã®èšå®ãã¡ã€ã«ã«ãªã£ãŠããŸããããªãã¡ãã©ããªãã§ãŒã³ããã©ã®ãããªãšã³ããã€ã³ãã®çµããããŒã¿ååŸããããå®çŸ©ããŠããŸããgraph-nodeã®configã«ã€ã㊠ãããèšå®æ¹æ³ãã芧ãã ããã
â»ä»ã©ã®ãã§ãŒã³ã®ãã¹ãããããè¡ã£ãŠãããã¯ãNotionããã芧ãã ããïŒæŽæ°å€ããŠè¿œããããªãã®ã§ïŒãäžã®ãµãã°ã©ãäžèŠ§ãããå¿ èŠãªãµãã°ã©ãã«å²åœãè¡ããŸãããã
ããŠãconfig.tomlãé©åã«èšå®åºæ¥ããããµãŒããŒäžã§ã次ã®ã³ãã³ããäžè¡ãã€å®æœããŸãã
chmod +x update-indexer.sh
bash update-indexer.sh
ãã®ã³ãã³ããå®äºããã°ãswarmpit/portainerãã次ã®ç»åã®ããã«ã€ã³ãã¯ãµãŒãèµ·åããŠããããšããããã¯ãã§ãã
ãŸãããã®åç»ã®ããã«portainerãæäœããããšã§ããã©ãŠã¶äžã§ã³ã³ãããžã®ã¢ã¯ã»ã¹ã»ã³ãã³ãéä¿¡ãåºæ¥ãããã«ãªããŸãããã®åç»ã§ã¯ãindexer-cliãæäœããŠãindexer statusã衚瀺ãããŠããŸãã
https://testnet.thegraph.com ã§ã€ã³ãã¯ãµãŒã«ãªãããã200kGRT ãã¹ããŒãã³ã°ããå¿ èŠããããŸãã
- https://testnet.thegraph.com ãžè¡ã
- äžã® goerli ETH ã¢ãã¬ã¹ãèšå®ãã Metamask ã§æ¥ç¶ãã
- å³äžã®ã¢ãã¿ãŒãã¯ãªãã¯ãã
- Indexing ã¿ããã¯ãªãã¯ããStake ãã¿ã³ãæŒãïŒãã®æã200kGRT ãã¹ããŒãã³ã°ïŒ
ãããå®äºãããšãã€ã³ãã¯ãµãŒãšããŠã®ç»é²ãå®äºããŸããâ»ãªãã¬ãŒã¿ãŒèšå®ã¯ãªãã·ã§ã³ãªã®ã§ããã¹ããããã®å ±é ¬ãšã¯çŽæ¥é¢ä¿ãããŸããã
次ã«ããªãã¬ãŒã¿ãŒãšããŠãµãã®ãŠã©ã¬ãããèšå®ããŸãïŒã€ã³ãã¯ãµãŒãŠã©ã¬ãããšãªãã¬ãŒã·ã§ã³ãŠã©ã¬ãããåãã人ã¯ããããããšããïŒã
- https://testnet.thegraph.com ãžè¡ã
- äžã® goerli ETH ã¢ãã¬ã¹ãèšå®ãã Metamask ã§æ¥ç¶ãã
- å³äžã®ã¢ãã¿ãŒãã¯ãªãã¯ãã
- Operators ãã¿ã³ãã¯ãªãã¯ãã+ ãã¿ã³ãæŒããŠä»ã®ã¢ãã¬ã¹ãè¿œå ãã
次ã«ããµãã°ã©ããã€ã³ããã¯ã¹éå§ããããã®æç¶ãã説æããŸãã portainerãããstack > indexer > indexer-cli ãšç§»åããã³ã³ãœãŒã«ãéããŸãããã 次ã®ã³ãã³ããäžè¡ãã€å ¥åããã¢ãã±ãŒã·ã§ã³ãè¡ããŸãããã
ãŸãã40000ã¯å²ãåœãŠããææ°ã«é©å®å€æŽããŠãã ããïŒææ°ã®å€§å°ã¯å ±é ¬ã«åœ±é¿ããŸããïŒã
graph indexer rules set QmTTUYzPWZjJotwhCej2KhXVygg9mbyTYXLqsTf7zNkxMc decisionBasis always allocationAmount 50000
graph indexer rules set QmYPTfFCmQPdD2jinmTRzmkqfuThGTVtat99xKy64q5QnG decisionBasis always allocationAmount 50000
graph indexer rules set QmcCzAgW7ZN7Bhwa8Mf5n7JzPxjX7c3ex1wEHVCYrpawjV decisionBasis always allocationAmount 50000
ãã®ã³ãã³ããå®è¡ãããšããªãã¬ãŒã¿ãŒãŠã©ã¬ããããTXãçºä¿¡ããã¢ãã±ãŒã·ã§ã³ãå®æœãããŸãããã®åŸãgrafanaã®ããã·ã¥ããŒãã§ç¢ºèªãããšãã€ã³ããã¯ã¹ãéå§ããŠããã¯ãã§ãã
次ã®ã³ãã³ããå®è¡ããããšã§ãä»æå¹ã«ãªã£ãŠããã¢ãã±ãŒã·ã§ã³ã®äžèŠ§ãååŸã§ããŸãã
graph indexer allocations get --status active
ã¢ãã±ãŒã·ã§ã³ãçµäºããéã¯ãã¢ãã±ãŒã·ã§ã³ã®IDãå¿ èŠã«ãªãã®ã§ã泚æããŠãã ããã
次ã«ãã€ã³ããã¯ã¹ããããããµãã°ã©ãïŒãšãããã¢ãã±ãŒã·ã§ã³ïŒãçµäºããããã®æç¶ãã説æããŸãã portainerãããstack > indexer > indexer-cliãšç§»åããã³ã³ãœãŒã«ãéããŸãããã 次ã®ã³ãã³ããäžè¡ãã€å ¥åããã¢ãã±ãŒã·ã§ã³ãçµäºããŸãããã
graph indexer allocations close *ã¢ãã±ãŒã·ã§ã³ã®ID*
ãã ãããµãã°ã©ããåæããã£ãŠããªããã°ããã®æ¹æ³ã§ã¯ã¢ãã±ãŒã·ã§ã³ãçµäºã§ããŸããããããå ±é ¬ãç¡ããŠãããããã匷å¶çã«ã¢ãã±ãŒã·ã§ã³ãçµäºãããšãã«ã¯ã次ã®ã³ãã³ãã䜿ããŸãããã
graph indexer allocations close *ã¢ãã±ãŒã·ã§ã³ã®ID* 0x0 --force
ä»åã以äžã® docker stack ãçæã»éçšããŠããŸãã
- Swarmpit/Portainer(docker swarm ã® WebUI. ãã®ã¹ã¯ãªããã§ã¯ãconfig ã docker swarm ã®æ©èœã䜿çšããŠã¢ããããŒãããŠããã®ã§ãåççã«ã¯ãdocker swarm ã«ãµãŒããŒãå ¥ããåŸã¯ãå šãŠ Swarmpitãããã¯Portainer äžããããããã¯èšå®ãåºæ¥ãããã«ãªããŸããcurlã³ãã³ãçã¯portaineräžã§ãããŸã)
- Traefik(ããŒããã©ã³ãµãŒãSSL 蚌ææžçã®çºè¡ããŸãšããŠãã£ãŠãããŸããbasicauth ããã£ãŠããŸã)
- Prometheus(index-node, query-node ããnode-exporter ããæ å ±ãåãåããèç©ããŠããŸã)
- Grafana(prometheus ããåãåã£ãæ å ±ããpostgreSQL ããåãåºããããŒã¿ãå¯èŠåããŸã)
- postgreSQL
- index-node(graph-node ã®åœ¹å²ãã€ã³ããã¯ã¹ã®ãã®ã)
- indexer-agent/service(index-node/query-node ã管çããå€éšããæ¥ãã¯ãšãªã«å¿çããŸã)
å®éã«ããããªç»é¢ïŒç¹ã« Swarmpit/Portainer ãš GrafanaïŒãèŠãŠã¿ãŠãã ããã
ä»åŸããµãŒããŒã®æŽæ°ã¯ãåå次ã®ïŒè¡ã®ã³ãã³ãã1è¡ããšã«ãµãŒããŒäžã§å®æœããããšã§è¡ãããŸãã â»ãã®äžã«ã¯ãèšå®ãã¡ã€ã«ã®æŽæ°ã¯å«ãã§ããŸããã
bash init-manager.sh
bash update-indexer.sh
ãã£ãšã«ã¹ã¿ã ããã人åãã«ãç°¡åãªã¡ã¢ãå ¥ããŠãããŸãã
graph-node-config/config.tmpl ã«ã¯ãäžã®ãããªæ å ±ãèšèŒãããŠããŸãããã® config ãã¡ã€ã«ãçŽæ¥ãµãŒãã¹ã«èªã¿èŸŒãŸããããšã§ãèšå®ãåºæ¥ãŸãã äžèšå®äŸã®äžã«ãåãµãŒãã¹ã®å¯Ÿå¿ç¶æ³ãè¡šã§èšèŒããŠããŸãã
# ã€ã³ããã¯ã¹ããŒã¿ãä¿ç®¡ããDBãæå®ãããèªåã§.envããããŒãããªãã®ã§ãèªåã§å
¥ããŠãã ããã»ã»ã»ã»ã
[store]
[store.primary]
connection = "postgresql://${DB_USER}:${DB_PASSWORD}@postgres:5432/${DB_NAME}"
pool_size = 10
# åãããã¯ãã§ãŒã³ã®ææ°ãããã¯ãŸã§ã®åæãã©ã®index-nodeãè¡ããæå®ããŸãããã®ãŸãŸã§OKã
[chains]
ingestor = "index_node_0"
# Chainstackã®ãããªããã«ããŒããšã¢ãŒã«ã€ãããŒãã®APIè²»çšã«å·®ããããããªãµãŒãã¹ã§ã¯ã
# ãã«ããŒããšã¢ãŒã«ã€ãããŒããå¥ã
ã«èšå®ããããšã§ãæ¯èŒçå®äŸ¡ã«ã€ã³ããã¯ã¹ãå¯èœã«ãªããŸãã
# providerã«ãŠãåãµãŒãã¹ãžã®æ¥ç¶ãèšå®ããŠããŸããfeaturesã«ãŠãæå®ãããµãŒãã¹ããã«ããŒããã
# ã¢ãŒã«ã€ãããŒããããã¬ãŒã¹æã®ã¢ãŒã«ã€ãããŒãããæå®ããŸãã
# ããããã[],["archive"],["archive", "traces"]ãšæå®ããããšã§ãé©åãªèšå®ã«ãªããŸãã
# äžã®äŸã§ã¯ãpolygon-xxxãšããŠãã«ããŒãããpolygon-yyyãšããŠãã¬ãŒã¹æã®ã¢ãŒã«ã€ãããŒããæå®ããŠããŸãã
# ãããpolygonã§ã®ã€ã³ããã¯ã¹ãããªãå Žåã[chains.polygon]ã®ã»ã¯ã·ã§ã³ã¯ãŸãããšåé€ããŠãã ããã
[chains.polygon]
shard = "primary"
provider = [ { label = "polygon-xxx", url = "https://xxx.io/", features = [] },
{ label = "polygon-yyy", url = "https://yyy.io/", features = ["archive", "traces"] }
]
# ãããgnosisã§ã®ã€ã³ããã¯ã¹ãããªãå Žåã[chains.gnosis]ã®ã»ã¯ã·ã§ã³ã¯ãŸãããšåé€ããŠãã ããã
[chains.gnosis]
shard = "primary"
provider = [ { label = "gnosis-xxx", url = "https://xxx.io/", features = [] },
{ label = "gnosis-yyy", url = "https://yyy.io/", features = ["archive", "traces"] }
]
# ãããarbitrumã§ã®ã€ã³ããã¯ã¹ãããªãå Žåã[chains.arbitrum-one]ã®ã»ã¯ã·ã§ã³ã¯ãŸãããšåé€ããŠãã ããã
[chains.arbitrum-one]
shard = "primary"
provider = [ { label = "arbitrum-one-xxx", url = "https://xxx.io/", features = [] },
{ label = "arbitrum-one-yyy", url = "https://yyy.io/", features = ["archive", "traces"] }
]
# ãããEthereumã§ã®ã€ã³ããã¯ã¹ãããªãå Žåã[chains.mainnet]ã®ã»ã¯ã·ã§ã³ã¯ãŸãããšåé€ããŠãã ããã
[chains.mainnet]
shard = "primary"
provider = [ { label = "gnosis-xxx", url = "https://xxx.io/", features = [] },
{ label = "gnosis-yyy", url = "https://yyy.io/", features = ["archive", "traces"] }
]
# ã€ã³ããã¯ã¹ãè¡ãéã®ãåã€ã³ããã¯ã¹ããŒããžã®å²ãåœãŠã«ãŒã«ãèŠå®ããŸãããã®ãŸãŸã§OKã
[[deployment.rule]]
shard = [ "primary" ]
indexers = [ "index_node_0", "index_node_1" ]
# ã¯ãšãªããŒã¿ãäœæããããŒããæå®ããŸãããã®ãŸãŸã§OKã
[general]
query = "query_node_*"
ãã¡ãã¯ããµãŒãã¹ããšã®å¯Ÿå¿ç¶æ³ã§ãã
ãµãŒãã¹å | features | åè |
---|---|---|
Chainstack | [] | Archiveãæå®ããŠããªããšã |
Chainstack | ["archive", "traces"] | Archiveãæå®ããŠãããšã |
Ankr | ["archive"] | - |
QuickNode | [] | ãŸã æ€èšŒããŠãŸãã |
envãã¡ã€ã«ã®èšå®äºé ãã©ãã©ãå¢ããŠããã®ã§ã以äžã«å 容ãåèšããŸã
é ç®å | äŸ | æå³ |
---|---|---|
USER_ID | 1000 | Linuxã«ãããUser ID |
GROUP_ID | 1000 | Linuxã«ãããGroup ID |
ROOT_DOMAIN | sld.tld | ä»ãµãŒãã¹ã䜿çšããããŒã¹ãã¡ã€ã³ |
TRAEFIK_USER | admin | traefikã®ãŠãŒã¶ãŒå |
TRAEFIK_PASSWORD | password | traefikã®ãã¹ã¯ãŒã |
TRAEFIK_EMAIL | email@gmail.com | SSL蚌ææžååŸçšã®ã¡ãŒã«ã¢ãã¬ã¹ |
DB_NAME | graph | ãããã¯ãã§ãŒã³ããŒã¿ãæ ŒçŽãã postgreSQLã®ããŒã¿ããŒã¹å |
DB_USER | user | postgreSQLã®ãŠãŒã¶ãŒå |
DB_PASSWORD | password | postgreSQLã®ãã¹ã¯ãŒã |
PROMETHEUS_USER | admin | prometheusã®ãŠãŒã¶ãŒå |
PROMETHEUS_PASSWORD | password | prometheusã®ãã¹ã¯ãŒã |
INDEXER_RPC | https://infura.io | ã€ã³ãã¯ãµãŒçšã®goerli RPC API(Full Node) |
INDEXER_ADDRESS | 0x.... | ã€ã³ãã¯ãµãŒã®goerli ETHã¢ãã¬ã¹ |
INDEXER_MNEMONIC | 12 words | INDEXER_ADDRESS ã«çŽã¥ãmnemonic |
INDEXER_GEO | "49.414 11.171" | ãµãŒããŒïŒãããŒãžã£ãŒïŒã® 緯床çµåºŠ |