180 lines
6.0 KiB
Bash
Executable File
180 lines
6.0 KiB
Bash
Executable File
#!/bin/bash
|
|
################################################################################
|
|
# Author: Fred (support@qo-op.com)
|
|
# Version: 0.1
|
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
###########################################################################################
|
|
#######################################
|
|
# INSTALL IPFS on G1sms+ Pi NODES
|
|
#######################################
|
|
echo "DEFAULT INSTALL SCRIPT. VALIDATED ON RASPBERRYPI, SHOULD BE ADAPTED IF NOT ARM ARCH SYSTEM.
|
|
You are going to download and install ipfs daemon environement for running G1sms+ NODE.
|
|
TODO: TEST TEST TEST TEST + MANAGE DIFFERENT ARCH
|
|
Ready?"
|
|
read
|
|
|
|
if [[ "$USER" == "root" ]]; then echo "Better run by 'pi', please create non-root user and become that user before launching ipfs install..."; exit;
|
|
else echo "$USER, let's go!";
|
|
fi
|
|
|
|
echo "GET ipfs-update"
|
|
cd /usr/src/
|
|
sudo wget https://dist.ipfs.io/ipfs-update/v1.5.2/ipfs-update_v1.5.2_linux-arm.tar.gz
|
|
|
|
echo "INSTALL ipfs-update"
|
|
sudo tar xvzf ipfs-update_v1.5.2_linux-arm.tar.gz
|
|
cd ipfs-update
|
|
sudo ./install.sh
|
|
|
|
echo "INSTALL latest ipfs"
|
|
sudo ipfs-update install latest
|
|
|
|
echo "CREATE SYSTEMD ipfs SERVICE"
|
|
sudo cat > /etc/systemd/system/ipfs.service << EOF
|
|
[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
|
|
EOF
|
|
|
|
sudo systemctl daemon-reload
|
|
sudo systemctl enable ipfs
|
|
|
|
################
|
|
# BECOME $USER
|
|
# INIT ipfs
|
|
ipfs init -p lowpower
|
|
|
|
# ACTIVATE CONFIG OPTIONS
|
|
# PUBSUB
|
|
ipfs config Pubsub.Router gossipsub
|
|
# MAXSTORAGE
|
|
ipfs config Datastore.StorageMax 12GB
|
|
## PORT FORWARD (SSH)
|
|
ipfs config --json Experimental.Libp2pStreamMounting true
|
|
|
|
######### UPDATE BOOTSTRAP LIST ###########
|
|
ipfs bootstrap rm --all
|
|
### fred@onelove.madeinzion.org ###
|
|
# ID: QmSX7gFRPHui5A2DWFk2VmBvq6hynj2hubhJLQAwPWe4Lh
|
|
ipfs bootstrap add /ip6/fe80::207:cbff:fe0b:75bb/tcp/4001/ipfs/QmSX7gFRPHui5A2DWFk2VmBvq6hynj2hubhJLQAwPWe4Lh
|
|
ipfs bootstrap add /ip4/51.15.2.211/tcp/4001/ipfs/QmSX7gFRPHui5A2DWFk2VmBvq6hynj2hubhJLQAwPWe4Lh
|
|
### ADD NEW SWARM LEADERS SERVER HERE ###
|
|
|
|
# ALLOW REMOTE SSH CONNECTION FROM rec OR onelove (For swarm.key & keystore exchange )
|
|
# ADD SSH ADMIN/SUPPORT USERS $(cat .ssh/id_rsa.pub)
|
|
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCs6oXRmPukaX7u2tDcFF1cecsDSEA30YyUqDaXSrw+yWQ8G79ktZ7BN0bPYBgfxO59FU8l5Jg1SPPG9kj81jfoCwGJpYdbczmMuP/iqw3aNoGv66swxwxzrqzbHrFFCXgn+6B2spDjn87tFB8JvQQTb2Kc4/sAZ9E6eY61pFiNpqbQehXdqSV5UemV9dkSQrnmJTl1PjUQ474AKQwFPzpdKHD/3VvqQS4i7ZLVeXS65euOP/YY8Bx9HvhsmhJ3h78OOK+D6GFfyv010xXBoG6kCSYR8LYMCEexpPGYV+Mduf/tUHjHP4GuWZAhd+wLRl0uPy6Tv7wHFfLyN01m/9vl fred@rec" >> ~/.ssh/authorized_keys
|
|
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFthQ3FggJlz/+ZglZJjVJzYs6ehx/iB7f89KY396K+7ai4ETqFhq6ANVp9xeQ4dLU26w0bFBELcnh9rn5QDSrXjsIptoWXErkSdZOeXqofnLtJEOhZO/I328y0C1vQRwtMMXKLLnqPe14h+zJenc7KJbL5cvB3Hd7nfQ+Q0uEnIsKb0f5wcKagySHIFdmY/FqaGz5g4MXGq7nlX/31hvfTFhF0g+k3mhvTTVQ368Op9qZZIozYhBoojWWvK5mwAovxdS9QT1hKrFXHfjov/aKQxLAy0a0oxFvHKoYN/l4ffGibFMAmedljTxf1VSDBv/k/RN53UU6RufW3qqBjY0b fred@onelove" >> ~/.ssh/authorized_keys
|
|
|
|
# START ipfs
|
|
sudo systemctl start ipfs
|
|
|
|
##################################
|
|
## INSTALL TOOLS
|
|
######## YOUTUBE-DL ##########
|
|
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
|
|
sudo chmod a+rx /usr/local/bin/youtube-dl
|
|
sudo apt install libid3-tools mpd mpc lame -y
|
|
|
|
## CONFIG MPD
|
|
sudo cat > /etc/mpd.conf << EOF
|
|
music_directory "/home/$USER/music"
|
|
playlist_directory "/home/$USER/playlists"
|
|
user "$USER"
|
|
bind_to_address "any"
|
|
auto_update "yes"
|
|
zeroconf_enabled "yes"
|
|
zeroconf_name "CopyLaRadio Music Recorder"
|
|
|
|
filesystem_charset "UTF-8"
|
|
id3v1_encoding "UTF-8"
|
|
###############################
|
|
|
|
audio_output {
|
|
type "pulse"
|
|
name "My Pulse Output"
|
|
server "127.0.0.1"
|
|
}
|
|
|
|
audio_output {
|
|
type "httpd"
|
|
name "CopyLaRadio HTTP Stream"
|
|
encoder "lame"
|
|
port "8000"
|
|
quality "5.0"
|
|
# bitrate "128"
|
|
format "44100:16:1"
|
|
}
|
|
EOF
|
|
|
|
sudo chown -R $USER /var/lib/mpd/ /var/run/mpd /run/mpd /var/log/mpd
|
|
sudo service mpd restart
|
|
|
|
sudo apt-get install nginx php-curl php-sqlite3 php-gd php-json php-xml php-mbstring php-fpm sqlite -y
|
|
sudo apt-get install lame sox libsox-fmt-mp3 eyed3 python-chardet libav-tools imagemagick curl -y
|
|
sudo apt-get install ca-certificates git-core binutils rsync alsa-utils bc libid3-tools espeak mpg321 fuse libttspico-utils atomicparsley -y
|
|
|
|
# CONFIG NGINX
|
|
sudo cat > /etc/nginx/sites-available/default << EOF
|
|
server {
|
|
listen 80 default_server;
|
|
listen [::]:80 default_server;
|
|
|
|
root /home/$USER/G1sms+/www/rompr;
|
|
index index.html index.htm index.nginx-debian.html;
|
|
|
|
server_name _;
|
|
|
|
location /g1tag {
|
|
proxy_pass http://127.0.0.1:81;
|
|
proxy_set_header Host \$host;
|
|
proxy_set_header X-Forwarded-For \$remote_addr;
|
|
}
|
|
|
|
location /code/ {
|
|
proxy_pass http://127.0.0.1:8080/ipns/QmZHTne3bjtMgaXWRqSbdKchJbgq2NaAeVSzFUN7ceYpif/;
|
|
proxy_set_header Host \$host;
|
|
proxy_set_header X-Real-IP \$remote_addr;
|
|
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
|
}
|
|
|
|
location /ipfs {
|
|
proxy_pass http://127.0.0.1:8080;
|
|
proxy_set_header Host \$host;
|
|
proxy_set_header X-Forwarded-For \$remote_addr;
|
|
}
|
|
|
|
location /ipns {
|
|
proxy_pass http://127.0.0.1:8080;
|
|
proxy_set_header Host \$host;
|
|
proxy_set_header X-Forwarded-For \$remote_addr;
|
|
}
|
|
}
|
|
EOF
|
|
|
|
sudo systemctl restart nginx
|
|
|
|
#################################
|
|
## Get _CopyLaRadio distrib
|
|
# ipfs get Qm.... > /tmp/copylaradio.zip
|
|
|
|
# Add CopyLaRadio to system PATH
|
|
#export PATH=$PATH:/home/$USER/_CopyLaRadio
|
|
# etc....
|
|
|
|
# INSTALL ROMPR WebSite LINKs
|
|
#sudo ln -s /home/$USER/_CopyLaRadio/www/rompr /var/www/rompr
|
|
#sudo chmod 777 /home/$USER/_CopyLaRadio/www/rompr/albumart
|
|
#sudo chmod 777 /home/$USER/_CopyLaRadio/www/rompr/prefs
|
|
|
|
|
|
|
|
|