isLAN
This commit is contained in:
parent
d283e2363d
commit
e74a76bfc8
|
@ -22,10 +22,13 @@ if [ "$EUID" -eq 0 ]
|
||||||
else echo -e "${c_yellow}OK $USER, let's go!$c_";
|
else echo -e "${c_yellow}OK $USER, let's go!$c_";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -d ~/.ipfs ]] && echo "IPFS install exist, please remove backup before execute this script" && exit 1
|
[[ -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}Onboarding IPFS...$c_"
|
||||||
|
|
||||||
|
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=`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} == '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: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"
|
||||||
|
@ -50,11 +53,13 @@ sudo systemctl daemon-reload || err+="Restart IPFS"
|
||||||
sudo systemctl enable ipfs || err+="Enable IPFS daemon"
|
sudo systemctl enable ipfs || err+="Enable IPFS daemon"
|
||||||
|
|
||||||
# INIT ipfs
|
# INIT ipfs
|
||||||
ipfs init -p lowpower || exit 1
|
[[ $isLAN ]] && ipfs init -p lowpower \
|
||||||
# ipfs init -p server ## Uncomment for server infrastructure
|
|| ipfs init -p server
|
||||||
sudo chown -R $USER:$USER ~/.ipfs || exit 1
|
|
||||||
|
|
||||||
# ACTIVATE CONFIG OPTIONS
|
# ACTIVATE CONFIG OPTIONS
|
||||||
|
###########################################
|
||||||
|
### HYPER IMPORTANT !!!!!!! IMPORTANT
|
||||||
|
###########################################
|
||||||
# PUBSUB
|
# PUBSUB
|
||||||
ipfs config Pubsub.Router gossipsub
|
ipfs config Pubsub.Router gossipsub
|
||||||
# MAXSTORAGE
|
# MAXSTORAGE
|
||||||
|
@ -66,9 +71,10 @@ ipfs config --json Experimental.Libp2pStreamMounting true
|
||||||
|
|
||||||
######### UPDATE BOOTSTRAP LIST ###########
|
######### UPDATE BOOTSTRAP LIST ###########
|
||||||
ipfs bootstrap rm --all
|
ipfs bootstrap rm --all
|
||||||
ipfs bootstrap add /dnsaddr/rec.copylaradio.com/tcp/4001/ipfs/Qmb6Gyy3KFWTxWh4v6fBeh5ANxAF6YAahWQtokmsNsqGda
|
ipfs bootstrap add /dnsaddr/oasis.astroport.com/tcp/4001/ipfs/Qmb6Gyy3KFWTxWh4v6fBeh5ANxAF6YAahWQtokmsNsqGda
|
||||||
ipfs bootstrap add /ip4/51.15.166.54/tcp/4001/p2p/Qmb6Gyy3KFWTxWh4v6fBeh5ANxAF6YAahWQtokmsNsqGda
|
ipfs bootstrap add /ip4/51.15.166.54/tcp/4001/p2p/Qmb6Gyy3KFWTxWh4v6fBeh5ANxAF6YAahWQtokmsNsqGda
|
||||||
ipfs bootstrap add /ip6/fd42:feed:feed:feed::1/tcp/4001/p2p/Qmb6Gyy3KFWTxWh4v6fBeh5ANxAF6YAahWQtokmsNsqGda
|
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"
|
||||||
|
|
||||||
|
|
|
@ -75,33 +75,6 @@ echo '
|
||||||
'
|
'
|
||||||
sudo apt-get install fail2ban nginx ssl-cert php-curl php-sqlite3 php-gd php-json php-xml php-mbstring php-fpm sqlite -y || err=1
|
sudo apt-get install fail2ban nginx ssl-cert php-curl php-sqlite3 php-gd php-json php-xml php-mbstring php-fpm sqlite -y || err=1
|
||||||
|
|
||||||
# CONFIG NGINX - LOVE LAND FRONTAL WEB PAGE
|
|
||||||
sudo cp -f /home/$YOU/.zen/astroport/www/loveland.conf /etc/nginx/conf.d/
|
|
||||||
|
|
||||||
PHPVERSION=$(ps auxf | grep php-fpm | grep -v -E 'color=auto|grep' | head -n 1 | grep -oP '(?<=\().*(?=\))' | awk -F '/' '{print $4}')
|
|
||||||
sudo sed -i "s/_PHPVERSION_/$PHPVERSION/g" /etc/nginx/conf.d/loveland.conf
|
|
||||||
|
|
||||||
nodename=$(cat /etc/hostname)
|
|
||||||
echo "ENTER Station accessible Network name !!! Suggestion : $nodename"
|
|
||||||
read nodename
|
|
||||||
[[ $nodename == "" ]] && echo "Are you sure? Hit ENTER to keep $nodename)" && read nodename
|
|
||||||
[[ $nodename == "" ]] && nodename=$(cat /etc/hostname)
|
|
||||||
|
|
||||||
sudo sed -i "s/_SERVERNAME_/$nodename/g" /etc/nginx/conf.d/loveland.conf
|
|
||||||
|
|
||||||
echo "INSTALL LOVELand WebSite"
|
|
||||||
if [[ ! -L /var/www/loveland ]]; then
|
|
||||||
sudo ln -s /home/$YOU/.zen/astroport/www/LOVELand /var/www/loveland
|
|
||||||
fi
|
|
||||||
sudo chmod -R 777 /var/www/loveland/jukebox/albumart
|
|
||||||
sudo chmod -R 777 /var/www/loveland/jukebox/prefs
|
|
||||||
|
|
||||||
# Disabling default website
|
|
||||||
sudo rm -f /etc/nginx/sites-enabled/default
|
|
||||||
|
|
||||||
sudo systemctl restart nginx || err=1
|
|
||||||
|
|
||||||
|
|
||||||
# KILL RUNNING OASIS
|
# KILL RUNNING OASIS
|
||||||
kill -9 $(ps auxf --sort=+utime | grep -w oasis | grep -v -E 'color=auto|grep' | tail -n 1 | awk '{print $2}')
|
kill -9 $(ps auxf --sort=+utime | grep -w oasis | grep -v -E 'color=auto|grep' | tail -n 1 | awk '{print $2}')
|
||||||
echo "REstarting OASIS with good $nodename & network config"
|
echo "REstarting OASIS with good $nodename & network config"
|
||||||
|
@ -136,6 +109,28 @@ fi
|
||||||
|
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
|
# CONFIG NGINX - LOVE LAND FRONTAL WEB PAGE
|
||||||
|
sudo cp -f /home/$YOU/.zen/astroport/www/loveland.conf /etc/nginx/conf.d/
|
||||||
|
|
||||||
|
PHPVERSION=$(ps auxf | grep php-fpm | grep -v -E 'color=auto|grep' | head -n 1 | grep -oP '(?<=\().*(?=\))' | awk -F '/' '{print $4}')
|
||||||
|
sudo sed -i "s/_PHPVERSION_/$PHPVERSION/g" /etc/nginx/conf.d/loveland.conf
|
||||||
|
sudo sed -i "s/_SERVERNAME_/$nodename/g" /etc/nginx/conf.d/loveland.conf
|
||||||
|
sudo sed -i "s/_PORT_/10010/g" /etc/nginx/conf.d/loveland.conf
|
||||||
|
sudo sed -i "s/_APPLI_//g" /etc/nginx/conf.d/loveland.conf
|
||||||
|
|
||||||
|
echo "INSTALL LOVELand WebSite"
|
||||||
|
if [[ ! -L /var/www/loveland ]]; then
|
||||||
|
sudo ln -s /home/$YOU/.zen/astroport/www/LOVELand /var/www/loveland
|
||||||
|
fi
|
||||||
|
sudo chmod -R 777 /var/www/loveland/jukebox/albumart
|
||||||
|
sudo chmod -R 777 /var/www/loveland/jukebox/prefs
|
||||||
|
|
||||||
|
# Disabling default website
|
||||||
|
# sudo rm -f /etc/nginx/sites-enabled/default
|
||||||
|
|
||||||
|
sudo systemctl restart nginx || err=1
|
||||||
|
|
||||||
|
|
||||||
if [[ $err ]]; then
|
if [[ $err ]]; then
|
||||||
echo -e "${c_red}Installation de LOVELand bizarre??$c_"
|
echo -e "${c_red}Installation de LOVELand bizarre??$c_"
|
||||||
echo "PLEASE... POST YOUR ISSUE! https://git.p2p.legal/axiom-team/astroport/issues"
|
echo "PLEASE... POST YOUR ISSUE! https://git.p2p.legal/axiom-team/astroport/issues"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
server {
|
server {
|
||||||
|
|
||||||
listen 80;
|
listen _PORT_;
|
||||||
listen [::]:80;
|
listen [::]:_PORT_;
|
||||||
|
|
||||||
root /var/www/loveland;
|
root /var/www/loveland/_APPLI_;
|
||||||
|
|
||||||
server_name _SERVERNAME_;
|
server_name _SERVERNAME_;
|
||||||
|
|
||||||
|
@ -26,14 +26,6 @@ server {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# OASIS SSB TODO: NOT WORKING (cor problem)
|
|
||||||
location /oasis {
|
|
||||||
proxy_pass http://127.0.0.1:3000;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Forwarded-For $remote_addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# IPFS GATEWAY PROXY
|
# IPFS GATEWAY PROXY
|
||||||
location /ipfs {
|
location /ipfs {
|
||||||
proxy_pass http://127.0.0.1:8080;
|
proxy_pass http://127.0.0.1:8080;
|
||||||
|
|
Loading…
Reference in New Issue