muesli / beehive

A flexible event/agent & automation system with lots of bees 🐝
GNU Affero General Public License v3.0
6.3k stars 324 forks source link

Docker image doesn't save new bees. #249

Closed sgama closed 5 years ago

sgama commented 5 years ago

I'm trying to set up Beehive on my server but I can't seem to get it to save the Cron or Twitter bee. Here's my docker-compose file:

version: "3.5"

services:
  beehive:
    container_name: beehive
    hostname: beehive
    image: fribbledom/beehive:latest
    expose:
      - 8181
    environment:
      - CANONICAL_URL=http://localhost:8181/
    ports:
      - 8181:8181
    restart: always
    volumes:
      - beehive_data:/conf

volumes:
  beehive_data:
    name: beehive_data

The docker logs don't seem to show any error. Process to reproduce:

No bees are available. Checking /conf/beehive.conf shows a JSON file with these contents:

{
  "Bees": [],
  "Actions": null,
  "Chains": []
}

Let me know if I can provide any additional clarifications or if you require any help with the docker-compose file.

muesli commented 5 years ago

The config file gets saved on shutdown, but if a simple reload already makes all configured bees disappear, it sounds like a different issue. Can you reproduce this by directly running the image (like mentioned in the README) outside docker-compose?

sgama commented 5 years ago

Interesting! I figured it out.

I ran the image directly as mentioned in the README:

 docker run --name beehive -d -e CANONICAL_URL="http://localhost:8181" -p 8181:8181 fribbledom/beehive

and it worked. I was able to save and retrieve a bee. So I was confused as docker-compose is just a wrapper around docker. So I created a new Dockerfile from scratch and it also worked!

Turns out it was the trailing slash in the CANONICAL_URL. Using

    environment:
      - CANONICAL_URL=http://localhost:8181

in the docker-compose file pasted above worked.

You can't have a trailing slash.

muesli commented 5 years ago

Interesting find! I need to look into what's causing that and make sure that's not leading to any issues. It's probably a fairly common "mistake" (I wouldn't even call it one, it's perfectly valid input).

muesli commented 5 years ago

Fixed in master. Thanks for the detailed report!