distribworks/dkron

job and execution history getting lost

ravi55mobifyi opened this issue · 3 comments

Describe the bug
I have created a custom docker image for dkron. I am able to posta job using postman API and see the execution history. But if I delete the docker container and then recreate docker container then I don't find any jobs. Also previous execution history is erased. I am using a volume so I believe should be able to see data even if I delete and recreate container

Dockerfile
`FROM python:3.8-slim-buster
RUN apt-get update && apt-get install -y curl && apt-get install -y unzip
RUN echo "deb [trusted=yes] https://repo.distrib.works/apt/ /" >> /etc/apt/sources.list
RUN apt-get update && apt-get install -y curl dkron
RUN mkdir /app
COPY requirements.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt
COPY test.py /app/test.py
COPY updateMongo.py /app/updateMongo.py
COPY run_script.sh /app/run_script.sh
COPY run_mongo.sh /app/run_mongo.sh
RUN mkdir -p /etc/dkron
RUN mkdir -p /var/google/dkron-data
COPY dkron.yml /etc/dkron/dkron.yml
WORKDIR /app

RUN chmod +x run_script.sh
RUN chmod +x run_mongo.sh
EXPOSE 8080
EXPOSE 6868
CMD ["dkron", "agent", "--server", "--config", "/etc/dkron/dkron.yml"]

dkron.yml file

node-name: apttttt007-dkron-cluster
server: true
httpp_addr: 0.0.0.0:8099
bootstrap-expect: 1
log-level: debug
ui: true
backend:
level: "boltdb"
path: "/var/lib/dkron"
`

docker-compose.yml file
`version: '3'

services:
dkron-server:
image: apttttt007/tfm-dkron:latest
hostname: dkron-server
container_name: dkron-server
ports:
- "8099:8080"
- "6868:6868"
environment:
- DKRON_MODE=server
volumes:
- data:/var/lib/dkron
command: ["dkron", "agent", "--server", "--config", "/etc/dkron/dkron.yml"]

volumes:
data:`

To Reproduce
Steps to reproduce the behavior:

  1. build docker file
  2. run docker container
  3. post a job and et it execute for few times
  4. stop docker container and delete docker container
  5. create docker container again from docker image

@vcastellm
could you please help me

I have also tried with command

docker run -d -p 8080:8080 -v ~/dkron.data:/dkron.data --name dkron dkron/dkron agent --server --bootstrap-expect=1 --data-dir=/dkron.data

if i delete container and run this command again
i cant see cron jobs that I created earlier and previous execution hsitory is erased

Please refer to #1027 , specifically the answer comment.