ofelia icon indicating copy to clipboard operation
ofelia copied to clipboard

job-exec with swarm container

Open sgohl opened this issue 4 years ago • 4 comments

I want to execute mongodump in a swarm container @daily. As you know, swarm containers are named randomly.

how does this work with ofelia? Is there some kind of filter available, like we use to do this ?

docker ps -f name=mongo1
[job-exec "mongodump"]
schedule = @daily
container = mongo_mongo1.1.f0dmbbmxwza22tzqfhnopzt3f
command = mongodump

you see, that cant go well for very long ...

sgohl avatar Apr 27 '20 19:04 sgohl

Hey @port22 there is no exec for swarm jobs. But what you can try is something like

[job-service-run "mongodump"]
schedule = @daily
image = mongo
network = mongo_network
command =  mongodump -h mongo ...

this will create another swarm service, so you need to make sure it can connect to your Mongo DB.

Not sure if it will satisfy your requirement, but I think that is the only option for now.

taraspos avatar Apr 27 '20 20:04 taraspos

hey thanks for that fast answer!

That was actually my first try, but how do I mount a volume into that freshly created service? for the dumps output ...

sgohl avatar Apr 27 '20 21:04 sgohl

I was afraid you would ask that 😅

Ofelia has no support of mounting volumes yet, unfortunately. #70

taraspos avatar Apr 28 '20 05:04 taraspos

the same issue

4n70w4 avatar Aug 19 '20 13:08 4n70w4