Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a container to run a DJ worker in dev #5333

Merged

Conversation

sauloperez
Copy link
Contributor

What? Why?

Time has come to run background jobs in development with docker. I need it to work on #5294 but I think it's better to separate things and ship things independently.

This, however, doesn't let us run letter opener so you'll see errors like

worker_1  | [Worker(host:733aee3327ba pid:1)] 1 jobs processed at 2.9919 j/s, 0 failed
worker_1  | Couldn't find a suitable web browser!
worker_1  | Set the BROWSER environment variable to your desired browser.
worker_1  | Warning: program returned non-zero exit code #1
worker_1  | /usr/bin/xdg-open: 851: /usr/bin/xdg-open: www-browser: not found
worker_1  | /usr/bin/xdg-open: 851: /usr/bin/xdg-open: links2: not found
worker_1  | /usr/bin/xdg-open: 851: /usr/bin/xdg-open: elinks: not found
worker_1  | /usr/bin/xdg-open: 851: /usr/bin/xdg-open: links: not found
worker_1  | /usr/bin/xdg-open: 851: /usr/bin/xdg-open: lynx: not found
worker_1  | /usr/bin/xdg-open: 851: /usr/bin/xdg-open: w3m: not found
worker_1  | xdg-open: no method available for opening 'file:////usr/src/app/tmp/letter_opener/1588260352_4013345_60678af/rich.html'

IMO, this is not a big deal as most of the time I just want the job to happen and not so much about the actual mail or other UI. Now, I need subscriptions to be processed and nothing more. We can solve it after this PR.

What should we test?

run docker-compose up and then:

$ docker-compose exec web bundle exec rails c
irb(main):002:0> Delayed::Job.enqueue SubscriptionPlacementJob.new

You should see log lines like

worker_1  | [Worker(host:733aee3327ba pid:1)] Job SubscriptionPlacementJob (id=13) RUNNING 

from the shell where you boot docker-compose.

Release notes

Run delayed jobs in development with docker

Changelog Category: Added

@sauloperez sauloperez added the dev-test A dev need to test this one label Apr 30, 2020
@sauloperez sauloperez self-assigned this Apr 30, 2020
Copy link
Contributor

@luisramos0 luisramos0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice one!

@luisramos0
Copy link
Contributor

for once I thought you were going to say "Time has come to run docker in production." 🤣

@sauloperez
Copy link
Contributor Author

LOL no 😂

@sauloperez
Copy link
Contributor Author

sauloperez commented May 6, 2020

Sorry guys, I'm merging because I need it to keep working on #5334 and not waste efforts dealing with conflicts. I can confirm it does work.

@sauloperez sauloperez merged commit ace3767 into openfoodfoundation:master May 6, 2020
@sauloperez sauloperez deleted the add-worker-docker-container branch May 6, 2020 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev-test A dev need to test this one
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants