Improve ipfs install
This commit is contained in:
parent
24f41d604d
commit
b8228a4a54
|
@ -1,5 +1,24 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
# Install IPFS
|
# Install IPFS
|
||||||
ipfs() {
|
|
||||||
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
|
|
||||||
|
## Config
|
||||||
|
diskSize="5G"
|
||||||
|
templates="$MY_PATH/templates/ipfs"
|
||||||
|
|
||||||
|
if [ "$EUID" -eq 0 ]
|
||||||
|
then echo -e "${c_red}Veuillez ne pas executez ce script en root. Choisissez un utilisateur pour votre serveur G1sms+ (nous recommandons l'utilisateur pi)$c_"
|
||||||
|
exit 1
|
||||||
|
else echo -e "${c_yellow}OK $USER, let's go!$c_";
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ -d ~/.ipfs-old/ ]] && echo "Backup exist, please remove backup before execute this script" && exit 1
|
||||||
|
[[ -d ~/.ipfs/ ]] && rm -rf ~/.ipfs-old && mv ~/.ipfs/ ~/.ipfs-old
|
||||||
|
|
||||||
|
ipfs_install() {
|
||||||
echo -e "${c_yellow}Onboarding IPFS...$c_"
|
echo -e "${c_yellow}Onboarding IPFS...$c_"
|
||||||
[[ -f /usr/local/bin/ipfs ]] && sudo service ipfs stop
|
[[ -f /usr/local/bin/ipfs ]] && sudo service ipfs stop
|
||||||
if [[ $ARM == "yes" ]]; then
|
if [[ $ARM == "yes" ]]; then
|
||||||
|
@ -20,11 +39,31 @@ ipfs() {
|
||||||
|
|
||||||
echo "CREATE SYSTEMD ipfs SERVICE"
|
echo "CREATE SYSTEMD ipfs SERVICE"
|
||||||
[[ -f /etc/systemd/system/ipfs.service ]] && sudo rm /etc/systemd/system/ipfs.service
|
[[ -f /etc/systemd/system/ipfs.service ]] && sudo rm /etc/systemd/system/ipfs.service
|
||||||
sudo cp -f $MY_PATH/templates/1/ipfs.service /etc/systemd/system/
|
sudo cp -f $templates/ipfs.service /etc/systemd/system/
|
||||||
sudo sed -i "s/_USER/$USER/g" /etc/systemd/system/ipfs.service
|
sudo sed -i "s/_USER/$USER/g" /etc/systemd/system/ipfs.service
|
||||||
|
|
||||||
sudo systemctl daemon-reload || err+="Restart IPFS"
|
sudo systemctl daemon-reload || err+="Restart IPFS"
|
||||||
sudo systemctl enable ipfs || err+="Enable IPFS daemon"
|
sudo systemctl enable ipfs || err+="Enable IPFS daemon"
|
||||||
|
|
||||||
|
################
|
||||||
|
# BECOME $USER
|
||||||
|
# INIT ipfs
|
||||||
|
ipfs init -p lowpower
|
||||||
|
# ipfs init -p server ## Uncomment for server infrastructure
|
||||||
|
|
||||||
|
# ACTIVATE CONFIG OPTIONS
|
||||||
|
# PUBSUB
|
||||||
|
ipfs config Pubsub.Router gossipsub
|
||||||
|
# MAXSTORAGE
|
||||||
|
ipfs config Datastore.StorageMax $diskSize
|
||||||
|
## PORT FORWARD (SSH)
|
||||||
|
ipfs config --json Experimental.Libp2pStreamMounting true
|
||||||
|
|
||||||
|
######### UPDATE BOOTSTRAP LIST ###########
|
||||||
|
ipfs bootstrap rm --all
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$@
|
ipfs_install
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
[Unit]
|
||||||
|
Description=IPFS daemon
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=_USER
|
||||||
|
ExecStart=/usr/local/bin/ipfs daemon --enable-pubsub-experiment --enable-namesys-pubsub --enable-gc
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -51,9 +51,6 @@ $MY_PATH/.install/export_colors.sh
|
||||||
|
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
|
|
||||||
# Install IPFS
|
|
||||||
source .install/ipfs.sh
|
|
||||||
|
|
||||||
# Install ScuttleButt
|
# Install ScuttleButt
|
||||||
source .install/scuttlebutt.sh
|
source .install/scuttlebutt.sh
|
||||||
|
|
||||||
|
@ -71,7 +68,7 @@ iptubes() {
|
||||||
functions=$(declare -F | awk '{print $NF}' | sort | egrep -v "^_" )
|
functions=$(declare -F | awk '{print $NF}' | sort | egrep -v "^_" )
|
||||||
|
|
||||||
## Check IPFS install
|
## Check IPFS install
|
||||||
[[ -z $(which ipfs) ]] && ipfs
|
[[ -z $(which ipfs) ]] && source .install/ipfs.sh
|
||||||
|
|
||||||
echo -e "${c_green}Astroport UP$c_"
|
echo -e "${c_green}Astroport UP$c_"
|
||||||
[[ -z $args ]] && echo -e "Select a gate to install:" && read apps
|
[[ -z $args ]] && echo -e "Select a gate to install:" && read apps
|
||||||
|
|
Loading…
Reference in New Issue