distribworks/dkron

no leader after restart service in single node mode

eriklee1895 opened this issue · 1 comments

Describe the bug
I deploy dkron as single node mode, using docker-compose.
I used my local dir as data-dir
After docker-compose up -d, and docker-compose down, and then docker-compose up -d,
I met the no leader problem.
How can I recover? And how to close cluster check absolutely?
I thing the problem is that when the docker image restart, the IP is changed.

To Reproduce
Steps to reproduce the behavior:

  1. my docker-compose.yml
services:
  dkron:
    image: dkron/dkron
    ports:
      - "9500:8080"
    command: agent --server --bootstrap-expect=1 --data-dir=/dkron.data
    volumes:
      - ./dkron.data:/dkron.data
  1. start and restart the docker img
docker-compose up -d
docker-compose down
docker-compose up -d
  1. The dkron is in no leade state
image

I think the problem is I volumed data-dir to a local dir.
So the last running Ip was saved to the raft snapshot.
When I restart the docker image, the container IP is changed.
So dkron start from raft snapshot was failed.

Expected behavior
I hope to simply running in single mode, and using docker-compose to start the service, and save the job info to local storage to prevent data lost. But I don't want to be troubled by the cluster problem.
So how can I config the args?

I was able to fix this by setting the --node-name parameter for the agent to the name of the container