Add ipfs init script to debug

This commit is contained in:
poka 2020-06-05 23:47:11 +02:00
parent 5e4d4f2a3f
commit 3663dffd58
1 changed files with 38 additions and 0 deletions

38
debug/init_ipfs_keys.sh Normal file
View File

@ -0,0 +1,38 @@
#!/bin/bash
# INIT ipfs
[[ $isLAN ]] && ipfs init -p lowpower \
|| ipfs init -p server
# TODO try ipfs init --profile=badgerds (for better performance)
# https://discuss.ipfs.io/t/adding-content-to-ipfs-is-quite-slow-any-ideas-on-why-and-how-to-speed-things-up/8135/3
sudo chown -R $USER:$USER ~/.ipfs || exit 1
###########################################
# ACTIVATE IPFS OPTIONS: #swarm0 INIT
###########################################
### IMPORTANT !!!!!!! IMPORTANT !!!!!!
###########################################
# DHT PUBSUB mode
ipfs config Pubsub.Router gossipsub
# MAXSTORAGE = 1/2 available
availableDiskSize=$(df -P ~/ | awk 'NR>1{sum+=$4}END{print sum}')
diskSize="$((availableDiskSize / 2))"
ipfs config Datastore.StorageMax $diskSize
## Activate Rapid "ipfs p2p"
ipfs config --json Experimental.Libp2pStreamMounting true
######### UPDATE BOOTSTRAP LIST ###########
ipfs bootstrap rm --all
ipfs bootstrap add /dnsaddr/oasis.astroport.com/tcp/4001/ipfs/Qmf98yiZja5yrVctp5x4FicUe3Dubzbm5TiUHqJQwwT5Rj
ipfs bootstrap add /ip4/51.15.166.54/tcp/4001/p2p/Qmf98yiZja5yrVctp5x4FicUe3Dubzbm5TiUHqJQwwT5Rj
ipfs bootstrap add /ip6/fe80::208:a2ff:fe0c:20d8/tcp/4001/p2p/Qmf98yiZja5yrVctp5x4FicUe3Dubzbm5TiUHqJQwwT5Rj
###########################################
# TODO: ADD some other bootstrap NODES
###########################################
sudo systemctl start ipfs || err "Start IPFS daemon"
sleep 3
echo "Peers: " && ipfs swarm peers && sleep 0.3
#[[ ! $(ipfs swarm peers) =~ "/ip4/" ]] && err "No peers found in swarm. Please open issue :https://git.p2p.legal/axiom-team/astroport/issues"