nxy irc bot
Go to file
2017-08-22 20:27:52 +02:00
bot Uppercased sql statements 2017-08-22 20:05:32 +02:00
files Added db dump timer 2017-08-22 20:27:52 +02:00
.gitignore Cleanup, fixed some bugs (yt etc) 2017-07-31 15:29:59 +02:00
FORMATTING.md Massive refactoring/-structuring 2017-07-07 02:49:37 +02:00
README.md Added db dump timer 2017-08-22 20:27:52 +02:00
requirements.txt Moved @irc3.plugin into bot.plugins.BasePlugin -> saved some lines 2017-08-22 16:47:10 +02:00
TODOs Fixed bug in rainbow function which breaks output with numbers 2017-08-01 15:50:12 +02:00
tox.ini Updated flake8 settings 2017-08-22 19:02:45 +02:00

Installation

Open psql as user postgres:

psql -U postgres

Create a user with password, allowed to login and a database:

CREATE ROLE nxy WITH ENCRYPTED PASSWORD 'your-password';
ALTER ROLE nxy LOGIN;
CREATE DATABASE nxy_prod OWNER nxy;
\q

Apply database schema and optionally restore a dump:

psql -U nxy -U nxy_prod < nxy/files/schema.sql
psql -U nxy -U nxy_prod < path/to/dump.sql

Clone git repo, create virtual env, activate it and install dependencies:

git clone https://gitfap.de/mrhanky/nxy.git
python3 -m venv env
source env/bin/active
pip install -U -r nxy/requirements.txt

Copy sample configs to $HOME and edit them:

cp nxy/files/{.env,config.json} .
vim .env config.json

Enable linger for the bot user (so it starts at boot and keeps running) and install + activate systemd unit:

sudo loginctl enable-linger nxy
mkdir -p $HOME/.config/systemd/user
ln -fs $HOME/nxy/files/nxy-bot.service $HOME/.config/systemd/user
systemctl --user daemon-reload
systemctl --user enable --now nxy-bot.service

Create directory for database dumps and activate timer:

mkdir -p $HOME/backups
ln -fs $HOME/nxy/files/nxy-db-dump.{timer,service} $HOME/.config/systemd/user
systemctl --user daemon-reload
systemctl --user enable --now nxy-db-dump.timer