mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 13:07:09 +00:00
feat: optimize IPFS configuration for better performance
This commit is contained in:
parent
08035b6f85
commit
da199b0d76
@ -3,17 +3,24 @@
|
|||||||
# Exit immediately if a command exits with a non-zero status.
|
# Exit immediately if a command exits with a non-zero status.
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Initialize IPFS
|
# check if ~/.ipfs exists, if not create it
|
||||||
ipfs init
|
if [ ! -d ~/.ipfs ]; then
|
||||||
|
ipfs init
|
||||||
|
setup_ipfs
|
||||||
|
start_ipfs
|
||||||
|
else
|
||||||
|
start_ipfs
|
||||||
|
fi
|
||||||
|
|
||||||
# Optimize local discovery and connectivity
|
function setup_ipfs() {
|
||||||
ipfs config --json Discovery.MDNS.Enabled true
|
# Optimize local discovery and connectivity
|
||||||
ipfs config --json Routing.Type "dhtclient"
|
ipfs config --json Discovery.MDNS.Enabled true
|
||||||
ipfs config --json Swarm.ConnMgr.LowWater 200
|
ipfs config --json Routing.Type "dhtclient"
|
||||||
ipfs config --json Swarm.ConnMgr.HighWater 500
|
ipfs config --json Swarm.ConnMgr.LowWater 200
|
||||||
|
ipfs config --json Swarm.ConnMgr.HighWater 500
|
||||||
|
|
||||||
# Set up the Cloudflare IPFS gateway peers
|
# Set up the Cloudflare IPFS gateway peers
|
||||||
ipfs config --json Peering.Peers '[
|
ipfs config --json Peering.Peers '[
|
||||||
{"ID": "QmcFf2FH3CEgTNHeMRGhN7HNHU1EXAxoEk6EFuSyXCsvRE", "Addrs": ["/dnsaddr/node-1.ingress.cloudflare-ipfs.com"]},
|
{"ID": "QmcFf2FH3CEgTNHeMRGhN7HNHU1EXAxoEk6EFuSyXCsvRE", "Addrs": ["/dnsaddr/node-1.ingress.cloudflare-ipfs.com"]},
|
||||||
{"ID": "QmcFmLd5ySfk2WZuJ1mfSWLDjdmHZq7rSAua4GoeSQfs1z", "Addrs": ["/dnsaddr/node-2.ingress.cloudflare-ipfs.com"]},
|
{"ID": "QmcFmLd5ySfk2WZuJ1mfSWLDjdmHZq7rSAua4GoeSQfs1z", "Addrs": ["/dnsaddr/node-2.ingress.cloudflare-ipfs.com"]},
|
||||||
{"ID": "QmcfFmzSDVbwexQ9Au2pt5YEXHK5xajwgaU6PpkbLWerMa", "Addrs": ["/dnsaddr/node-3.ingress.cloudflare-ipfs.com"]},
|
{"ID": "QmcfFmzSDVbwexQ9Au2pt5YEXHK5xajwgaU6PpkbLWerMa", "Addrs": ["/dnsaddr/node-3.ingress.cloudflare-ipfs.com"]},
|
||||||
@ -26,15 +33,18 @@ ipfs config --json Peering.Peers '[
|
|||||||
{"ID": "QmcfR3V5YAtHBzxVACWCzXTt26SyEkxdwhGJ6875A8BuWx", "Addrs": ["/dnsaddr/node-10.ingress.cloudflare-ipfs.com"]},
|
{"ID": "QmcfR3V5YAtHBzxVACWCzXTt26SyEkxdwhGJ6875A8BuWx", "Addrs": ["/dnsaddr/node-10.ingress.cloudflare-ipfs.com"]},
|
||||||
{"ID": "Qmcfuo1TM9uUiJp6dTbm915Rf1aTqm3a3dnmCdDQLHgvL5", "Addrs": ["/dnsaddr/node-11.ingress.cloudflare-ipfs.com"]},
|
{"ID": "Qmcfuo1TM9uUiJp6dTbm915Rf1aTqm3a3dnmCdDQLHgvL5", "Addrs": ["/dnsaddr/node-11.ingress.cloudflare-ipfs.com"]},
|
||||||
{"ID": "QmcfV2sg9zaq7UUHVCGuSvT2M2rnLBAPsiE79vVyK3Cuev", "Addrs": ["/dnsaddr/node-12.ingress.cloudflare-ipfs.com"]}
|
{"ID": "QmcfV2sg9zaq7UUHVCGuSvT2M2rnLBAPsiE79vVyK3Cuev", "Addrs": ["/dnsaddr/node-12.ingress.cloudflare-ipfs.com"]}
|
||||||
]'
|
]'
|
||||||
|
|
||||||
# Configure API and Gateway addresses to listen on localhost only
|
# Configure API and Gateway addresses to listen on localhost only
|
||||||
ipfs config Addresses.API /ip4/127.0.0.1/tcp/5001
|
ipfs config Addresses.API /ip4/127.0.0.1/tcp/5001
|
||||||
ipfs config Addresses.Gateway /ip4/127.0.0.1/tcp/8080
|
ipfs config Addresses.Gateway /ip4/127.0.0.1/tcp/8080
|
||||||
|
|
||||||
# Enable experimental features
|
# Enable experimental features
|
||||||
ipfs config --json Experimental.FilestoreEnabled true
|
ipfs config --json Experimental.FilestoreEnabled true
|
||||||
ipfs config --json Experimental.UrlstoreEnabled true
|
ipfs config --json Experimental.UrlstoreEnabled true
|
||||||
|
}
|
||||||
|
|
||||||
# Start the IPFS daemon with additional options for better performance and compatibility
|
function start_ipfs() {
|
||||||
ipfs daemon --enable-gc --migrate --enable-pubsub-experiment --enable-namesys-pubsub
|
# Start the IPFS daemon with additional options for better performance and compatibility
|
||||||
|
ipfs daemon --enable-gc --migrate --enable-pubsub-experiment --enable-namesys-pubsub
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user