You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running applications that we don't provide an image for, when crafting the images to run in Lagoon, we often have to create a new entrypoint file that sets up some environment variables so that the application is aware of them.
Typically this looks like an entrypoint script like my-app-entrypoint.sh
#!/bin/shexport MYSPECIALVARIABLE=$(do stuff to craft my special variable)
Then copying it into the entrypoints in the dockerfile like so
Then when the container starts, as long as the entrypoint runs all entrypoints, the variable will be available to my running app.
This is all great, but sometimes I need these variables when I ssh into a service in Lagoon. Currently the .bashrc file only sources 3 entrypoints when it runs, this means the only way to consume them is to source them first. This can be problematic if you forget to do so, or don't know you have to do it.
What could be nice is an established entrypoint name, and if it is present, sourced in .bashrc.
if [ -r "/lagoon/entrypoints/900-application-env.sh" ]; then
# this is a way for users that exec in to consume custom application variables that are required to operate the application with a shell
# since this is in an entrypoint, it will also be read when the container starts up so it is available to both runtime and shell
source /lagoon/entrypoints/900-application-env.sh
fi
A current workaround is to just extend and then replace the existing /lagoon/entrypoints/55-generate-env.sh script with a custom one. Though I think having a dedicated one for this would be much nicer, and could be documented as the way to provide custom application variables.
There is also a somewhat relevant Lagoon issue when we start to consider pre and post rollout tasks and applications that leverage this method of application entrypoint variables.
The text was updated successfully, but these errors were encountered:
shreddedbacon
changed the title
bashrc entrypoints
bashrc application variable entrypoints
Dec 8, 2024
When running applications that we don't provide an image for, when crafting the images to run in Lagoon, we often have to create a new entrypoint file that sets up some environment variables so that the application is aware of them.
Typically this looks like an entrypoint script like
my-app-entrypoint.sh
Then copying it into the entrypoints in the dockerfile like so
Then when the container starts, as long as the entrypoint runs all entrypoints, the variable will be available to my running app.
This is all great, but sometimes I need these variables when I ssh into a service in Lagoon. Currently the
.bashrc
file only sources 3 entrypoints when it runs, this means the only way to consume them is to source them first. This can be problematic if you forget to do so, or don't know you have to do it.What could be nice is an established entrypoint name, and if it is present, sourced in
.bashrc
.A current workaround is to just extend and then replace the existing
/lagoon/entrypoints/55-generate-env.sh
script with a custom one. Though I think having a dedicated one for this would be much nicer, and could be documented as the way to provide custom application variables.There is also a somewhat relevant Lagoon issue when we start to consider pre and post rollout tasks and applications that leverage this method of application entrypoint variables.
The text was updated successfully, but these errors were encountered: