Sopel

From Deathbybandaid Wiki
Revision as of 20:20, 8 December 2021 by Deathbybandaid (talk | contribs) (Created page with "The Current Guide is mainly SpiceBot related, and runs in a proxmox container. ==Proxmox== ===Update Template Listing=== <nowiki>pveam update</nowiki> ===Install Template=== <nowiki>debian-8-turnkey-nginx-php-fastcgi_14.2-1_amd64.tar</nowiki> I use this template specifically because it saves some time/headache getting php and nginx to cooperate. ===Start Template=== Go through the containers initial setup. ==Upgrade Jessie to Stretch== <nowiki>cd /etc/apt/sources.list...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The Current Guide is mainly SpiceBot related, and runs in a proxmox container.

Proxmox

Update Template Listing

pveam update

Install Template

debian-8-turnkey-nginx-php-fastcgi_14.2-1_amd64.tar

I use this template specifically because it saves some time/headache getting php and nginx to cooperate.

Start Template

Go through the containers initial setup.

Upgrade Jessie to Stretch

cd /etc/apt/sources.list.d/
nano *

Comment out ALL of the lines.

nano /etc/apt/sources.list

Add:

 deb http://httpredir.debian.org/debian stretch main
 deb http://httpredir.debian.org/debian stretch-updates main
 deb http://security.debian.org stretch/updates main
 
apt-get update && apt-get dist-upgrade -y

Answer all the defaults.

reboot

Re-add MySQL

Clear mysql and mariadb for safety.

 apt remove maria*
 apt remove mysql*
 

Add source for MySQL and install.

 echo -e "deb http://repo.mysql.com/apt/debian/ stretch mysql-5.7\ndeb-src http://repo.mysql.com/apt/debian/ stretch mysql-5.7" > /etc/apt/sources.list.d/mysql.list
 wget -O /tmp/RPM-GPG-KEY-mysql https://repo.mysql.com/RPM-GPG-KEY-mysql
 apt-key add /tmp/RPM-GPG-KEY-mysql
 apt update
 apt install mysql-server
 

Create Sudo Bot User

 
 apt install sudo
 
 adduser spicebot
 usermod -aG sudo spicebot
 
 sudo visudo
 spicebot ALL=(ALL) NOPASSWD: ALL
 
 nano /etc/passwd
 spicebot:x:1001:1001:,,,:/home/spicebot:/bin/bash
 

Python

 apt install python-dev python-pip -y
 pip install --upgrade pip setuptools
 pip install backports.ssl_match_hostname
 apt-get install python-dateutil 
 apt-get install python-git
 apt-get install python-simplejson
 pip install BeautifulSoup
 pip install fake_useragent
 pip install html2text
 pip install num2words
 pip install irc
 pip install pyparsing
 pip install setuptools
 pip install word2number
 

Arrow from source

 pip uninstall arrow
 pip install git+https://github.com/crsmithdev/arrow.git
 
 OR
 
 pip uninstall arrow
 git clone https://github.com/crsmithdev/arrow.git
 cd arrow
 pip install -r requirements.txt
 pip install -e
 

Node.js

 curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
 apt-get install -y nodejs
 

Other Handy Dependencies

 apt install bc build-essential libssl-dev libperl-dev pkg-config -y
 

Nginx

We need to make sure nginx is on an alternate port from 80, as Pi-hole needs it.

nano /etc/nginx/sites-enabled/default

Delete All Content and replace with:

 server {
         listen 81;
 
         #root /home/spicebot/.sopel/spicebot/web;
 
         index index.html index.php;
 
 }
 
 

Then restart nginx:

service nginx restart

Pi-hole

Install Pi-hole

 curl -sSL https://install.pi-hole.net | bash
 pihole -a -p
 

shutdown container and change dns setting to

127.0.0.1

Stikked

 mysql -u root -p
 CREATE DATABASE stikked;
 exit
 

ZNC

Download and install

 sudo wget https://znc.in/releases/znc-1.7.0.tar.gz
 sudo tar -xzvf znc-1.7.0.tar.gz
 cd znc-1.7.0
 ./configure
 sudo make
 sudo make install
 

Create the service file

 nano /lib/systemd/system/znc.service
 

And Add

 [Unit]
 Description=ZNC, an advanced IRC bouncer
 After=network-online.target
 
 [Service]
 User=spicebot
 ExecStart=/usr/local/bin/znc -f --datadir=/home/spicebot/.znc
 
 [Install]
 WantedBy=multi-user.target
 
 
 
 systemctl enable znc.service
 
 cd /home/spicebot/.znc/configs/
 

Kiwi irc

Download the Kiwi source or clone the git repository

 cd /opt
 git clone https://github.com/prawnsalad/KiwiIRC.git && cd KiwiIRC
 

Install the dependencies

 npm install
 

Copy and edit the configuration as needed

 cp config.example.js config.js
 nano config.js
 

Make sure the client code is built

 ./kiwi build
 

Add Crontab to start kiwi at boot

 @reboot /opt/KiwiIRC/kiwi start
 

Sopel

Install the Base Bot Framework

pip install sopel

Disable Stock Modules

 cd /usr/local/lib/python2.7/dist-packages/sopel/modules
 mkdir stock
 mv * stock/
 

Setup github directories

 git clone https://github.com/deathbybandaid/SpiceBot.git /home/spicebot/.sopel/spicebot
 git clone https://github.com/deathbybandaid/SpiceBot.git /home/spicebot/.sopel/spicebotdev
 cd /home/spicebot/.sopel/spicebotdev
 git checkout dev
 chown -R spicebot:sudo /home/spicebot/.sopel/
 

Setup systemd

 cd /lib/systemd/system/
 wget https://raw.githubusercontent.com/deathbybandaid/SpiceBot/master/System-Files/systemd/spicebot.service
 wget https://raw.githubusercontent.com/deathbybandaid/SpiceBot/master/System-Files/systemd/spicebotdev.service
 systemctl enable spicebot.service
 systemctl enable spicebotdev.service