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

Allow variable mapping in lagoon-build #205

Open
tobybellwood opened this issue May 11, 2023 · 6 comments
Open

Allow variable mapping in lagoon-build #205

tobybellwood opened this issue May 11, 2023 · 6 comments

Comments

@tobybellwood
Copy link
Member

In order to better support non-lagoon based 12-factor apps, we should allow for the creation of variable maps in the build phase , so that the resultant variables are available on the lagoon-env configmap.

This step should occur prior to creating the deployment, but after all other (DBAAS) steps

Such an example might be for DB credentials - either as individual variables

DATABASE_HOST=${MARIADB_HOST:-mariadb}
DATABASE_PORT=${MARIADB_PORT:-3306}
DATABASE_NAME=${MARIADB_DATABASE:-lagoon}
DATABASE_USERNAME=${MARIADB_USERNAME:-lagoon}
DATABASE_PASSWORD=${MARIADB_PASSWORD:-lagoon}

or connstrings:

DATABASE_URL=postgres://${POSTGRES_USERNAME:-lagoon}:${POSTGRES_PASSWORD:-lagoon}@${POSTGRES_HOST:-postgres}:${POSTGRES_PORT:-5432}/${POSTGRES_DATABASE:-lagoon}

or configuring routes/hosts

WP_CONTENT_URL=${LAGOON_ROUTE}/content

etc etc

This is especially useful for images that have none of our entrypoints that would usually allow this conversion in .lagoon.env files

@shreddedbacon
Copy link
Member

How does this work when I requested 2 mariadbs?

@shreddedbacon
Copy link
Member

I get the idea behind this, but I'm not sure how it could be built. The user would have to inform Lagoon somehow to craft these/this new variable from provided variables.

If I requested a maria-database instead of mariadb then I'd need some way to inform the mapper to create this instead DATABASE_HOST=${MARIADB_DATABASE_HOST:-mariadb}

@tobybellwood
Copy link
Member Author

I think any mapper would have to live in code in the repo (lagoon.yml 🙊?), and be managed by the developer, so it would be on them.

@shreddedbacon
Copy link
Member

So this is currently possible using .env or .lagoon.envx files within the repository itself. Only downside is it isn't in the configmap.

Is there a specific reason it has to be in the configmap?

@tobybellwood
Copy link
Member Author

If the docker image isn't uselagoon/* we have no access to the entrypoints without hacking or rebuilding the image

@shreddedbacon
Copy link
Member

Ah yep, that makes sense. I'll have a think about this

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

2 participants