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

Change Celery broker to rabbitmq #44

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

mkangia
Copy link
Collaborator

@mkangia mkangia commented Dec 16, 2024

https://dimagi.atlassian.net/browse/SC-4028

This changes celery broker from redis to rabbitmq by default.
No changes to result backend being redis, since that is working okay.
Also, rabbitmq as broker and celery as result backend, is a common setup for celery.

The setup has been picked from commcare cloud's rabbitmq setup keeping just the relevant steps for CommCare Analytics

Staging is now using rabbitmq as broker & successfully tested by sending a couple of data source repeaters.
Roll out to production to be scheduled for since the switch needs an empty backlog on celery.

@mkangia
Copy link
Collaborator Author

mkangia commented Dec 16, 2024

@gherceg @AmitPhulera
I have tagged you on this PR to get some perspective from those who probably have worked with rabbitmq & celery for feedback but feel free to ignore it if needed. No pressure on the review here. If you are not comfortable with dropping an approval, just a casual feedback would also be useful.

Copy link

@gherceg gherceg left a comment

Choose a reason for hiding this comment

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

I don't have much experience with the actual setup process for rabbit, but this all looks reasonable. Left a comment about a specific rabbit config value, but that is about all I can contribute here 😄.

log.federation.level = warning
log.mirroring.level = warning
consumer_timeout = 86400001
heartbeat = 600
Copy link

Choose a reason for hiding this comment

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

Just a potential gotcha, celery also sets a broker_timeout, and the lower of that value and this heartbeat value is what is actually used.

@@ -12,6 +12,8 @@ superset_db_name: superset_meta
oauth2_db_name: superset_oauth2
cchq_db_name: superset_cchq_data

rabbitmq_version: 3.9.13-1

Choose a reason for hiding this comment

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

Any specific reason for not using the latest version of rabbitmq? https://www.rabbitmq.com/release-information

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I took the one that was showing up in the available versions for the server I am installing this on, 22.04.4 LTS.
I see HQ is using 3.10.13-1, So I will be okay to jump to that at least, if its available.

Choose a reason for hiding this comment

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

If this is a fresh install, I would suggest go with the latest supported version, which I believe is 4. This would be helpful in longer run where you will save some time in atleast one of the upgrades.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the environment is existing but installing rabbit is new, I can try a more recent version on staging first 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It appears the version being used by HQ is the latest one available via apt. Anything above that version gives a long error message complaining about many depenedency though mainly probably with erlang version.
Looks like we need to change how we install erlang.

The following information may help to resolve the situation:
The following packages have unmet dependencies:
rabbitmq-server : Depends: erlang-base (>= 1:24.3.2) but 1:24.2.1+dfsg-1ubuntu0.1 is to be installed or
                            erlang-base-hipe (>= 1:24.3.2) but it is not installable or
                            esl-erlang (>= 1:24.3.2) but it is not installable
                   Depends: erlang-crypto (>= 1:24.3.2) but 1:24.2.1+dfsg-1ubuntu0.1 is to be installed or
                           esl-erlang (>= 1:24.3.2) but it is not installable
                   Depends: erlang-eldap (>= 1:24.3.2) but 1:24.2.1+dfsg-1ubuntu0.1 is to be installed or
                            esl-erlang (>= 1:24.3.2) but it is not installable
                   Depends: erlang-inets (>= 1:24.3.2) but 1:24.2.1+dfsg-1ubuntu0.1 is to be installed or
...         

So, using the same version as on HQ which I can update to without breaking anything else.

owner: rabbitmq
mode: 0644
loop:
- {"src": "rabbitmq/rabbitmq.conf.j2", "dest": "rabbitmq.conf"}

Choose a reason for hiding this comment

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

Since there is only one element in the loop, would it make sense to have static values for source and dest above?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ya, I held on to it from the cluster implementation I copied over and thought of retaining it for future.

7aa447f

@mkangia mkangia force-pushed the mk/4028-change-celery-backend branch from 7aa447f to dce784e Compare December 21, 2024 18:50
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.

3 participants