Running my Own Mainnet Node using Docker

Hello there !

Does anyone else Run his/her Own Mainnet Node using Docker ?

With the docker command specified in the documentation (3.c) for the mainnet :

docker run -p 30333:30333 -p 9933:9933 -p 9944:9944 --rm -it centrifugeio/centrifuge-chain:20201022093419-da56ac5 centrifuge-chain --validator --name="{name}" --node-key={node-key} --chain=mainnet --bootnodes=/ip4/34.89.245.58/tcp/30333/p2p/12D3KooWAVAMPNJywZS3J4be8gFGZACfgt1rXS3MyJ2MxEGtLXjr --bootnodes=/ip4/35.246.188.4/tcp/30333/p2p/12D3KooWCUjDbbhJf1o6skuE1EJ5PnKpJMaK6scmvWsHnjAULzDU

If your VPS reboot, or your container (your node centrifuge) exit for any reason, the container and the volume linked to it are removed… so you loose all the database… :sob:

That’s why I would like to share with you what I’ve done on my own, making possible to stop and start your container without stress. Feel free to give me some feedback !

First of all you need to create a docker volume bind to a local folder of your Vps:

docker volume create --name {VOLUME_NAME} --opt type=none --opt device={PATH_TO_LOCAL_FOLDER} --opt o=bind

Where for example:

{VOLUME_NAME} = my-awesome-centrinode-001

{PATH_TO_LOCAL_FOLDER} = ~/docker-volumes/centrifuge-chain/my-awesome-centrinode-001

You need to create folders using mkdir

Then change a bit the docker run command like this :

Here is the edited full command :

docker run --restart=always -p 30333:30333 -p 9933:9933 -p 9944:9944 -v {VOLUME_NAME}:/data -it centrifugeio/centrifuge-chain:20201022093419-da56ac5 centrifuge-chain --validator --name="{name}" --node-key={node-key} --chain=mainnet --bootnodes=/ip4/34.89.245.58/tcp/30333/p2p/12D3KooWAVAMPNJywZS3J4be8gFGZACfgt1rXS3MyJ2MxEGtLXjr --bootnodes=/ip4/35.246.188.4/tcp/30333/p2p/12D3KooWCUjDbbhJf1o6skuE1EJ5PnKpJMaK6scmvWsHnjAULzDU

Now if my Vps reboot, my Centrifuge Node will restart automatically in state ! \o/

This done, I still have an error message when I’m doing the last point of the documentation (4.) :

curl -H ‘Content-Type: application/json’ --data ‘{ “jsonrpc”:“2.0”, “method”:“author_rotateKeys”, “id”: 1 }’ http://127.0.0.1:9933

This command should return the public keys under the “result” field starting with `0x…

Instead the command returns : curl: (56) Recv failure: Connection reset by peer
Does anyone have this problem too ? In parallel I’m waiting for an answer on Slack.

Thank you for reading, have a good day !

5 Likes

I also got problems with the last step, I dont get any public keys back.

1 Like

Hello,

this answer was on slack general channel !
You need to --rpc-methods=Unsafe AND --rpc-external in the docker run command !

Here is the new complete command that fix the problem of the last step !

docker run -p 30333:30333 -p 9933:9933 -p 9944:9944 --rm -it centrifugeio/centrifuge-chain:20201022093419-da56ac5 centrifuge-chain --rpc-methods=Unsafe --rpc-external --validator --name="{name}" --node-key={node-key} --chain=mainnet --bootnodes=/ip4/34.89.245.58/tcp/30333/p2p/12D3KooWAVAMPNJywZS3J4be8gFGZACfgt1rXS3MyJ2MxEGtLXjr --bootnodes=/ip4/35.246.188.4/tcp/30333/p2p/12D3KooWCUjDbbhJf1o6skuE1EJ5PnKpJMaK6scmvWsHnjAULzDU

Tell me if that fix yours too !

1 Like

Hello ZDK,

It’s working well ;), thank you !

1 Like

thx, I will try it tonight :slight_smile:

1 Like

Thanks for this. I’m going to look at setting this up tomorrow morning - i’ll use the Docker process.

1 Like

I agree, the docker run command should be updated to included persistent storage. Good idea.

S