How the IPFS cluster peer ID is generated? How to mange the bootstrap (first peer) peer ID programmatically?

Hi guys, hope you guys are having a good day.

I have some questions.

How the IPFS cluster peer ID is generated? And how we mange the bootstrap (first peer) peer ID programmatically?

It seems that if I change the configuration of the (first) peer and then restart the node, the peer ID changes. As a result, I have to manually update the new peer multiaddress (which is in the form /dns4/{firstpeer.ip}/tcp/9096/ipfs/{peerID}) for other peers that depends on the first peer to bootstrap themselves.

FYI, I am using docker-compose to manage ipfs cluster and ipfs daemon. Changing the configuration and restarting the peer by updating the docker-compose.yaml and docker-compose up, docker-compose down.

Many thanks.

Hi guys,

Here is an update. My problem is that I did not mount the volumes to persist data inside docker container so whenever I start the docker container again, the cluster peer ID gets re-generated. Simply mounting the volumes solves the problem.

For your further reference, the peer ID and private key can be manually generated and put inside identity.json under the mounted volume path without being overwritten when restart the container. Use this GitHub - whyrusleeping/ipfs-key: A program to generate ipfs private keys to generate