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

Load redis configuration from clowder when available #77

Open
avisiedo opened this issue Nov 8, 2022 · 0 comments
Open

Load redis configuration from clowder when available #77

avisiedo opened this issue Nov 8, 2022 · 0 comments

Comments

@avisiedo
Copy link

avisiedo commented Nov 8, 2022

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:

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

No branches or pull requests

1 participant