Running pajbot in a docker container
Opened this issue · 4 comments
Discussed in pajbot/pajbot#2091
Originally posted by Mateyoo August 20, 2022
Hi!
In March, I tried running pajbot in a docker container via docker-compose but I didn't have much success.
I think it would be a good idea to make a docker documentation for the bot, so those people who don't have a spare server for hosting the bot could do it by using docker.
I tried running the bot with the following docker-compose.yml file:
version: '3'
services:
pajbot:
image: leppunen/pajbot2:latest
restart: unless-stopped
environment:
- VIRTUAL_HOST=bot.redacted.tld
- LETSENCRYPT_HOST=bot.redacted.tld
- VIRTUAL_PORT=80
networks:
- public_services
# (public_services = my nginx reverse proxy)
volumes:
- ./configs/pajbot2.json:/app/cmd/bot/config.json
- ./db:/var/run/postgresql:ro
- /etc/localtime:/etc/localtime:ro
networks:
public_services:
external: true
You'll have to make a configs folder, and then a pajbot2.json, because docker will think that pajbot2.json is a folder.
I tried running the bot with the following docker-compose.yml file:
The only problem I had when running it is this:
When I pasted the example config file, I got this error:
root@mateyo-vps-1:~/docker/pajbot# docker-compose up
Recreating pajbot_pajbot_1 ... done
Attaching to pajbot_pajbot_1
pajbot_1 | 2022/08/20 23:27:41 An error occurred while loading the config file: invalid character 'm' looking for beginning of value
When I made an empty config file, I got this error:
root@mateyo-vps-1:~/docker/pajbot/configs# touch pajbot2.json
root@mateyo-vps-1:~/docker/pajbot/configs# cd .. && docker-compose up
Creating pajbot_pajbot_1 ... done
Attaching to pajbot_pajbot_1
pajbot_1 | 2022/08/20 23:30:15 An error occurred while loading the config file: unexpected end of JSON input
PS (2022. 08. 29. 20:14 UTC+2):
I just realised that I wanted to paste an ini file's content into a json file. :D
PS (2022. 08. 29. 20:14 UTC+2): I just realised that I wanted to paste an ini file's content into a json file. :D
I formatted the example.ini file into a json file, and now when I try to start the bot, I get this error:
root@mateyo-vps-1:~/docker/pajbot# docker-compose up -d
Creating network "pajbot_pajbot_db" with the default driver
Creating pajbot_db_1 ... done
Creating pajbot_pajbot_1 ... done
root@mateyo-vps-1:~/docker/pajbot# docker logs pajbot_pajbot_1
2022/08/31 11:54:09 An error occurred while loading the config file: twitch WebHook secret must be at least 10 characters and at most 100 characters
2022/08/31 11:54:11 An error occurred while loading the config file: twitch WebHook secret must be at least 10 characters and at most 100 characters
As this issue is related to pajbot2, I've moved this issue to the pajbot2 repo.
If you want to talk about pajbot1 docker support feel free to open a new issue in the pajbot/pajbot repo