Giter Club home page Giter Club logo

compose-scheduler's People

Contributors

lorado avatar rare-magma avatar reddec avatar y0no avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

compose-scheduler's Issues

Multiple jobs per service

I'm currently trying to make one of ofelia, its fork chadburn or this scheduler work for me. The jobs I want to run are an emailer script and a backup job.

tl;dr: I would like to be able to define multiple "exec" jobs on a service via labels.


ofelia is not exactly suitable because it either doesn't pick up updated containers after launch (when only one instance per host is deployed) and it doesn't respect project boundaries (when multiple ofelias are deployed, one per project).

Its fork chadburn does pick up new containers but I don't like that all the logs for all projects are collected in the single instance; multiple instances don't behave either.

This scheduler is nice and minimal and can be deployed with each project. Your comment was actually how I found this scheduler. However, I can only define one scheduled job per service? Something like the following syntax would probably solve my issue:

...
labels:
  net.reddec.scheduler.<jobname>.cron: "@daily"
  net.reddec.scheduler.<jobname>.exec: "@daily"

I am afraid that this would add a lot of complexity, so I also tried to make the alternative "run" labels on separate services work. However the problem with that is that I cannot disable autostarting the container immediately while running docker-compose up -d. This could be achieved with profiles but then your scheduler does not pick up the container at all, since the container is never created โ€“ hence the labels can never be read.

In my tests it appears that when I just let the container autostart with the rest, then

  • immediate invocation that could have undesirable side-effects if it runs too early
  • the first "scheduled" invocation of the container seems to be skipped False alarm; it's run properly but the stdout is lost somehow.

idea: schedule profiles

Maybe you could add labels on the scheduler itself to start certain profiles on a schedule? Something like this:

version: "3"
services:

  app:
    image: myapp:latest
    ...

  backup:
    image: alpine:latest
    command: [ "/bin/ash", "-c", "id; pwd" ]
    profiles: [ backup ]

  cron:
    image: ghcr.io/reddec/compose-scheduler:1.0.0
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    labels:
    # net.reddec.scheduler.<profile>: <schedule>
      net.reddec.scheduler.backup: "@daily"

Although, I am afraid this won't work either, since this profiles: information never reaches the Docker daemon being a docker-compose feature ...

Request - Support exec/entrypoint for exited services.

This project works great for starting up a a service on a schedule, but I noticed that if I specify an exec command - it expects the container to still be running. That's fine - in fact a great feature, but it might be nice if the the service container had exited it spins it back up to run the exec - or alternatively have a way to override the entrypoint of a service on schedule.

How to avoid running a job at "docker compose up"?

Imagine that I have a long running job, for example a backup sync to an online storage service or a disks scrubing task: I would like to avoid launching the job on docker compose up but wait until the scheduled time arrives (in this case, during the night...).

One way to do that is to define a "do nothing/wait indefinitely" command by default in the service and use the exec mode to run the real command on schedule. But in this case, I cannot invoke the job manually with docker compose run / docker compose start if I need/want to.

So I would prefer using the run mode (which semantically is more a start than a run since no container is created for each run), but I can't find to way to avoid running the container at docker compose up time. And I don't see how it could be implemented either since the tool need a container to start which must have been previously created. But maybe someone will come up with an idea?

Feature request: add ability to set user to run the command

Currently I have a container, where I have to run a command as www-data user.
I'm coming from ofelia, which had this option, but I can't use ofelia as I want to have multiple docker-compose projects with their own cron joblers which I can setup with an easy, and with your scheduler it seems to be possible.
Could you add this option?

Timezone support

Hi,

is it possible to change the timezone of the container?
I tried the typical things like setting the TZ environment variable or mounting /etc/localtime or /etc/timezone but this does not wirk.

Any help appreciated.
thx for this great image :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.