ofelia icon indicating copy to clipboard operation
ofelia copied to clipboard

How to make it work with Docker-Compose ?

Open ghostlexly opened this issue 2 years ago • 9 comments

Hello,

I'am using it today with docker-compose like following :

[job-exec "job-executed-on-running-container"]
schedule = @every 1m
container = message_phpfpm_1
command = php artisan queue:work --tries=3 --max-time=60

message is my project name on docker-compose. How can i call the container with only the container name to be able to use the same file on multiple projects ?

Example of expected ini file:

[job-exec "job-executed-on-running-container"]
schedule = @every 1m
container = phpfpm_1
command = php artisan queue:work --tries=3 --max-time=60

ghostlexly avatar Oct 31 '22 23:10 ghostlexly

You can use labels configuration instead of ofelia ini config.

sqlmiles avatar Nov 10 '22 11:11 sqlmiles

It's in the readme.

maietta avatar Nov 10 '22 17:11 maietta

Can i do the same with the ini ? The labels are good but i don't want to have a long list of labels on my docker compose files

ghostlexly avatar Nov 16 '22 10:11 ghostlexly

You could probably mount your ini to /etc/ofelia/config.ini inside the container and see if it works

rishid avatar Nov 30 '22 22:11 rishid

@ghostlexly

I tested mapping "./ofelia/config.ini:/etc/ofelia/config.ini" and it won't works.

Correct path is /etc/ofelia.conf

So the correct mapping would be something like

  • ./ofelia/config.conf:/etc/ofelia.conf

antonellopasella avatar Dec 15 '22 11:12 antonellopasella

Just for further reference, I was able to make it work that way in the volumes:

  • ./docker/scheduler:/etc/ofelia

Inside folder docker->scheduler it has config.ini

lincolnaleixo avatar Jan 25 '23 18:01 lincolnaleixo

Are you really running the Laravel queue every minute? Why? Is there a reason?

I would understand if you let the scheduler run every minute but not the queue...

K2ouMais avatar Apr 23 '23 20:04 K2ouMais

That readme is missing crucial information

If I want to set global config, how to do it with labels is it

labels:
            ofelia.slack-webhook: 'https://hooks.slack.com/services/...'
            ofelia.slack-only-on-error: 1

Or

labels:
            ofelia.global.slack-webhook: 'https://hooks.slack.com/services/...'
            ofelia.global.slack-only-on-error: 1

What about the no-overlap, is this correct?

            ofelia.job-exec.mailqueue.schedule: "@every 1m"
            ofelia.job-exec.mailqueue.command: "/var/www/html/bin/console swiftmailer:spool:send --mailer=queue --message-limit=30"
            ofelia.job-exec.mailqueue.no-overlap: 1       

Edit:

After trying it seems, the first option is the correct one and the no-overlap should be no-overlap: true

Tofandel avatar Jun 02 '23 09:06 Tofandel

Are you really running the Laravel queue every minute? Why? Is there a reason?

I would understand if you let the scheduler run every minute but not the queue...

Yes, because there have been instances where some of my queues got stuck, and it caused all the other queues to be blocked. So, I added a --max-time parameter to limit it in time and kill any queues that remain stuck.

ghostlexly avatar Jun 20 '23 10:06 ghostlexly