3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-22 03:49:29 +01:00
pbot/Docker
2024-03-31 17:36:36 -07:00
..
Dockerfile Add Dockerfile and Docker guide 2024-03-31 15:16:25 -07:00
entrypoint.sh Add Dockerfile and Docker guide 2024-03-31 15:16:25 -07:00
README.md pbot-vm: add PBOTVM_ADDR env var to set address of vm-server 2024-03-31 17:36:36 -07:00

Docker instructions

Install Docker

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 and configure PBot

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

If you are using the pbot-vm virtual machine, be sure to add (after -ti) -e PBOTVM_ADDR=$ADDR where $ADDR is the IP address or hostname of the machine where vm-server is running. See Virtual Machine for more information.

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.

Running PBot

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.

Further Reading

See Further Reading in the QuickStart guide for additional information.