logbot-multiple-channels-corrected on Gentoo: Tips n' Tricks for the Uninitiated

Recently I stood-up an instance of logbot-multiple-channels-corrected on my Pizarro Rockchip.1 As such, I accumulated a large pile of notes that I cobbled into this list of "tips n' tricks". While I'm no talking paperclip, I hope this will be of use to folk in the audience who may be new to any or all of: Gentoo, v, postgresql, lisp, whathaveyou.

We will be covering the following:

  • sbcl & Quicklisp
  • PostgreSQL (with uuid USE flag)
  • ircbot-genesis & ircbot-multiple-channels-corrected
  • logbot-genesis & logbot-multiple-channels-corrected

sbcl & Quicklisp

Both are needed and both are pretty straightforward installation-wise.2 As such, I'm just going to provide a pointer to the Quicklisp installation page and leave it at that.

PostgreSQL (with uuid USE flag)

> As the parenthetical in the above heading suggests, you need to set your USE flag for "uuid" before you emerge Postgres as the logbot.sql you will run later requires the uuid-ossp module.

> Also be wary of your PYTHON_SINGLE_TARGET flag when emerging3 as mine defaulted to 3_5. You can set your PYTHON_SINGLE_TARGET via your package.use:

dev-db/postgresql PYTHON_SINGLE_TARGET: -* python2_7

> While I think this depends on -how- you install, my installation4 created a database cluster with three databases: template0, template1, and postgres. From what I've learned, the 'postgres' database (owned by the 'postgres' superuser created by the installation) is meant to be used as a general purpose database. The 'template1'  database is used as a template when creating new databases, and 'template0' is primarily used to restore template1 in the event you take a dump on it.

> Once installed, your logs and config files will be located somewhere like here:

configs:

/etc/postgresql-9.5/postgresql.conf

logs:

/var/lib/postgresql/9.5/data/postmaster.log

> For postgres-9.5 at least, this is how to start/stop the server:

As root:

/etc/init.d/postgresql-9.5 start

/etc/init.d/postgresql-9.5 stop

> Connecting to the default 'postgres' database (as 'postgres' user):

pizrk003 portage # su postgres -c 'psql'

psql (9.5.12)

Type "help" for help.

postgres=#

> Link to the docs: https://www.postgresql.org/docs/

ircbot-genesis & ircbot-multiple-channels-corrected

> For ircbot-genesis, follow the INSTALL steps on btcbase.org/patches as it will take you most of the way. I also needed to load Quicklisp before 'cl-irc' in the SBCL REPL:

(load "~/quicklisp/setup.lisp")

(ql:quickload :cl-irc)

> Also be on the lookout for a rogue "robots.txt" file that ends up in the .seals directory on the 'init' step of the INSTALL. If you get the following barf on press5 then just remove it from .seals:

lobbes@pizrk003 ~/src/ircbot $ ~/v/v.pl press ircbot-genesis ircbot-genesis.vpatch

----------------------------------------------------------------------------------

WARNING: robots.txt is an INVALID seal for ircbot-genesis.vpatch!

Check that this user is in your WoT.

Otherwise remove the invalid seal from your SEALS directory.

----------------------------------------------------------------------------------

Died at /home/lobbes/v/v.pl line 594.

lobbes@pizrk003 ~/src/ircbot $ ls /home/lobbes/src/ircbot/.seals

ircbot-genesis.vpatch.trinque.sig  robots.txt

lobbes@pizrk003 ~/src/ircbot $ rm /home/lobbes/src/ircbot/.seals/robots.txt

> For ircbot-multiple-channels-corrected, you can do something like:

cd ~/src/ircbot/.wot &&

wget -O ben_vulpes.asc http://wot.deedbot.org/4F7907942CA8B89B01E25A762AFA1A9FD2D031DA.asc

cd ../patches &&

wget -O ircbot-multiple-channels-corrected.vpatch http://btcbase.org/patches/ircbot-multiple-channels-corrected/file

cd ../.seals &&

wget -O ircbot-multiple-channels-corrected.vpatch.ben_vulpes.sig http://btcbase.org/patches/ircbot-multiple-channels-corrected/seal/ben_vulpes

cd ../ &&

