101: add settings

This commit is contained in:
unexpected 2025-10-08 17:20:11 +00:00
parent 61d0f3769b
commit d6c2664cc0
2 changed files with 27 additions and 3 deletions

View File

@ -61,6 +61,10 @@ services:
IPFS_PROFILE: server IPFS_PROFILE: server
GOMAXPROCS: "4" GOMAXPROCS: "4"
GOMEMLIMIT: "7500MiB" GOMEMLIMIT: "7500MiB"
IPFS_PRIVATE_BOOTSTRAP: '${IPFS_PRIVATE_BOOTSTRAP:-[]}'
IPFS_PEERING_PEERS: '${IPFS_PEERING_PEERS:-[]}'
IPFS_ANNOUNCE_ADDRESSES: '${IPFS_ANNOUNCE_ADDRESSES:-[]}'
IPFS_NOANNOUNCE_ADDRESSES: '${IPFS_NOANNOUNCE_ADDRESSES:-[]}'
volumes: volumes:
- ${IPFS_DATA_DIR_HOST:-./data/ipfs}:/data/ipfs - ${IPFS_DATA_DIR_HOST:-./data/ipfs}:/data/ipfs
- ./ipfs/init/001-config.sh:/container-init.d/001-config.sh:ro - ./ipfs/init/001-config.sh:/container-init.d/001-config.sh:ro

View File

@ -11,26 +11,46 @@ ipfs config --json Gateway.NoFetch true
# DHT client mode with accelerated providing # DHT client mode with accelerated providing
ipfs config --json Routing '{ "Type": "dhtclient", "AcceleratedDHTClient": true }' ipfs config --json Routing '{ "Type": "dhtclient", "AcceleratedDHTClient": true }'
# Reprovider pinned content periodically # Reprovider config was renamed to Provide in go-ipfs 0.38+
ipfs config --json Reprovider '{ "Interval": "22h", "Strategy": "pinned+mfs" }' ipfs config --json Provide '{ "Interval": "22h", "Strategy": "pinned+mfs", "Enabled": true }'
# Keep connection manager within reasonable bounds # Keep connection manager within reasonable bounds
ipfs config --json Swarm.ConnMgr '{ "Type": "basic", "LowWater": 50, "HighWater": 200, "GracePeriod": "20s" }' ipfs config --json Swarm.ConnMgr '{ "Type": "basic", "LowWater": 50, "HighWater": 200, "GracePeriod": "20s" }'
SWARM_KEY_PATH="/data/ipfs/swarm.key" SWARM_KEY_PATH="/data/ipfs/swarm.key"
# Helpers to apply optional JSON blobs from env
set_json_if_present() {
# $1 - config path, $2 - env value
if [ -n "$2" ]; then
ipfs config --json "$1" "$2"
fi
}
# Disable AutoConf only when running with a private swarm key # Disable AutoConf only when running with a private swarm key
if [ -f "$SWARM_KEY_PATH" ] && [ -s "$SWARM_KEY_PATH" ]; then if [ -f "$SWARM_KEY_PATH" ] && [ -s "$SWARM_KEY_PATH" ]; then
ipfs config --json AutoConf.Enabled false ipfs config --json AutoConf.Enabled false
ipfs config --json AutoTLS.Enabled false ipfs config --json AutoTLS.Enabled false
ipfs config Bootstrap --json "[]" set_json_if_present Bootstrap "${IPFS_PRIVATE_BOOTSTRAP:-[]}"
ipfs config --json DNS.Resolvers "{}" ipfs config --json DNS.Resolvers "{}"
ipfs config --json Ipns.DelegatedPublishers "[]" ipfs config --json Ipns.DelegatedPublishers "[]"
ipfs config --json Swarm.Transports.Network '{ "TCP": true, "Websocket": false }' ipfs config --json Swarm.Transports.Network '{ "TCP": true, "Websocket": false }'
set_json_if_present Peering.Peers "${IPFS_PEERING_PEERS:-[]}"
else else
ipfs config --json AutoConf.Enabled true ipfs config --json AutoConf.Enabled true
fi fi
set_json_if_present Addresses.Announce "${IPFS_ANNOUNCE_ADDRESSES:-[]}"
if [ -z "${IPFS_NOANNOUNCE_ADDRESSES:-}" ]; then
ipfs config --json Addresses.NoAnnounce '["/ip4/127.0.0.1","/ip6/::1"]'
else
set_json_if_present Addresses.NoAnnounce "${IPFS_NOANNOUNCE_ADDRESSES}"
fi
if [ -n "${IPFS_SWARM_ANNOUNCE_PRIVATE:-}" ]; then
set_json_if_present Swarm.AddrFilters "${IPFS_SWARM_ANNOUNCE_PRIVATE}"
fi
# CORS for RPC API (visible only in docker network) # CORS for RPC API (visible only in docker network)
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]' ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT","POST","GET"]' ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT","POST","GET"]'