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

Celery Configuration Required in nautobot_config.py #672

Closed
nniehoff opened this issue Jul 10, 2021 · 0 comments · Fixed by #676
Closed

Celery Configuration Required in nautobot_config.py #672

nniehoff opened this issue Jul 10, 2021 · 0 comments · Fixed by #676
Assignees
Labels
type: bug Something isn't working as expected

Comments

@nniehoff
Copy link
Contributor

Environment

  • Python version: 3.6.14
  • Nautobot version: 1.1.0b2

In nautobot_config.py I have CACHES defined as:

CACHES = {
    "default": {
        "BACKEND": "django_redis.cache.RedisCache",
        "LOCATION": parse_redis_connection(redis_database=0),
        "TIMEOUT": 300,
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
        },
    }
}

By default celery then tries to connect to redis on localhost:6379. This is the default in settings.py for CACHES["default"]["LOCATION"] however in my case redis is in a separate container at redis:6379 specified using the environment variables NAUTOBOT_REDIS_HOST and NAUTOBOT_REDIS_PORT. I had to add:

CELERY_BROKER_URL = CACHES["default"]["LOCATION"]
CELERY_RESULT_BACKEND = CACHES["default"]["LOCATION"]

to nautobot_config.py after the declaration of CACHES to catch my change. I also found:

CELERY_BROKER_URL=...
CELERY_RESULT_BACKEND=...

environment variables in the nautobot repo in development/dev.env however I don't see a spot in Nautobot where these are actually used.

Steps to Reproduce

  1. Configure redis with an external hostname via env vars.
  2. Start Nautobot celery worker

Expected Behavior

Celery should connect to the redis host specified.

Observed Behavior

Celery attempts to connect to localhost:6379

@jathanism jathanism self-assigned this Jul 12, 2021
@jathanism jathanism added type: bug Something isn't working as expected status: accepted labels Jul 12, 2021
jathanism added a commit that referenced this issue Jul 19, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants