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

Backported Docker and Celery fixes #1332

Merged
merged 7 commits into from
Aug 2, 2024

Conversation

joeribekker
Copy link
Member

@joeribekker joeribekker commented Aug 2, 2024

Backported the Docker changes from this PR to keep the changes to existing installations to a minimum.

Also backported the Celery fix, as well as the requirements fixes that were needed in 1.18 and done in develop branch.

joeribekker and others added 6 commits August 2, 2024 11:03
- Added os upgrade to be sure the libraries as up to date as possible everytime the image is built.
- Replaced vim with nano
- Used uv instead of pip (super fast drop in replacement)
- Compile translatable messages during build
- Added proper release scheme attributes
- Separated Celery into worker, beat and monitor containers
- Added additional health checks to steer the ordering of container-startup

There was 1 container reserved for all Celery related things:
worker, beat and monitoring. According to Celery documentation
it's best to have a separate Beat process so you can scale
separately. Also, combining monitoring with the events itself
could cause issues. Everything is separated now.

Additional health checks and dependancies are introduced to
Docker-compose so Celery nicely waits for the database to be
prepped.
    - The notifications-api-common library interferes with Celery's task
      loading mechanism, which prevents tasks form our apps from showing
      up in the admin. The temporary fix is to load the library after all
      our apps
The Celery docs make clear that the name parameter of the
task decorator should be unique and that generally it functions
as an identifier the task. From this we can also infer that
names that change at runtime, due to gettext, are undesirable.
This in fact created issue with triggering certain periodic tasks
in the admin, due to a mismatch between the registered name (English)
and the translated name used at runtime (Dutch).

TLDR: let Celery generate the name, and directly translate the periodic
task names for Beat so that the entries in the Django periodic task
admin are human-readable. This is not ideal as we would like to use
(lazy) gettext here, but Celery doesn't allow that, so this strikes
the balance between human-readability and predictable task discovery.
@joeribekker joeribekker force-pushed the feature/1.18.x-docker-love branch from e59b450 to 7e15aee Compare August 2, 2024 10:07
    - specifying multiple package versions without separator (comma or semicolon)
      is deprecated since pip 24.1
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 73.07692% with 7 lines in your changes missing coverage. Please review.

Project coverage is 95.16%. Comparing base (4485fee) to head (d8ab989).

Files Patch % Lines
src/open_inwoner/celery.py 69.56% 7 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##           stable/1.18.x    #1332      +/-   ##
=================================================
- Coverage          95.17%   95.16%   -0.02%     
=================================================
  Files                981      981              
  Lines              35665    35685      +20     
=================================================
+ Hits               33945    33958      +13     
- Misses              1720     1727       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joeribekker joeribekker merged commit 2887c65 into stable/1.18.x Aug 2, 2024
15 checks passed
@joeribekker joeribekker deleted the feature/1.18.x-docker-love branch August 2, 2024 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants