∏ NODE

∏serveur Documentation

 (   _   )
  | | | |
  | | | |
  | | | |
  |_| |_| server II - 20190301

 ~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~

 * ip web: 62.210.123.64

 * ip stream (for icecast): ordered but attribution in progress

 * services installed:
     - Apache2.4 (cool install with deflate & expires custom conf +  /etc/apache2/conf-enabled/security.conf)
     - Php7.2 (custom secure settings in /etc/php/7.2/apache2/php.ini)
     - MariaDB (u & p = s I + LBB custom conf in /etc/mysql/mariadb.conf.d/50-server.cnf)
     - Exim4 (smtp Gandi with sender-from roots àààà p-node.org)
     - ProFTP (Implicit TLS with port 21 and login pnode + password identical to server I)
     - UFW (use ‘ufw status’ to list ports opened)

 * ssl certs (p-node.org): /etc/letsencrypt/live/p-node.org/

 * web folder (p-node.org): /data/pnode

 * ssh rsync migration (from server I /home/pnode): /data/pnode/pnode.backup.20190301 (218G)

 ~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~

Install infos:

Installation LXC container to host Libretime

sudo usermod -a -G lxc pnode
id
getent group
newgrp lxd
sudo newgrp lxd
sudo lxc init
sudo lxc-checkconfig

Config network

sudo nano /var/lib/lxc/libretime/config
# Container specific configuration
lxc.rootfs.path = dir:/var/lib/lxc/libretime/rootfs
lxc.uts.name = libretime
lxc.mount.entry = /data/pnode/libretime  /var/lib/lxc/libretime/rootfs/data/pnode/libretime none bind 0 0

# Network configuration
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:45:f7:a9

Container manipulation

Create the container : ubuntu 18.04 amd64

sudo lxc-create -t download -n libretime

List the container and their IP (if started)

sudo lxc-ls -f
sudo lxc-start -n libretime

Get in the container as root

sudo lxc-attach -n libretime
sudo lxc-stop -n libretime

Debug

sudo lxc-ls -f

Configure apache vhost to proxy to the container

sudo systemctl reload apache2

Créer les certificats let's encrypt

sudo certbot -d air.p-node.org --manual --preferred-challenges dns certonly

LibreTime installation

Once logged in the container
'sudo lxc-attach -n libretime)'

apt update
apt upgrade
apt install git nano htop nload
mkdir softs-install/
cd softs-install/
git clone `[`https://github.com/LibreTime/libretime`](https://github.com/LibreTime/libretime)
cd libretime/
sudo ./install
exit #to exit the container

The end of the configuration should be available at
https://air.p-node.org

Debug Libretime

systemctl restart airtime-liquidsoap
systemctl status airtime-liquidsoap
systemctl restart airtime-playout
systemctl status airtime-playout
systemctl reload apache2
systemctl restart rabbitmq-server

After install Libretime

sudo service airtime-playout start
sudo service airtime-liquidsoap start
sudo service airtime_analyzer start
sudo service airtime-celery start

 Migration Airtime ∏serveur 1 > Libretime ∏serveur 2

Database dump ∏serveur 1

`cd /home/pnode`\
`sudo -u postgres pg_dumpall | gzip -c > airtimeserver1-backup.gz`

DB exam

sudo su - postgres\
psql\
postgres=# \list\
postgres=# \c airtime\
You are now connected to database "airtime" as user "postgres".\
airtime=# \d

Download on a computer with scp

gunzip airtimeserver1-backup.gz

to check

grep "/data" airtimeserver1-backup\
grep "/srv" airtimeserver1-backup

Path modification

grep -rl "/srv/airtime/stor/" airtimeserver1-backup | xargs sed -i 's/\/srv\/airtime\/stor\//\/data\/pnode\/libretime\//g'\
gzip airtimeserver1-backup airtimeserver1-backup.gz

Transfer to server host

gunzip airtimeserver1-backup.gz

Clean db and import the backup

sudo -u postgres dropdb airtime\
sudo -u postgres psql -f airtimeserver1-backup

In case of pb update manually the db

sudo -u postgres dropdb airtime
sudo -u postgres psql -f /home/pnode/airtimeserver4-backup
sudo -u postgres psql -f airtime_2.5.2/upgrade.sql airtime
sudo -u postgres psql -f airtime_2.5.3/upgrade.sql airtime
sudo -u postgres psql -f airtime_2.5.5/upgrade.sql airtime
sudo -u postgres psql -f airtime_2.5.9/upgrade.sql airtime
sudo -u postgres psql -f airtime_2.5.10/upgrade.sql airtime
sudo -u postgres psql -f airtime_2.5.12/upgrade.sql airtime
sudo -u postgres psql -f airtime_2.5.13/upgrade.sql airtime
sudo -u postgres psql -f airtime_2.5.14/upgrade.sql airtime
sudo -u postgres psql -f airtime_2.5.15/upgrade.sql airtime
sudo -u postgres psql -f airtime_2.5.16/upgrade.sql airtime
sudo -u postgres psql -f airtime_3.0.0-alpha/upgrade.sql airtime
sudo -u postgres psql -f airtime_3.0.0-alpha.1/upgrade.sql airtime
sudo -u postgres psql -f airtime_3.0.0-alpha.6/upgrade.sql airtime
sudo -u postgres psql -c "SELECT * FROM cc_music_dirs;" airtime

Pbs with privileges

sudo -u postgres psql airtime
airtime=# \du
                                     List of roles
  Role name   |                         Attributes                         | Member of 
--------------+------------------------------------------------------------+-----------
 airtime      | Create DB                                                  | {}
 pnodeairtime |                                                            | {}
 postgres     | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

airtime=# \l
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 airtime   | airtime  | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | postgres=CTc/postgres+
           |          |          |             |             | =c/postgres
(4 rows)

airtime=# \dn
  List of schemas
  Name  |  Owner   
--------+----------
 public | postgres
(1 row)

airtime=# GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO airtime;
GRANT
airtime=# GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public to airtime;
GRANT
airtime=# GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public to airtime;

File transfert

nohup rsync -r -a -v -e "ssh -p6622" *****@p-node.org:/srv/airtime/stor/ /data/pnode/libretime &

Libretime config

 Securisation

sudo rabbitmqctl change_password  

Debug Libretime when it doesn't start

Rabbitmq

systemctl status epmd\
systemd[24581]: epmd.socket: Failed to create listening socket: Address already in use

epmd refer to p-node.org which is not migrated yet :) so /etc/hosts

62.210.123.64 p-node.org

Potential SSL cerrtificate pb for service airtime-liquidsoap status

nano /etc/airtime/airtime.conf\
base_url = air2.p-node.org\
base_port = 80

Check rabbitmq-server config

nano /etc/rabbitmq/rabbitmq-env.conf\
NODE_IP_ADDRESS=127.0.0.1

hostname

nano /etc/hostname\
air2

host

nano /etc/hosts\
127.0.1.1       libretime\
127.0.0.1       localhost air2.p-node.org air2\
::1             localhost ip6-localhost ip6-loopback\
ff02::1         ip6-allnodes\
ff02::2         ip6-allrouters\
To test :
rabbitmqctl status
tail -f /var/log/rabbitmq/rabbit\@air4.log

More Rabbitmq debug

Database list path

sudo -u postgres psql -c "SELECT * FROM cc_music_dirs;" airtime