4556cbe726
This: * Allows choosing the consensus for the automatic "init" on Docker with IPFS_CLUSTER_CONSENSUS. * Removes IPFS_PATH and the sed replacements for 0.0.0.0 on RestAPI and Ipfsproxy endpoints because these are easily supported by setting env vars correctly and pose some security risk when running with net=host. * Brings up to date Dockerfile-test and Dockerfile-bundle, even if mostly unused.
29 lines
738 B
Bash
Executable File
29 lines
738 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
user=ipfs
|
|
|
|
if [ -n "$DOCKER_DEBUG" ]; then
|
|
set -x
|
|
fi
|
|
|
|
if [ `id -u` -eq 0 ]; then
|
|
echo "Changing user to $user"
|
|
# ensure directories are writable
|
|
su-exec "$user" test -w "${IPFS_CLUSTER_PATH}" || chown -R -- "$user" "${IPFS_CLUSTER_PATH}"
|
|
exec su-exec "$user" "$0" $@
|
|
fi
|
|
|
|
# Only ipfs user can get here
|
|
ipfs-cluster-service --version
|
|
|
|
if [ -e "${IPFS_CLUSTER_PATH}/service.json" ]; then
|
|
echo "Found IPFS cluster configuration at ${IPFS_CLUSTER_PATH}"
|
|
else
|
|
echo "This container only runs ipfs-cluster-service. ipfs needs to be run separately!"
|
|
echo "Initializing default configuration..."
|
|
ipfs-cluster-service init --consensus "${IPFS_CLUSTER_CONSENSUS}"
|
|
fi
|
|
|
|
exec ipfs-cluster-service $@
|