3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-13 15:39:31 +01:00
pbot/Docker/README.md

87 lines
2.8 KiB
Markdown
Raw Normal View History

2024-04-01 00:23:30 +02:00
# Docker instructions
### Install Docker
2024-04-01 00:16:25 +02:00
Install docker:
2024-04-01 07:35:43 +02:00
zypper install docker
2024-04-01 00:16:25 +02:00
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.
2024-04-01 00:23:30 +02:00
### Build image and configure PBot
2024-04-01 00:16:25 +02:00
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
2024-04-01 07:35:43 +02:00
Create and start a new container for the first time with options configuring the botnick and IRC server. We will use the `-ti`
2024-04-01 00:16:25 +02:00
flags for `docker run` so we can access PBot's terminal console to run commands like `useradd` to create
your bot-admin account, etc.
See [Configuration](../doc/QuickStart.md#configuration) in the [QuickStart guide](../doc/QuickStart.md) 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](../doc/VirtualMachine.md) for more information.
2024-04-01 00:16:25 +02:00
Follow the steps in [Additional configuration](../doc/QuickStart.md#additional-configuration) in the [QuickStart guide](../doc/QuickStart.md)
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.
2024-04-01 00:23:30 +02:00
### Running PBot
2024-04-01 00:16:25 +02:00
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.
2024-04-01 00:23:30 +02:00
### Further Reading
2024-04-01 00:16:25 +02:00
See [Further Reading](../doc/QuickStart.md#further-reading) in the [QuickStart guide](../doc/QuickStart.md) for additional information.