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

Better management of config.inc.php variables #27

Open
5 tasks
marcbria opened this issue Mar 26, 2021 · 0 comments
Open
5 tasks

Better management of config.inc.php variables #27

marcbria opened this issue Mar 26, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@marcbria
Copy link
Collaborator

marcbria commented Mar 26, 2021

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 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant