How to set service.json in Docker deployment

Can someone help me enable basic auth in the Dockerfile example in https://github.com/ipfs/ipfs-cluster ?

I see the services files under sharness/config but I do not know how to specify and where to specify the custom service.json file

Hi, you need to mount a volume on the container containing the custom configuration . From https://cluster.ipfs.io/documentation/deployment/docker :

By default, we use the /data/ipfs-cluster as the IPFS Cluster configuration path. We recommend mounting this folder as means to provide custom configurations and/or data persistency for your peers. This is usually achieved by passing -v <your_local_path>:/data/ipfs-cluster to docker run).

You can also specify credentials with an envirnoment variable as : CLUSTER_RESTAPI_BASICAUTHCREDENTIALS="user1:pw1,user2:pw2" (with docker run --env for example).

Thanks for the quick response Hector, I don’t fully understand how I pass a different config…

I tried to set

CLUSTER_RESTAPI_BASICAUTHCREDENTIALS="user1:pw1,user2:pw2"

In both the Dockerfile and the docker-compose file (on the clusters) and I seem to be able to make REST requests without basic auth…

Could you share where I would make the change to use the premade custom config in

sharness/config/basic_auth

Is this something I specify in the docker-compose file? (lines 83+) or do I do this in the Dockerfile?

Thanks

Hello, try with CLUSTER_RESTAPI_BASICAUTHCREDS instead. I just opened a bug since this should be as I told you before, but it’s not.

There is no need to edit any file regarding the docker container. If you need, you can mount a volume as I mentioned before with a custom config (you will need it anyway to make storage durable).