forked from STI/Astroport.ONE
renew ipfs config
This commit is contained in:
parent
d06e6c6019
commit
7a875bf2ea
|
@ -65,7 +65,7 @@ do
|
|||
## RUNNING ON ASTROPORT STATION?
|
||||
(
|
||||
[[ $(which ipfs) && $IPFSNODEID ]] \
|
||||
&& espeak "Download $uqname done. Adding file to IPFS." \
|
||||
&& espeak "Download $uqname done. Adding file to I P F S" \
|
||||
&& CID=$(ipfs add -q ~/Astroport/$uqname.mp4 | tail -n 1) \
|
||||
&& mkdir -p ~/.zen/tmp/$IPFSNODEID/$PLAYER/Astroport/ \
|
||||
&& echo "/ipfs/$CID" > ~/.zen/tmp/$IPFSNODEID/Astroport/$uqname.mp4.ipfs \
|
||||
|
|
|
@ -11,31 +11,40 @@ isLAN=$(route -n |awk '$1 == "0.0.0.0" {print $2}' | grep -E "/(^127\.)|(^192\.1
|
|||
# DHT PUBSUB mode
|
||||
ipfs config Pubsub.Router gossipsub
|
||||
|
||||
# MAXSTORAGE = 1/2 available
|
||||
# MAXSTORAGE = 1/2 full
|
||||
availableDiskSize=$(df -P ~/ | awk 'NR>1{sum+=$4}END{print sum}')
|
||||
diskSize="$((availableDiskSize / 2))"
|
||||
fullDiskSize=$(df -P ~/ | awk 'NR>1{sum+=$2}END{print sum}')
|
||||
diskSize="$((fullDiskSize / 2))"
|
||||
ipfs config Datastore.StorageMax $diskSize
|
||||
|
||||
## Activate Rapid "ipfs p2p"
|
||||
ipfs config --json Experimental.Libp2pStreamMounting true
|
||||
ipfs config --json Experimental.P2pHttpProxy true
|
||||
|
||||
## Activate Experimental.AcceleratedDHTClient
|
||||
ipfs config --json Experimental.AcceleratedDHTClient true
|
||||
ipfs config Reprovider.Strategy "roots"
|
||||
#~ ## Activate Experimental.AcceleratedDHTClient
|
||||
#~ ipfs config Reprovider.Interval '42s'
|
||||
#~ ipfs config Reprovider.Strategy "roots"
|
||||
#~ ipfs config Routing.Routers.WanDHT --json '{
|
||||
#~ "Type": "dht",
|
||||
#~ "Parameters": {
|
||||
#~ "Mode": "auto",
|
||||
#~ "PublicIPNetwork": true,
|
||||
#~ "AcceleratedDHTClient": true
|
||||
#~ }
|
||||
#~ }'
|
||||
|
||||
ipfs config --json Swarm.ConnMgr.LowWater 20
|
||||
ipfs config --json Swarm.ConnMgr.HighWater 40
|
||||
|
||||
[[ ! $isLAN ]] && ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://'$myIP':8080", "http://ipfs.localhost:8080", "http://127.0.0.1:8080", "http://127.0.1.1:8080" ]' \
|
||||
|| ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://127.0.0.1:8080", "http://ipfs.localhost:8080", "http://127.0.1.1:8080" ]'
|
||||
|| ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://'$(hostname)':8080", "http://127.0.0.1:8080", "http://ipfs.localhost:8080", "http://127.0.1.1:8080" ]'
|
||||
|
||||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]'
|
||||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]'
|
||||
|
||||
## For ipfs.js = https://github.com/ipfs/js-ipfs/blob/master/docs/DELEGATE_ROUTERS.md
|
||||
ipfs config --json Addresses.Swarm | jq '. += ["/ip4/0.0.0.0/tcp/30215/ws"]' > /tmp/30215.ws
|
||||
ipfs config --json Addresses.Swarm "$(cat /tmp/30215.ws)"
|
||||
#~ ipfs config --json Addresses.Swarm | jq '. += ["/ip4/0.0.0.0/tcp/30215/ws"]' > /tmp/30215.ws
|
||||
#~ ipfs config --json Addresses.Swarm "$(cat /tmp/30215.ws)"
|
||||
|
||||
ipfs config Addresses.API "/ip4/0.0.0.0/tcp/5001"
|
||||
ipfs config Addresses.Gateway "/ip4/0.0.0.0/tcp/8080"
|
||||
|
|
|
@ -34,11 +34,13 @@ if [[ $YOU ]]; then
|
|||
[[ $YOU == $USER ]] && echo "Stopping ipfs daemon" && killall ipfs \
|
||||
|| (echo "ERROR $YOU is running ipfs, must be $USER" && exit 1)
|
||||
else
|
||||
# INIT ipfs
|
||||
if [[ ! -d ~/.ipfs ]]; then
|
||||
# REINIT ipfs
|
||||
[[ -s ~/.ipfs/config ]] && echo ">>> WARNING BACKUP OLD IPFS CONFIG ~/.ipfs/config.old"
|
||||
rm -f ~/.ipfs/config.old 2>/dev/null
|
||||
mv ~/.ipfs/config ~/.ipfs/config.old 2>/dev/null
|
||||
|
||||
[[ $isLAN ]] && ipfs init -p lowpower \
|
||||
|| ipfs init -p server
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "Astroport activate IPFS Layer installation..."
|
||||
|
@ -65,8 +67,9 @@ CPUQuota=60%
|
|||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
sudo cp -f /tmp/ipfs.service /etc/systemd/system/
|
||||
sudo sed -i "s/_USER_/$USER/g" /etc/systemd/system/ipfs.service
|
||||
sudo cp -f /tmp/ipfs.service /etc/systemd/system/
|
||||
sudo sed -i "s/_USER_/$USER/g" /etc/systemd/system/ipfs.service
|
||||
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable ipfs
|
||||
|
@ -74,7 +77,8 @@ sudo systemctl enable ipfs
|
|||
###########################################
|
||||
# ACTIVATE IPFS OPTIONS: #swarm0 INIT
|
||||
###########################################
|
||||
~/.zen/Astroport.ONE/tools/ipfs_config.sh
|
||||
$MY_PATH/ipfs_config.sh
|
||||
|
||||
sudo systemctl restart ipfs
|
||||
|
||||
## Add ulimit "open files" (avoid ipfs hang)
|
||||
|
|
Loading…
Reference in New Issue