EDIT: Well, I should have first mentioned my website is only .html files and images. So: Warning: This ONLY works for a static website, which you update all the ipfs instances at the same time. On anything non-static, as explained below by @ylempereur, these instructions will just… create a real mess (i.e.: a random number of people will be accessing a random snapshot of your website done a random point in recent time – always).
Guess what. One year later and I finally was able to try everything properly and I can now tell you, YES, it’s possible to have the same exact, immutable, IPNS key for multiple servers, and it works. The standard kubo instance only has (auto-generated) “self” keys, but you can create other keys:
ipfs key gen super
ipfs key export super
(The key will then be saved as super.key in the current folder.)
Then, you take this super.key file, and put it in the other server(s), possibly somewhere in the .ipfs folder to avoid weird “permission denied” errors. And on all these other server(s) you do:
ipfs key import super super.key
ipfs key list -l
ipfs key list -l will give you the long CID of the “super” key. Then, on all your servers, you will be able to:
ipfs name publish --key=(long-superkey-IPNS-CID) (your-latest-files-IPFS-cid)
Your IPFS CIDs can change as much as they want, they will now always be linked by an immutable IPNS CID – just like a domain name. Yes. The same IPNS address. Forever. Associated to multiple servers. No need to install an IPFS Cluster. No need to buy a .eth or any other domain. Otherwise, no need to update your DNSLinks anymore, because it will always be the same IPNS address!
I find it so odd that there’s basically no info AT ALL on this when the main thing about IPFS is redundancy, i.e. the ability to host things on multiple servers. I spent two years thinking an IPNS key had to mean “one IP address of one machine”, therefore you had to get a domain name and update IPFS links all the time… until I found this message from 2017.
This really needs to be added everywhere in the help files and how-to’s. Otherwise it seems like it’s impossible to even host a simple, static website on multiple servers linked to one immutable address unless you spend a lot of time and money with IPFS Clusters and IPLD (?) and whatever else… But this might be just how the “big data guys” working with IPFS for a living do it too? I just did not knew it!
P.S.: Some guy at IPFS sure likes to have fun. Searching for base32/base36 encodings and which ones work and don’t, and at the end of the list was… base256emoji.
https://ipfs.io/ipfs/🚀🪐⭐💻😅😍🌼✌👌😉👋💔🤘🤐✈✊💿👈💣👎😕🤬😰😱😆😎🖤😶🙊🐶💎😒💜😴💕😀🦋
This is an actual website. This is https://en.wikipedia-on-ipfs.org/ … encoded in “base256emoji”.
P.S. 2: Parenthesis: Unstoppable domains.
I don’t know if “.eth” domains work, but Unstoppable Domains will not allow you to put something starting with “k51…” (any IPNS key) in the “IPFS” infos. You can:
ipfs cid format -v 1 -b base32 (k51…)
Which will change your key to base32 (starting with “bafzaa…”). The website will accept it… then mess everything up. Because it will redirect to ipfs .io/ipfs/bafzaa…(etc). : and give an Internal server error, because it’s supposed to be ipfs .io/ipns/bafzaa…(etc).
So, add that to the list of things Unstoppable Domains screwed up, I guess.
Anyway… enjoy!