Skip to content

Running pajbot in a docker container #806

Open

Description

@RAnders00

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.

Activity

  1. Mateyoo commented on Aug 29, 2022

    @Mateyoo

    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.

  2. Mateyoo commented on Aug 29, 2022

    @Mateyoo

    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

  3. Mateyoo commented on Aug 31, 2022

    @Mateyoo

    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
    
  4. transferred this issue frompajbot/pajboton Aug 31, 2022
  5. pajlada commented on Aug 31, 2022

    @pajlada
    Member

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions