Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Bambarello/44bdf24b2b5b1db99580e2ae61eb50cd to your computer and use it in GitHub Desktop.
Save Bambarello/44bdf24b2b5b1db99580e2ae61eb50cd to your computer and use it in GitHub Desktop.
#####GRAPH-NODE######
#####NPM INSTALL#####
sudo apt update && \
curl -sL https://deb.nodesource.com/setup_14.x | sudo bash - && \
sudo apt -y install nodejs && \
sudo apt install -y libsecret-1-dev && \
nodejs -v && \
npm version
####DATABASE-SERVER##################
####CREATE DATABASE FOR INDEXER####
sudo -i -u postgres
createdb graph-indexeragent
exit
exit
######################################
####AGENT & SERVICE INSTALL####
npm set registry https://testnet.thegraph.com/npm-registry/ && \
npm login
##ВВОДИМ ЛОГИН, ПАРОЛЬ и ПОЧТУ
npm install -g -f @graphprotocol/indexer-agent \
npm install -g -f @graphprotocol/indexer-service \
npm install -g -f @graphprotocol/indexer-cli \
npm install -g -f --unsafe-perm=true --allow-root @graphprotocol/[email protected] ###Игнорируем ошибки!
####ADDING SERVICES############
export ETHEREUM_RPC=https://rinkeby.infura.io/v3/
export INDEXER_URL=$(curl -s ifconfig.me)
export SERVER_HOST=ip
export SERVER_PORT=5432
export SERVER_DB_NAME=graph-indexeragent
export SERVER_DB_USER=postgres
export SERVER_DB_PASSWORD=password
export MNEMONIC='12 words'
sudo ### IF NOT UNDER ROOT
## --indexer-geo-coordinates #Смените координаты под ваш город: Хельсинки: 60.16952 24.93545, Филькенштайн: 49.101719 12.494180
###COPY FROM HERE###
bash -c 'cat <<EOF >> /etc/systemd/system/graph-indexer-agent.service
[Unit]
Description=Graph Chain Indexer Agent
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
User=$(id -u -n)
Restart=always
RestartSec=1
ExecStart=/usr/bin/graph-indexer-agent start \
--graph-node-query-endpoint http://localhost:8000/ \
--graph-node-admin-endpoint http://localhost:8020/ \
--graph-node-status-endpoint http://localhost:8030/graphql \
--public-indexer-url http://$INDEXER_URL/ \
--indexer-management-port 18000 \
--indexer-geo-coordinates 60.10986 24.73851 \
--postgres-host $SERVER_HOST \
--postgres-port $SERVER_PORT \
--postgres-database $SERVER_DB_NAME \
--postgres-username $SERVER_DB_USER \
--postgres-password $SERVER_DB_PASSWORD \
--index-node-ids default \
--network-subgraph-endpoint https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-rinkeby \
--ethereum $ETHEREUM_RPC \
--mnemonic "$MNEMONIC"
[Install]
WantedBy=multi-user.target
EOF'
bash -c 'cat <<EOF >> /etc/systemd/system/graph-indexer-service.service
[Unit]
Description=Graph Chain Indexer Service
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
User=$(id -u -n)
Restart=always
RestartSec=1
Environment="SERVER_HOST=$SERVER_HOST"
Environment="SERVER_PORT=$SERVER_PORT"
Environment="SERVER_DB_NAME=$SERVER_DB_NAME"
Environment="SERVER_DB_USER=$SERVER_DB_USER"
Environment="SERVER_DB_PASSWORD=$SERVER_DB_PASSWORD"
ExecStart=/usr/bin/graph-indexer-service start \
--port 80 \
--graph-node-query-endpoint http://localhost:8000/ \
--network-subgraph-endpoint https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-rinkeby \
--graph-node-status-endpoint http://localhost:8030/graphql \
--ethereum $ETHEREUM_RPC \
--mnemonic "$MNEMONIC"
[Install]
WantedBy=multi-user.target
EOF'
###COPY TO HERE###
sudo systemctl daemon-reload
sudo systemctl start graph-indexer-agent
sudo systemctl start graph-indexer-service
####INDEXER CLI####
graph indexer connect http://localhost:18000/
graph indexer status
####CLI ADD RULES ####
graph indexer rules always Qme2hDXrkBpuXAYEuwGPAjr6zwiMZV4FHLLBa3BHzatBWx
graph indexer rules always QmXKwSEMirgWVn41nRzkT3hpUBw29cp619Gx58XW6mPhZP
graph indexer rules always QmTXzATwNfgGVukV1fX2T6xw9f6LAYRVWpsdXyRWzUR2H9
graph indexer rules start Qme2hDXrkBpuXAYEuwGPAjr6zwiMZV4FHLLBa3BHzatBWx
graph indexer rules start QmXKwSEMirgWVn41nRzkT3hpUBw29cp619Gx58XW6mPhZP
graph indexer rules start QmTXzATwNfgGVukV1fX2T6xw9f6LAYRVWpsdXyRWzUR2H9
graph indexer rules always global
graph indexer rules set Qme2hDXrkBpuXAYEuwGPAjr6zwiMZV4FHLLBa3BHzatBWx allocationAmount 100
graph indexer rules set QmXKwSEMirgWVn41nRzkT3hpUBw29cp619Gx58XW6mPhZP allocationAmount 100
graph indexer rules set QmTXzATwNfgGVukV1fX2T6xw9f6LAYRVWpsdXyRWzUR2H9 allocationAmount 100
graph indexer status
### Копируем выхлоп и закидываем в форму в последнее поле, предварительно убедиться чтобы все было UP!!!
https://airtable.com/shrTnJukfu2jArJnN
####PRMETHEUS METRICS########
nano /etc/prometheus/prometheus.yml
- job_name: 'graph-indexer-service'
metrics_path: /
static_configs:
- targets: [localhost:7300]
sudo ufw allow 80/tcp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment