Kubo container with private swarm webui not shown

Hello,

i try to build a private swarm with Kubo containers (ipfs/kubo:latest), if I remove all bootstrapping peers and set the environment flag IPFS_SWARM_KEY_FILE with my key file I cannot get access to the web ui on http://localhost:5001/webui, the site is loaded but the browser hangs, so that the ui is not shown anymore. If I remove any “private” parts and let the container connect to the public peers everything works fine.

I have seen there is a post webui-not-working-in-private-network-configuration/6348, but in my case it should worked with the container version in a private network.

How can I make this work? Make it sense, to build my own container with pack the ui with the container?

Hi,

I met this issue before. The reason here is when you try to open http://localhost:5001/webui, it will redirect to the link like this http://localhost:5001/ipfs/bafybeic4gops3d3lyrisqku37uio33nvt6fqxvkxihrwlqsuvf76yln4fm (if you are using Kubo v0.20.0) which is trying to load data from other peers. So if you’re in a private network, it won’t work.

Here is the solution:

  1. Start a public ipfs node, and let it download the WebUI files to your repo;
  2. Export the WebUI files as a car file by ipfs dag export [webui root cid] > webui.car, which may take a while.
  3. After step 2 is finished, go to your private node, and import the car file by ipfs dag import webui.car, it will unzip and save files to the node automatically.

Hope it can help you! :grinning:

Thanks in general helps this, I create my own dockerfile and add the webui.car and initialize this with a shell script, so works for me with some little modification

Any chance you could share the dockerfile and shell script?

This is the shell script

00-ipfs-bootstrap-private.sh
574 B
#!/bin/sh -e
ipfs bootstrap rm all
#ipfs bootstrap add "/ip4/$PRIVATE_PEER_IP_ADDR/tcp/4001/ipfs/$PRIVATE_PEER_ID"
ipfs dag import /webui.car
ipfs config --json Experimental.FilestoreEnabled true
ipfs config --json Experimental.UrlstoreEnabled true
ipfs config --json Experimental.Libp2pStreamMounting true
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://0.0.0.0:5001", "http://localhost:3000", "http://127.0.0.1:5001", "https://webui.ipfs.io"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST", "GET", "DELETE"]'

and the Dockerfile

FROM ipfs/kubo:v0.21.0

# for private networks webui must be included manually,
# see https://discuss.ipfs.tech/t/kubo-container-with-private-swarm-webui-not-shown/16644

COPY ./webui.car /
COPY ./00-ipfs-bootstrap-private.sh /container-init.d
1 Like

Thank you! That was very kind.