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
Configuration is something you usually would like to keep out of your container, but the existing solution (config.inc.php as a volume) is not a good practice, generate issues, and is not k8s compliant, so we need a better approach.
Solution
Based on ojs-variable helper script we can manage variables.
The proposal is rewrite the ojs-pre-start script to check a new environment variable called OJS_CONFIG_ENV .. if it’s not set or False, the container doesn’t touch the config.inc.php. If it’s True, it will pulls all the ENV vars with the OJSCONFIG_ prefix and uses ojs-variable to write them into config.inc.php.
As Andrew proposed, the core of this could be:
if [[ ${OJS_CONFIG_ENV:-"0"} == "1" ]] ; then
# OJS variables set in config.inc.php
echo "[OJS Pre-Start] ++ Overriding OJS Config with 'OJSCONFIG_' environment variables."
Work to be done
Change ojs-variable: to be less verbose by default and don't switch the installed bit.
Change ojs-pre-start: to include the OJS_CONFIG_ENV logic
Change sample .env file: to show sample variables enabled (and a few of them commented).
Change default config.inc.php: to be taken from pkp's template instead of packaged in our project?
Change README: to remove the existing references to config.inc.php and explain how all it works.
Potential issues
All this will only apply if you create the new OJS_CONFIG_ENV variable, so existing users won't notice any change.
On the other side, as config variables are set during container start, we don't see any risk of changing them.
The only but would be if users like to change a variable on a running container. It would be possible as follows:
$ docker exec -it ojs_app_journalname /usr/local/bin/ojs-variable session_check_ip Off
This last scenario is not necessarily risky, unless you change essential variables (as base_url or ssl...) that will cause a crash in your OJS and it would be no different than had someone lost their internet connection and had to pick the process back up.
Therefore, the final conclusion is that the solution is safe enough for production and maintains backward compatibility.
The text was updated successfully, but these errors were encountered:
The problem
Configuration is something you usually would like to keep out of your container, but the existing solution (config.inc.php as a volume) is not a good practice, generate issues, and is not k8s compliant, so we need a better approach.
Solution
Based on ojs-variable helper script we can manage variables.
The proposal is rewrite the
ojs-pre-start
script to check a new environment variable called OJS_CONFIG_ENV .. if it’s not set or False, the container doesn’t touch the config.inc.php. If it’s True, it will pulls all the ENV vars with the OJSCONFIG_ prefix and usesojs-variable
to write them into config.inc.php.As Andrew proposed, the core of this could be:
Work to be done
ojs-variable
: to be less verbose by default and don't switch the installed bit.ojs-pre-start
: to include the OJS_CONFIG_ENV logic.env file:
to show sample variables enabled (and a few of them commented).config.inc.php
: to be taken from pkp's template instead of packaged in our project?README
: to remove the existing references to config.inc.php and explain how all it works.Potential issues
All this will only apply if you create the new OJS_CONFIG_ENV variable, so existing users won't notice any change.
On the other side, as config variables are set during container start, we don't see any risk of changing them.
The only but would be if users like to change a variable on a running container. It would be possible as follows:
$ docker exec -it ojs_app_journalname /usr/local/bin/ojs-variable session_check_ip Off
This last scenario is not necessarily risky, unless you change essential variables (as base_url or ssl...) that will cause a crash in your OJS and it would be no different than had someone lost their internet connection and had to pick the process back up.
Therefore, the final conclusion is that the solution is safe enough for production and maintains backward compatibility.
The text was updated successfully, but these errors were encountered: