How to update website files for IPFS on Linux

Hi, this is a very simple question but I’ve struggled to find a simple answer so far.

I have IPFS running on Linux (command line only), I added my website file index.html and pinned it according to many tutorials.

How do I go about updating the content of the website? It seems like just editing the file doesn’t reflect on what’s live. Tried re-pinning as well with no luck.

Any help is appreciated.

Ian

1 Like
  1. Edit
  2. Re-add it → you will get a new hash
  3. Your new website can be accessed on the new hash.

If you need a reference that does not change see:

ipfs name publish <your hash> (IPNS)

Or use dnslink (https://dnslink.io).

Thanks.

I modified my test.html file > ipfs add test.html > ipfs pin add test.html

The website does not load under the new hash at ipfs.io/ipfs/exampleHash

Am I missing something?

Did it work before and is only not working with the new hash or have you never been successful retrieving a file from the gateway?

Yes, the test website loaded perfectly before I re-add and re-pin

I’d double check to make sure your daemon is running.

hello.
You missed complete the point of hector’s answer …

lets say your page is here: /home/myipfs/site1/test.html

you publish your site, and connected with your main peer_hash_id

  1. hash your site
    ipfs add -r /home/myipfs/site1/
    now you have a hash_id that points to /home/myipfs/site1/

  2. connect your site to your peer_hash_id
    ipfs name publish <hash_id>

You got an answer like this:
> Published to <peer_hash_id>: /ipfs/<hash_id>

From now on your site is publish, under
/ipns/<peer_hash_id>

ie: ipfs cat /ipns/<peer_hash_id>/test.html
or: curl https://gateway.ipfs.io/ipns/<peer_hash_id>/test.html

  • every time you change something inside your site, follow again steps 2 and 3
  • what you publish in step 3, is the hash of the root folder of your site, and not the hash of ‘test.html’, except if your site is just that page.

+++ in any case, IPNS | IPFS Docs has the key …

…and you seem to have completely missed the question. They said the re-added it and re-pinned it. The only confusion is if they tried using the old hash or the new hash. (I’m guessing theres’ a good chance they indeed tried the new hash) If they did try the old hash there could be some confusion about hashes in which case IPNS is what they’re looking for. If they did use the new hash then something else is going on.

Since you seem to enjoy critiquing other peoples responses let me offer that you should confine yourself to the quality of your own responses.

I would maybe think about using a service like Fleek and looking at their Space SDK.

Dear @Ian,

I encounter often similar problems due to network “isolation” … a public gateway might take some long time to discover your new files.
Also I have noticed that /ipns/ urls take about 2 minutes to “propagates” (w/o pubsub) … any link with and ipns key might get resolved with an older version of the mutable.

I put together a little static site you can modify (editable) and publish and test the
gateways : https://gateway.ipfs.io/ipfs/QmZZ5PTYCjET19PZfUBA22psuoXwt4L2wQVD6KYZ1icsaN/

Here is what I usually do for publishing a static site:

  • place a pin on the files,
  • connect a public gateway via its PeerID
  • send a HEAD request for the gateway to fetch the files

and I repeat the 3 steps every time I changed a file on the website.

This can be done with the following command lines:

hash=$(ipfs add -w index.html style.css --pin=true -Q)
ipfs swarm connect /ip4/147.75.109.213/udp/4001/quic/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN
curl -I https://gateway.ipfs.io/ipfs/$hash/ | grep -i ipfs
xdg-open https://gateway.ipfs.io/ipfs/$hash/

w/ care
+Michelc (aka Dr IT)
– 
http://www.drit.ml