Skip to content

Instantly share code, notes, and snippets.

@Gribnik2K
Last active August 23, 2020 13:17
Show Gist options
  • Save Gribnik2K/1eb5d9c4877935ec2b8bc9fe53bf053b to your computer and use it in GitHub Desktop.
Save Gribnik2K/1eb5d9c4877935ec2b8bc9fe53bf053b to your computer and use it in GitHub Desktop.
########ETH-NODE########
apt-get update
apt-get upgrade
apt-get install nginx
rm /etc/nginx/sites-enabled/*
nano /etc/nginx/sites-enabled/ether.conf
#Туда вот это ничего не меняя.
/начало файла
server {
listen 80;
listen [::]:80;
server_name localhost;
location ^~ /ws {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:8546/;
}
location ^~ /rpc {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:8545/;
}
}
/конец файла
systemctl daemon-reload
systemctl start nginx
systemctl enable nginx
systemctl restart nginx
Check
curl http://IP_ETH_SERVERA/rpc
Answer
Used HTTP Method is not allowed. POST or OPTIONS is required
Ok!
Firewall
iptables -A INPUT -s IP_GRAPH_SERVER -j RETURN
iptables -A INPUT -p tcp --dport 80 -j DROP
or
ufw allow from IP_GRAPH_SERVER to any port 80
##############################################################################################################
Optional Тут нода эфира не лезет в локалку.
ETH.SERVICE
nano /etc/systemd/system/openethereum.service
/начало файла
[Unit]
Description=OpenEthereum
Wants=network-online.target
After=network-online.target
[Service]
ExecStart=/usr/bin/openethereum \
--no-periodic-snapshot \
--pruning=archive \
--tracing=on \
--no-warp \
--db-compaction=ssd \
--cache-size=100000 \
--max-peers=64 \
--jsonrpc-threads=8 \
--jsonrpc-server-threads=100 \
--jsonrpc-hosts=all \
--jsonrpc-cors=all \
--allow-ips=public \
--ws-origins=all \
--ws-hosts=all
User=root
Group=root
Restart=on-failure
# Specifies which signal to use when killing a service. Defaults to SIGTERM.
# SIGHUP gives openethereum time to exit cleanly before SIGKILL (default 90s)
KillSignal=SIGHUP
[Install]
WantedBy=default.target
/конец файла
##############################################################################################################
###далее на ноду с графом###
И тут вот наша стартовая строка... Доступ вида http://IP_NODE_ETH/rpc
cargo run -p graph-node --release -- \
--postgres-url postgresql://postgres:xxx@localhost:5432/graph-node \
--ethereum-rpc mainnet:http://IP_NODE_ETH/rpc \
--ipfs https://testnet.thegraph.com/ipfs/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment