Traefik (docker) + Phantombot (docker)


Heyho guys,
I was dockerizing my server and have been using traefik to do so. Everything works fine except for phantombot and I am at my wits end.
What is happening:
After login, websocket is unreachable
What I have tried:
changing port from 25000 in botlogin to 80 (solves bad gateway)
enabled portforwarding from ports 81 to 84 from host to container in docker-compose

Here is my docker-compose.yml for Phantombot: (domain redacted)

version: ‘3.7’
# context: .
container_name: phantombot
image: sleepiestmario/phantombot:stable
# - “25000-25005:25000-25005”
restart: always
- traefik.enable=true
- traefik.port=80
- ./botlogin.txt:/phantombot/config/botlogin.txt
- /path/to/phantombot.db:/phantombot/config/phantombot.db
- /etc/localtime:/etc/localtime:ro
#network_mode: “host”
tty: true
- web
external: true

And here is my compose for traefik:

version: ‘3’


image: traefik:latest
container_name: traefik
- “1336:80”
- “1337:443”
- “1338:8080”
- web
- ./traefik.toml:/etc/traefik/traefik.toml
- ./acme.json:/acme.json
- /var/run/docker.sock:/var/run/docker.sock:ro
- /etc/letsencrypt/live/
- /etc/letsencrypt/live/

  - traefik.port=8080
  - traefik.enable=true

external: true


None of us are using this type of configuration to test or troubleshoot with on the development team. Perhaps another community member uses this type of configuration and can provide input.

That said, my one guess is, the configuration file that is loaded by the Control Panel indicates the port to use. If that port is not opened or is not forwarded to the same port through your container, the web socket will be unreachable. You should make sure that ports 83 and 84 are in fact responding.

If not and you need to use different ports, you can set the following as well in botlogin.txt; note that PhantomBot will use these ports and publish to the proper files for the YouTube Player and Control Panel:

ytsocketport=the port you want to use
panelsocketport=the port you want to use


I am getting the following errors when changing to ports 91 and 92:
[ERROR] [sendHTMLErrorNoHeader()] HTTP Server: sendHTMLError(500): Broken pipe
[ERROR] [sendData()] HTTP Server: sendData(): Broken pipe

Without Traefik in front of it, it works perfectly. I guess that the problem pertaining that particular setup is that Traefik is using https to route from outside into an http network. So PB thinks that it is working under http and displays the webserver as such (that is remedied by Traefik to be https) and tries to fetch information via http from ports 91 and 92.
Could the trick be to just enable https in Phantombot and generate a keystore? I have toplvl and wildcard certificates for my domain.
Thanks for the help so far :slight_smile:


Perhaps. I have never used Traefik, so I cannot provide an absolute answer. You could try enabling HTTPS and installing a keystore in PhantomBot. As I said before, none of the developers use this configuration or have it setup.


I do use a somewhat similar setup myself (PhantomBot running in docker behind a nginx reverse proxy), and I had to enable HTTPS in Phantombot, and use a keystore containing the cert/key from letsencrypt that the nginx proxy was also using to get it all working without issues like that.


Thanks. I did not have the time to try it out :slight_smile:
I tried to circumvent the whole keystore-stick because I have to add to my after-hook-script of certbot and then have to restart the bot (which is a breeze with docker btw) :slight_smile:

closed #7

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.