v.pl press ircbot-multiple-channels-corrected ircbot-multiple-channels-corrected.vpatch

> Remember to update your symlink for quicklisp:

ln -sfn ~/src/ircbot/ircbot-multiple-channels-corrected ~/quicklisp/local-projects/ircbot

logbot-genesis & logbot-multiple-channels-corrected

The steps for logbot-genesis and logbot-multiple-channels-corrected are similar to ircbot, with the obvious differences relating to interfacing with postgresql.

> You'll want to edit your USAGE to look something like this6. (Note: If you are connecting to the postgres database, you do not specify a pw. In which case, leave that blank in your USAGE file):

(asdf:load-system :logbot)

(defvar *bot*)

(setf *bot*

(logbot:make-logbot

"chat.freenode.net" 6667 "nick" "password"

'("#channel1" "#channel2")

'("db-name" "db-user" "db-password" "db-host")))

; connect in separate thread, returning thread

(logbot:ircbot-connect-thread *bot*)

; or connect using the current thread

; (logbot:ircbot-connect *bot*)

> Similarly to ircbot, don't forget to update your quicklisp symlinks to point to logbot-multiple-channels-corrected:

ln -sfn ~/src/logbot/logbot-multiple-channels-corrected ~/quicklisp/local-projects/logbot

> To start the bot, you'll want to load the following from the SBCL REPL:

(load "/[path]/[to]/quicklisp/setup.lisp")

(ql:quickload :cl-irc)

(ql:quickload :cl-postgres)

(ql:quickload :postmodern)

(load "[Your configured USAGE file referenced above]")

> Checking your LOG table to see logged IRC lines:

pizrk003 lisp # su postgres -c 'psql'

psql (9.5.12)

Type "help" for help.

postgres=# SELECT * FROM LOG;

id                  |    target    |  message   |      host       | source |  user   |        received_at

--------------------------------------+--------------+------------+-----------------+--------+---------+----------------------------

8061cf9a-1e0b-4a3c-a0d9-837afa8cae55 | #lobbestest  | test       | 192.121.170.137 | lobbes | ~lobbes | 2018-07-16 03:05:06.698238

ab8fc726-8c46-4495-b571-64789de02826 | #lobbestest  | test five  | 192.121.170.137 | lobbes | ~lobbes | 2018-07-16 03:05:11.140429

21f03cb6-3322-4332-af85-133d742113a0 | #lobbestest  | test 1234  | 192.121.170.137 | lobbes | ~lobbes | 2018-07-16 03:30:56.743491

b6d7fa3f-1e84-4fde-9e4d-b3dd7e2b8d32 | #lobbestest2 | test'      | 192.121.170.137 | lobbes | ~lobbes | 2018-07-16 05:49:53.669309

cd48a6c0-dc8e-449e-bc68-5a3aabc16c48 | #lobbestest  | test       | 192.121.170.137 | lobbes | ~lobbes | 2018-07-16 05:49:57.800388

2e7c2bb6-e9c4-41fb-a629-1a0f5e1682ba | #lobbestest2 | test again | 192.121.170.137 | lobbes | ~lobbes | 2018-07-16 05:56:07.579301

96b6d216-44e5-4b4d-99b8-c136fb538b27 | #lobbestest  | test niaga | 192.121.170.137 | lobbes | ~lobbes | 2018-07-16 05:56:30.749328

  1.  "Auctionbot 2.0" will sit on top of this. Look soon for a guide on feeding commands to/from logbot-multiple-channels-corrected via postgres triggers []
  2. actually, I think my P-rockchip came with sbcl already emerged []
  3. I've quickly learned that the "-a" option is your friend when it comes to "emerge" []
  4. which was via portage using: a package mask on ">dev-db/postgresql-9.5.12"; "postgresql" and "uuid" USE flags in "make.conf"; then "emerge -av dev-db/postgresql" []
  5. this barf, of course, may look different depending on your V []
  6. pardon the lack of indents; blog formatting woes []

One Response to “logbot-multiple-channels-corrected on Gentoo: Tips n' Tricks for the Uninitiated”

  1. [...] lobbesblog Yes, you are correct: The blog of lobbes « logbot-multiple-channels-corrected on Gentoo: Tips n' Tricks for the Uninitiated [...]

Leave a Reply