Skip to content

Load redis configuration from clowder when available #77

Open
@avisiedo

Description

@avisiedo

I have been playing to deploy it in the ephemeral environment (wip) and I suggest this ticket to read configurations provided by clowder operator.

When it is deployed with an openshift template using clowderapp resource, it injects into the pod a secret with several configurations; in this particular scenario, the redis configuration (host, port) are provided into a json file which is pointed out by ACG_CONFIG environment variable. Currently exists app-common-python to help to read this parameters.

at appservice/config.py it could be something like:

from app_common_python import LoadedConfig, isClowderEnabled

# https://github.com/RedHatInsights/app-common-python
if isClowderEnabled():
    REDIS_SERVICE_HOST = LoadedConfig.inMemoryDb.hostname
    REDIS_SERVICE_PORT = int(LoadedConfig.inMemoryDb.port)
else:
    REDIS_SERVICE_HOST = environ.get('REDIS_SERVICE_HOST', 'localhost')
    REDIS_SERVICE_PORT = int(environ.get('REDIS_SERVICE_PORT', '6379'))

and use it at appservice/multiplexor.py by addding the app-common-python package:

   REDIS = redis.asyncio.Redis(host=config.REDIS_SERVICE_HOST,
                               port=config.REDIS_SERVICE_PORT)

Finally at appservice/Containerfile I added the dependency.

RUN pip3 install redis starlette httpx websockets uvicorn app-common-python

Additional Information:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions