Handle LocalSettings.php better #1
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
We could generate
LocalSettings.php
ourselves instead of using the web installer.Pros:
Cons:
In the mean-time, we could at least provide instructions on how to copy the generated
LocalSettings.php
into the container.I experimented with this in a new
localsettings
branch.It works OK, but we'd need to run
install.php
after with correct options to initialise the database.One "integrated" way to run initialisation stuff is to override the entrypoint with your own script, do your custom stuff and then call the original entrypoint script. See
9db9eca2cb/sbin/entrypoint.sh
for this approach with the Alerta app. It doesn't always work because $docker. Another approach is to override thecommand
but this often has an even less chance of success in my experience. See https://docs.docker.com/compose/compose-file/#command.Both of those look awesome, thank you for the reminder - I was sure I'd seen a way of overriding the entrypoint script from the compose file, but couldn't find examples.
Am I right in thinking the entrypoint /
command
are run every time the stack is deployed? That's making me wonder if I should be customising the image instead so it's part of the build, but I was really hopeful to be able to use 3rd-party images unchanged :/Yes. So, you need to make sure your scripting handles the case where it is run after the first time. Depends on what you need to do. Sometimes it is easy. Like, you can just
touch
a file or something in the volume (if you have one) for a simple "did I run this already" check.Yeah totally on board with not wanting to change those images, that is kind of the main promise of this approach.
See
703b18ac0f/sbin/entrypoint.sh
for a fairly hairy example of doing this overriding in the entrypoint and having checks for idempotent operation (this actually worked out quite well but is not very maintainable!).Thanks so much for all the tips!
I managed to hack my way through this (via truly heinous hack of putting the custom entrypoint in a Docker
config
) - it runs eithermysql ... < maintenance/tables.sql
orphp maintenance/update.php
depending on whether any tables exist.The only outstanding issue is that, because we don't run
install.php
, it doesn't create an initial user. I'll open a separate task for that.I'd also like to add a
MEDIAWIKI_IS_PRIVATE
(or something) setting, to toggle the$wgGroupPermissions
section.