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

Config: Granular env-based Solution for Connection Strings #57

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

Conversation

Samk13
Copy link
Member

@Samk13 Samk13 commented Nov 26, 2024

❤️ Thank you for your contribution!

Description

Add logic to build connection URLs from env vars if available
needed for helm charts security best practices.

This PR includes:

  • Build DB URI
  • Build Redis URL
  • Build MQ URL

Partially closes: inveniosoftware/helm-invenio#112
Depends on: inveniosoftware/invenio-app-rdm#2918

Note

I created a test version encapsulated in a cached class. Let me know if you prefer this over simple functions, and I’ll update accordingly see link

Findings

  • For the database URI, ensure that SQLALCHEMY_DATABASE_URI="" is set to an empty string to allow the granular variables to take effect.

  • For the broker, I opted for the naming convention INVENIO_RABBITMQ_* instead of INVENIO_BROKER_*, as the latter conflicts with RabbitMQ's default naming variables. For more details, refer to the documentation here.

For reviewers:

I set up a testing instance to test these changes, with the .env file and docker-services modified, see: https://github.com/Samk13/invenio-dev-latest/tree/granular-env-vars-changes

  • delete the lock file, setup again, and locally install invenio-app-rdm to set these variables.

Checklist

Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:

Frontend

Reminder

By using GitHub, you have already agreed to the GitHub’s Terms of Service including that:

  1. You license your contribution under the same terms as the current repository’s license.
  2. You agree that you have the right to license your contribution under the current repository’s license.

invenio_config/utils.py Outdated Show resolved Hide resolved
@Samk13 Samk13 force-pushed the calc-connection-strings-util branch 2 times, most recently from 8f4b0e6 to 2e1e160 Compare November 27, 2024 16:40
@Samk13 Samk13 changed the title Config: Granular ENV-based Solution for Connection Strings Config: Granular env-based Solution for Connection Strings Nov 28, 2024
@Samk13 Samk13 force-pushed the calc-connection-strings-util branch 6 times, most recently from 5eeef92 to e52709c Compare November 28, 2024 13:39
Samk13 added a commit to Samk13/invenio-dev-latest that referenced this pull request Nov 29, 2024
@Samk13 Samk13 force-pushed the calc-connection-strings-util branch from e52709c to c8d1038 Compare December 2, 2024 17:52
Samk13 added a commit to Samk13/invenio-dev-latest that referenced this pull request Dec 2, 2024
@Samk13 Samk13 force-pushed the calc-connection-strings-util branch 4 times, most recently from 77ec675 to b9c6913 Compare December 3, 2024 13:03
Add logic to build connection urls from env vars if available
needed for helm charts security best practices. includes:
* Build db uri
* Build redis url
* Build mq url

Partially closes: inveniosoftware/helm-invenio#112
@Samk13 Samk13 force-pushed the calc-connection-strings-util branch from b9c6913 to 8859a27 Compare December 3, 2024 14:16
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.

Granular env-based solution for "connection string"-like config
2 participants