push
This commit is contained in:
parent
c0886ef06f
commit
a0ea409d88
|
@ -5,16 +5,6 @@ MY_PATH="`dirname \"$0\"`" # relative
|
|||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
|
||||
# Ask user password on start
|
||||
sudo true
|
||||
|
||||
# CHECK if daemon is already running
|
||||
[[ $(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) ]] \
|
||||
&& echo "ipfs daemon already running. EVERYTHING OK!" \
|
||||
&& ipfs id && echo "ipfs swarm peers" && ipfs swarm peers \
|
||||
&& echo "ipfs bootstrap list" && ipfs bootstrap list \
|
||||
&& echo "Please RUN : sudo systemctl stop ipfs" && exit 0
|
||||
|
||||
# CHECK not root user !!
|
||||
if [ "$EUID" -eq 0 ]
|
||||
then echo -e "${c_red}DO NOT EXECUTE AS root. Choose a user for your Astroport Station (we like pi)$c_"
|
||||
|
@ -22,28 +12,38 @@ if [ "$EUID" -eq 0 ]
|
|||
else echo -e "${c_yellow}OK $USER, let's go!$c_";
|
||||
fi
|
||||
|
||||
# Ask user password on start
|
||||
sudo true
|
||||
|
||||
# CHECK if daemon is already running
|
||||
[[ $(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) ]] \
|
||||
&& echo "ipfs daemon already running...! Must STOP ipfs AND remove ~/.ipfs to install again !!" \
|
||||
&& ipfs id && echo "ipfs swarm peers" && ipfs swarm peers \
|
||||
&& echo "ipfs bootstrap list" && ipfs bootstrap list \
|
||||
&& echo "Please RUN : sudo systemctl stop ipfs" && exit 0
|
||||
|
||||
[[ -d ~/.ipfs ]] && echo "IPFS install exist! Please remove or backup before executing this script" && exit 1
|
||||
|
||||
echo -e "${c_yellow}Onboarding IPFS...$c_"
|
||||
echo -e "${c_yellow}Astroport IPFS Layer installation...$c_"
|
||||
|
||||
# CHECK node IP isLAN?
|
||||
myIP=$(hostname -I | awk '{print $1}')
|
||||
isLAN=$(echo $myIP | grep -E "/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])/")
|
||||
|
||||
MACHINE_TYPE=`uname -m`
|
||||
[ ${MACHINE_TYPE} == 'x86_64' ] && curl -s https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-amd64.tar.gz -o $MY_PATH/ipfs-update.tar.gz || err+="Download ipfs-update"
|
||||
[ ${MACHINE_TYPE:0:3} == 'arm' ] && curl -s https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz -o $MY_PATH/ipfs-update.tar.gz || err+="Download ipfs-update"
|
||||
[ ${MACHINE_TYPE} == 'x86_64' ] && curl -s https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-amd64.tar.gz -o $MY_PATH/ipfs-update.tar.gz || err+=" Download ipfs-update"
|
||||
[ ${MACHINE_TYPE:0:3} == 'arm' ] && curl -s https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz -o $MY_PATH/ipfs-update.tar.gz || err+=" Download ipfs-update"
|
||||
[ ! -f $MY_PATH/ipfs-update.tar.gz ] && echo "Your $MACHINE_TYPE is not supported yet... Please add an issue." && exit 1
|
||||
|
||||
echo "INSTALL ipfs-update >>>>>>>>>>>>>>>>>>>>>>>>>>"
|
||||
sudo tar -xvzf $MY_PATH/ipfs-update.tar.gz -C /usr/src/ || err+="Untar ipfs-update"
|
||||
sudo tar -xvzf $MY_PATH/ipfs-update.tar.gz -C /usr/src/ || err+=" Untar ipfs-update"
|
||||
rm $MY_PATH/ipfs-update.tar.gz
|
||||
cd /usr/src/ipfs-update/
|
||||
sudo ./install.sh || err+="Install ipfs-update"
|
||||
sudo ./install.sh || err+=" Install ipfs-update"
|
||||
cd $MY_PATH
|
||||
|
||||
echo "INSTALL latest ipfs >>>>>>>>>>>>>>>>>>>>>>>>>>"
|
||||
sudo ipfs-update install latest || err+="Install IPFS"
|
||||
sudo ipfs-update install latest || err+=" Install latest IPFS"
|
||||
|
||||
echo "CREATE SYSTEMD ipfs SERVICE >>>>>>>>>>>>>>>>>>"
|
||||
cat > /tmp/ipfs.service <<EOF
|
||||
|
@ -63,24 +63,25 @@ EOF
|
|||
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 || err+="Restart IPFS"
|
||||
sudo systemctl enable ipfs || err+="Enable IPFS daemon"
|
||||
sudo systemctl daemon-reload || err+=" Reload systemd"
|
||||
sudo systemctl enable ipfs || err+=" Enable IPFS daemon startup"
|
||||
|
||||
# INIT ipfs
|
||||
[[ $isLAN ]] && ipfs init -p lowpower \
|
||||
|| ipfs init -p server
|
||||
|
||||
# ACTIVATE CONFIG OPTIONS
|
||||
###########################################
|
||||
### HYPER IMPORTANT !!!!!!! IMPORTANT
|
||||
# ACTIVATE IPFS OPTIONS: #swarm0 INIT
|
||||
###########################################
|
||||
# PUBSUB
|
||||
### IMPORTANT !!!!!!! IMPORTANT !!!!!!
|
||||
###########################################
|
||||
# DHT PUBSUB mode
|
||||
ipfs config Pubsub.Router gossipsub
|
||||
# MAXSTORAGE
|
||||
# MAXSTORAGE = 1/2 available
|
||||
availableDiskSize=$(df -P ~/ | awk 'NR>1{sum+=$4}END{print sum}')
|
||||
diskSize="$((availableDiskSize / 2))"
|
||||
ipfs config Datastore.StorageMax $diskSize
|
||||
## PORT FORWARD (SSH)
|
||||
## Activate Rapid "ipfs p2p"
|
||||
ipfs config --json Experimental.Libp2pStreamMounting true
|
||||
|
||||
######### UPDATE BOOTSTRAP LIST ###########
|
||||
|
@ -90,7 +91,7 @@ ipfs bootstrap add /ip4/51.15.166.54/tcp/4001/p2p/Qmb6Gyy3KFWTxWh4v6fBeh5ANxAF6Y
|
|||
ipfs bootstrap add /ip6/fd42:feed:feed:feed::1/tcp/4001/p2p/Qmb6Gyy3KFWTxWh4v6fBeh5ANxAF6YAahWQtokmsNsqGda
|
||||
###########################################
|
||||
|
||||
sudo systemctl restart ipfs || err+="Restart IPFS daemon"
|
||||
sudo systemctl restart ipfs || err+=" Restart IPFS daemon"
|
||||
|
||||
sleep 7
|
||||
|
||||
|
|
Loading…
Reference in New Issue