3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-19 10:29:30 +01:00
pbot/Docker/README.md
2024-03-31 15:16:25 -07:00

2.5 KiB
Raw Blame History

Install docker:

zypper install docker docker-compose docker-compose-switch

If not using openSUSE, replace zypper with appropriate package manager, e.g. apt, yum, dnf, apk, etc.

To start docker daemon during boot:

sudo systemctl enable docker

Restart docker daemon:

sudo systemctl restart docker

Verify docker is running:

docker version

Join docker group:

sudo usermod -G docker -a $USER

Log in to the docker group:

newgrp docker

If the above does not work, e.g. because you are in a tmux session, you can su $USER instead.

Build image:

docker build . -t pbot

Copy data directory. The $DATA_DIR should be a unique name identifying the purpose of the bot, i.e. its name or the IRC server.

copy -r ../data $DATA_DIR

I like to use <server>-<nick> when naming my data directories. For example:

copy -r ../data ircnet-candide
copy -r ../data libera-candide
copy -r ../data libera-cantest

Create and start a new container the for the first time with options configuring the botnick and IRC server. We will use the -ti flags for docker run so we can access PBots terminal console to run commands like useradd to create your bot-admin account, etc.

See Configuration in the QuickStart guide for more information about the available configuration options.

$DATA_DIR here must be the full path, i.e. $HOME/pbot/Docker/libera-candide.

docker run --name pbot -ti -v $DATA_DIR:/opt/pbot/persist-data pbot irc.botnick=$NICK irc.server=$SERVER irc.port=$PORT

For example, to connect securely via TLS to irc.libera.chat with botnick coolbot:

docker run --name pbot -ti -v $DATA_DIR:/opt/pbot/persist-data pbot irc.botnick=coolbot irc.server=irc.libera.chat irc.port=6697 irc.tls=1

Follow the steps in Additional configuration in the QuickStart guide to create your bot-admin account, add channels, etc.

To shutdown the bot, press ^C (ctrl-c) or enter die into the PBot terminal console.

To start the bot again in the future:

docker start pbot

This will start the bot in the background. You can reattach to its PBot terminal console with:

docker attach --detach-keys="ctrl-x" pbot

Press ^X (ctrl-x) to detach or ^C (ctrl-c) to shutdown the bot.

See Further Reading in the QuickStart guide for additional information.