Page MenuHomePhabricator

Rewrite LocalSettings.php on every container launch in order to reflect env var changes
Closed, ResolvedPublic

Description

Current Situation:
The WikiBase build runs Docker/build/Wikibase/entrypoint.sh on each container start or restart. However, currently a new LocalSettings.php in the container is only created from LocalSettings.php.template with the environment variables substitute if the file has not already been created (see line 24 of Docker/build/Wikibase/entrypoint.sh). This means that after the initial run of the container the environment variables won't be replaced again unless the user directly deletes the LocalSettings.php in the container and restarts it.

Presumably it is done this way to respect changes a user may make to LocalSettings.php after initially creating the container. As long as we want to continue with that behaviour, if the user wants to have environment variable values in that file reflected they will need to intervene by removing the exiting LocalSettings.php and restarting the container.

It would probably be cleaner to not support user changes to that file, and rely upon one of the other mechanisms for setting and overriding values in this base LocalSettings.php file (i.e. volume mapping in your own LocalSettings.php file as described in this comment in example/docker-compose.yml.

The underlying question here is whether we want to continue to implicitly support user changes in the LocalSettings.php in the container?

Goal:

  • Make it possible to override environment variables without needing to restart the container.

Acceptance Criteria:

[optional] Notes:

Details

Other Assignee
roti_WMDE

Event Timeline

The WikiBase build runs Docker/build/Wikibase/entrypoint.sh on each container start or restart. However, currently a new LocalSettings.php in the container is only created from LocalSettings.php.template with the environment variables substitute if the file has not already been created (see line 24 of Docker/build/Wikibase/entrypoint.sh). This means that after the initial run of the container the environment variables won't be replaced again unless the user directly deletes the LocalSettings.php in the container and restarts it.

Presumably it is done this way to respect changes a user may make to LocalSettings.php after initially creating the container. As long as we want to continue with that behaviour, if the user wants to have environment variable values in that file reflected they will need to intervene by removing the exiting LocalSettings.php and restarting the container.

I think the underlying question here is whether we want to continue to implicitly support user changes in the LocalSettings.php in the container?

It would probably be cleaner to not support user changes to that file, and rely upon one of the other mechanisms for setting and overriding values in this base LocalSettings.php file (i.e. volume mapping in your own LocalSettings.php file as described in this comment in example/docker-compose.yml.

adee_wmde changed the task status from Open to In Progress.Oct 19 2023, 2:24 PM
adee_wmde claimed this task.
darthmon_wmde updated the task description. (Show Details)
darthmon_wmde updated the task description. (Show Details)
lojo_wmde changed the task status from Open to In Progress.Apr 23 2024, 8:28 AM
lojo_wmde updated Other Assignee, added: roti_WMDE.