Few questions regarding a project I'm starting

Hi all,

I am currently starting to work on an app that will have a CLI client side and a server side. Since I wanted to dig into IPFS, I read the paper and I’m thinking to use IPFS to replace parts of the server for storing/distributing the data.

Now I have a few questions on the implementation/design side.

To give you an idea of the app architecture, think of Github. You have a cli side to add and push content, and server side to index/distribute the content.

So I’m aiming at the following architecture: - The server will be an always available IPFS node - It will pin any content pushed by the clients - It will have some custom web ui to browse the content - The cli client will also be an ipfs node - Adding content will add it to ipfs and ask the server to pull it (pin it)

No my questions:

  1. As I understand, in order to use IPFS on the client the ipfs daemon needs to be running. However I don’t want to have the users to run ipfs daemon as an extra step. Is there a clean or subtle way to integrate the ipfs daemon on the cli client ? Again think git, when I use git commands there is no daemon running

  2. Since the server will be always pinning any content from the clients when clients push content, is there a way to pull it on the server node directly given the client nodeid ? I mean is there a way to avoid all the DHT query and tell the node to get the value for the key directly from a specific nodeid ? This question is for both sides, when clients will download content, it would be great to get it directly from the server nodeid as first priority, and use other nodes as extra help if available

  3. Related to (2), is there a way to disable the bitswap strategy or be permissive when clients/server ipfs nodes communicate ?

  1. As a stopgap or backup method, you can use publicly available gateways as seen here: https://ipfs.works/ipfs/Qmbcbi6fUgRFXfCkn6L2qwN8UfUerKTzRKRrhRvduddtXa/
    This will allow anyone with internet access to access content located on ipfs. So, in your cli client, when/if you include an ipfs daemon, you can use the public gateways if there is an issue with the integrated ipfs daemon.

  2. After posting to a writeable public gateway, or doing ipfs add, you can directly thereafter request the same file from a public gateway/s, then the public gateway will have it cached until garbage collection comes along.

1 Like

Thanks for the tips. The ipfs gateway is a good backup plan.

Do you think running temporarely ipfs daemon in the background is a good idea ? It would shut down after sometime if it doesn’t receive a command

I dont see any harm in it, just as long as it works well for your application. You just have to keep in mind port number collisions, this is why i wished ipfs could use unix sockets…

1 Like

All right I think I will go this way then. I should may be use some random high unprivileged port to avoid port collisions.