Project

Profile

Help

Issue #3861

closed

A remote Redis server is being ignored when configured at server.yaml

Added by tchellomello over 6 years ago. Updated almost 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

A remote Redis server is being ignored when configured at server.yaml.

Regardless of the configuration placed for Redis, it will always point back to localhost.

Note: Remote database is working as expected

#server.yaml
bash-4.4# cat server.yaml  | grep -v ^$  | grep -v ^#
REDIS:
  HOST: redis
  PORT: 6379
  PASSWORD: 

DATABASES:
  default:
    CONN_MAX_AGE: 0
    ENGINE: django.db.backends.postgresql_psycopg2
    NAME: pulp
    USER: pulp
    PASSWORD: pulp
    HOST: pgsql
    PORT: 5432

SECRET_KEY: lrr7on0ossjj993vq8o6bbpnk5x+5*zl6n(+$8a0#982_$v^gx
DEBUG: True

connectivity works

bash-4.4# ping redis
PING redis (172.18.0.3): 56 data bytes
64 bytes from 172.18.0.3: seq=0 ttl=64 time=0.100 ms

Troubleshooting with the rpdb we can see the configured is being merged by https://github.com/pulp/pulp/blob/master/pulpcore/pulpcore/app/settings.py#L259-L272


bash-4.4# rq worker -n 'resource_manager@%h' -w 'pulpcore.tasking.worker.PulpWorker'
pdb is running on 127.0.0.1:4444
bash-4.4# telnet localhost 4444
> /nightly/pulp/pulpcore/pulpcore/app/settings.py(273)load_settings()
-> return settings
(Pdb) l
268      
269          for setting_name, setting_value in settings.items():
270              setattr(sys.modules[__name__], setting_name.upper(), setting_value)
271      
272          import rpdb; rpdb.set_trace()
273  ->        return settings
274      
275      
276      # Read PULP_SETTINGS environment variable to find the location of server.yaml,
277      # defaults to /etc/pulp/server.yaml
278      PULP_SETTINGS = os.getenv('PULP_SETTINGS', '/etc/pulp/server.yaml')
(Pdb) settings
{'DATABASES': {'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'pulp', 'USER': 'pulp', 'CONN_MAX_AGE': 0, 'PASSWORD': 'pulp', 'HOST': 'pgsql', 'PORT': 5432}}, 'logging': {'version': 1, 'disable_existing_loggers': False, 'formatters': {'simple': {'format': 'pulp: %(name)s:%(levelname)s: %(message)s'}}, 'handlers': {'console': {'class': 'logging.StreamHandler', 'formatter': 'simple'}, 'syslog': {'address': '/dev/log', 'class': 'logging.handlers.SysLogHandler', 'formatter': 'simple'}}, 'loggers': {'': {'handlers': ['syslog'], 'level': 'INFO'}}}, 'SERVER': {'WORKING_DIRECTORY': '/var/lib/pulp/tmp'}, 'CONTENT': {'WEB_SERVER': 'django', 'HOST': None}, 'REDIS': {'HOST': 'redis', 'PORT': 6379, 'PASSWORD': None}, 'PROFILING': {'ENABLED': False, 'DIRECTORY': '/var/lib/pulp/c_profiles'}, 'SECRET_KEY': 'lrr7on0ossjj993vq8o6bbpnk5x+5*zl6n(+$8a0#982_$v^gx', 'DEBUG': True}
(Pdb) settings.get('REDIS')    
{'HOST': 'redis', 'PORT': 6379, 'PASSWORD': None}

However, the worker will try to connect locally:

bash-4.4# rq worker -n 'resource_manager@%h' -w 'pulpcore.tasking.worker.PulpWorker'
pdb is running on 127.0.0.1:4444
Error 99 connecting to localhost:6379. Address not available.

Also available in: Atom PDF