Setup L2-parachain node
We use docker to run the node in a container:
See docker images.
A parachain always also runs a relaychain tracking relaychain blocks so we will also need the relaychain chain-spec:
- Mainnet
- Stagingnet
- Devnet
-
Create a folder for the node on your server:
mkdir -p mainnet-collator-x data
WIPEnsure your folder for the collator has a unique name in case you run other collators/validators on the same machine. Otherwise docker compose might treat them as the same container.
-
Copy the 3 files to the folder:
-
Open docker-compose.yml and insert
<YOUR SERVER IP>
and optionally adapt the ports and docker image tag if outdated (it's not set to latest tag by default to avoid suddenly breaking your applications because of upcoming incompatibilites with newer images).Highlight changes
services:
node:
image: "gluechain/mainnet-glue-para-node:glue-v0.2.0"
command: "--node-key <NODE KEY>
--chain /node/glue-main-raw.json \
--ethapi=txpool \
--trie-cache-size 2073741824 \
--db-cache 30000 \
--base-path /node/data \
--bootnodes /ip4/82.220.91.85/tcp/30645/p2p/12D3KooWSyDYvsPMdcaiwZrJ3XHvH4fpxmiBHoyPw4rZJ5aVDMSi /ip4/185.178.192.73/tcp/30633/p2p/12D3KooWPMbmnsoKACiX8xjnz7LtsR6sZtAthJ7sjtwPuVtgzRQZ /ip4/82.220.91.85/tcp/30634/ws/p2p/12D3KooWPU6p6inZGXrcqwYRv52FpoHpWvf9goQ2eFQPxjVrauyx \
--port 30633 \
--rpc-port 9963 \
--rpc-external \
--unsafe-rpc-external \
--rpc-methods unsafe \
--rpc-cors all \
--database=rocksdb \
--pruning=archive \
--public-addr=/ip4/<YOUR SERVER IP>/tcp/<YOUR PORT SPECIFIED WITH --port ABOVE> \
-- \
--chain /node/glue-relaychain-main-raw.json \
--bootnodes /ip4/82.220.38.222/tcp/30350/p2p/12D3KooWM7aJBsDma7q2gZmKm5d92Sbuqg54HtJEqDPUrdunepWF /ip4/185.142.214.6/tcp/30350/ws/p2p/12D3KooWJBQfccTBw9uvj93WwGGWManXTeGmJSL8BG4huzjpu6ad /ip4/185.178.192.73/tcp/30350/p2p/12D3KooWMx2yh6DvypMrYzg7Go96JAsHDdLNyzipEQXaaobVTiaX /ip4/82.220.91.85/tcp/30350/p2p/12D3KooWKsKk7P62LcaqspsUD5FhmojYmDZv4aeS11Fqe63dA7GR /ip4/82.220.91.69/tcp/30350/ws/p2p/12D3KooWDSDiXhhvLTasSvkHS7pwMGVczPSvFDVHDW25Lhvi3o8z /ip4/82.220.91.85/tcp/30351/ws/p2p/12D3KooWGrcHbYMfswS2SWTRJzVyQoWR7fRY5eXtNgyJK5RCVMiA \
--port 30643 \
--rpc-port 9961"
ports:
- "30633:30633"
- '9963:9963'
- "30643:30643"
- "9961:9961"
volumes:
- ./:/node
restart: always
-
Create a folder for the node on your server:
mkdir -p mainnet-collator-x data
WIPEnsure your folder for the collator has a unique name in case you run other collators/validators on the same machine. Otherwise docker compose might treat them as the same container.
-
Copy the 3 files to the folder:
-
Open docker-compose.yml and insert
<YOUR SERVER IP>
and optionally adapt the ports and docker image tag if outdated (it's not set to latest tag by default to avoid suddenly breaking your applications because of upcoming incompatibilites with newer images).Highlight changes
services:
node:
image: "gluechain/stagingnet-glue-para-node:glue-v0.1.2"
command: "--node-key <NODE KEY>
--chain /node/glue-staging-raw.json \
--ethapi=txpool \
--trie-cache-size 2073741824 \
--db-cache 30000 \
--base-path /node/data \
--bootnodes /ip4/104.199.23.166/tcp/30333/p2p/12D3KooWKGWSRb9rVPTrymoC7iz7LTfa6k6EpvcuXijfyeWco14k /ip4/35.246.255.206/tcp/30333/p2p/12D3KooWKM9FTMA877HSsLobGHQFtmcSCeReyty8H7XCPdoNcKWv \
--port 30633 \
--rpc-port 9963 \
--rpc-external \
--unsafe-rpc-external \
--rpc-methods unsafe \
--rpc-cors all \
--database=rocksdb \
--pruning=archive \
--public-addr=/ip4/<YOUR SERVER IP>/tcp/<YOUR PORT SPECIFIED WITH --port ABOVE> \
-- \
--chain /node/glue-relaychain-staging-raw.json \
--bootnodes /ip4/104.199.23.166/tcp/30350/p2p/12D3KooWNR8C4yQcdc7PBq9YDqTTiR6sUoKec1WDuVwQGzv7szLK /ip4/34.141.164.71/tcp/30350/p2p/12D3KooWD7Kjp9PgXPVDmoh5qmgsPaeFcfpNKxE65Lmd7GAVsvds \
--port 30643 \
--rpc-port 9961"
ports:
- "30633:30633"
- '9963:9963'
- "30643:30643"
- "9961:9961"
volumes:
- ./:/node
restart: always
-
Create a folder for the node on your server:
mkdir -p mainnet-collator-x data
WIPEnsure your folder for the collator has a unique name in case you run other collators/validators on the same machine. Otherwise docker compose might treat them as the same container.
-
Copy the 3 files to the folder:
-
Use the
subkey
utility to generate a unique ID for the p2p protocol:docker run --network="host" -v "./:/node" \
-u $(id -u ${USER}):$(id -g ${USER}) \
gluechain/devnet-glue-para-node:0c553b3b32ab117be015cdde235bc41f84b55420 key generate-node-key --base-path /node/data --chain /node/chain-specs/glue-dev-raw.jsonE.g. outputs
12D3KooWQsNL8M7y1Yo54jkJsH6MqqNiTvB19XxPEtfeBpVH14FR
.Validate that the secret was created:
ls data/chains/glue-dev/network/secret_ed25519
-
Open docker-compose.yml and insert
<YOUR SERVER IP>
,<NODE KEY>
and optionally adapt the ports and docker image tag if outdated (it's not set to latest tag by default to avoid suddenly breaking your applications because of upcoming incompatibilites with newer images).Highlight changes
services:
node:
image: "gluechain/devnet-glue-para-node:glue-v0.1.2"
command: "--node-key <NODE KEY>
--chain /node/glue-dev-raw.json \
--ethapi=txpool \
--trie-cache-size 2073741824 \
--db-cache 30000 \
--base-path /node/data \
--bootnodes /ip4/34.22.158.6/tcp/30333/p2p/12D3KooWPkVMWjJheQJfo6JsvnY9ZSbz9u77DE6MtFyRFo9c5x4J \
--port 30633 \
--rpc-port 9963 \
--rpc-external \
--unsafe-rpc-external \
--rpc-methods unsafe \
--rpc-cors all \
--database=rocksdb \
--pruning=archive \
--public-addr=/ip4/<YOUR SERVER IP>/tcp/<YOUR PORT SPECIFIED WITH --port ABOVE> \
-- \
--chain /node/glue-relaychain-dev-raw.json \
--bootnodes /ip4/34.34.41.37/tcp/30350/p2p/12D3KooWP9otrRthUdgAUL3ZXDR4zhh1dwSMDkdrAB9AG2ycZ1XT /ip4/34.22.158.6/tcp/30350/p2p/12D3KooWGqrWbQ7VyJdh4oju5GK8qa5SKQBuwvjK4R6qzCp1V416 \
--port 30643 \
--rpc-port 9961"
ports:
- "30633:30633"
- '9963:9963'
- "30643:30643"
- "9961:9961"
volumes:
- ./:/node
restart: always
On the server:
-
Run
docker compose up -d
in the same folder. -
Check logs with
docker compose logs -f
and see if it logs that it's syncing ([🌗] 🆕 Imported
is enough to know bootnodes discovery worked, and💤 Idle
tells you that node is synced. -
Once synced, go ahead and expose the collator (9934) over a reverse proxy of your choice (nginx, caddy)
Upgrade node​
When being notified that a new binary version is ready, you should change the image in docker-compose.yml
to the defined version.
We recommend using specific version and not latest
for maximum reproducibiltiy of issues.
Then restart while ensuring it pulls the changed version (you can validate in the output that a new version is pulled indeed):
docker compose up -d --build
Setup reverse proxy (load balancing)​
-
copy this file to
/etc/caddy/Caddyfile
glue-l2-node.<YOUR DOMAIN> {
@websockets {
header Connection *Upgrade*
header Upgrade websocket
}
reverse_proxy @websockets localhost:9963
reverse_proxy localhost:9963 {
transport http {
versions 1.1
}
}
} -
[Optional] add multiple
host:port
upstreams to activate load balancing -
Validate proxy config
caddy validate --config /etc/caddy/Caddyfile
-
Restart proxy
systemctl restart caddy