Updating IPNS contents on different machines

Im having a bit of trouble understanding how i can update a folder iv added to my cluster.
I can add and publish the file.

ipfs-cluster-ctl add -r myfolder
ipfs name publish <myfolderhash>

I can then find my folders contents in /ipns/

But if i try and update those contents on one of those servers in my cluster and republish it i get a different ipns hash instead of it being under the existing hash. How can i use the same ipns hash when updating the contents of the folder?

1 Like

You could create a key specifically for your publish via ipfs key gen <name>, export the key with ipfs key export <name>, and publish using your cluster using ipfs name publish -k <name> <myfolderhash>

There’s one caveat here where if multiple nodes publish the the same name at the same time, likely only one record will be respected. Unsure of 100% what happens in that situation, but you can effectively end up with multiple valid records IIRC.

Another option would be to use a service like w3name.

There is another issue with that. An IPNS record contains a count which is incremented each time you publish a new one. If you use multiple nodes, they each have their own count, and you get a big mess

1 Like

Yeah I wasn’t sure if the count could/would be updated based on the most recent record it’s seen. I haven’t actually looked at the code.