-
Notifications
You must be signed in to change notification settings - Fork 3
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
Copy confd templates from /var/www/drupal #7
Conversation
This allows confd templates to be defined and maintained as part drupal development in idc-isle-dc. Any confd config file or template under codebase/rootfs/etc/confd/ (more accurately, present to the drupal container as /var/www/drupal/rootfs/etc/confd/) will be copied to the corresponding place under /etc/confd before rendering templates. This allows developer control over confd templates for Drupal without having to build new buildkit images every time.
@birkland so you have determined to place |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@birkland looks OK to me! Can you confirm your approach with settings.php
then is to use confd
and not envsubst
?
@emetsger Yes, I did a few experiments that demonstrated that when the As you know, there is a utilities.sh that defines a update_settings_php function. Some of what it does involves invoking Anyway, apparently
So we can use confd safely. This exercise revealed a problem, though. We also have stuff like mysql username/password/db in |
Right, that's correct. IDC's startup does not touch settings.php. Even if it did, confd and drush management aren't at odds, as long as confd isn't processing templates periodically. The original observations/premise that led you toward using envsubst are still valid.
Yes. One of the primary reasons is that issuing drush commands slows down startup, and secondarily it makes reasoning about settings.php a lot easier. Finally, we didn't have a real reason for parameterizing it until now, so we haven't been using any approach for managing its content.
Correct, but they wouldn't be in conflict anyway, since periodic re-processing of confd templates is disabled, and confd renders templates before anything else happens.
Right, confd runs at boot, then if we choose, we can use drush, envsubst, or other approaches to manage settings.php.
There are a few options, we can pick our poison.
If we were leveraging something like Vault (or even etcd or consul) we'd have a real motivation to manage settings.php with confd. But we aren't, so I'm not sure I see the need to do so. At any rate, we need to do something, so I'd just go with whatever makes you feel good :) |
Working with this a bit, here is where I am with respect to picking poison and/or developer experience
Exposing env vars to Drupal gave me pause previously from a standpoint of security worries (everything is in $ENV, and anybody can print that), but apparently my worries were unfounded. It's much more popular to use a Anyway. I think I'm going to likely close this PR and instead issue one for exposing env vars to the php backends. |
The env vars are whitelisted, so you control what's exposed (so one can't see everything). In order to print out env vars, the attacker has to edit and execute php source somehow. So, if that is the threat model (arbitrary code execution), then what is or is not present in env vars is moot. |
Overview
This allows confd templates to be defined and maintained as part of drupal development in idc-isle-dc. Any confd config file or template under
codebase/rootfs/etc/confd/
(more accurately, present to the drupal container as/var/www/drupal/rootfs/etc/confd/
) will be copied to the corresponding place under/etc/confd
before rendering templates. This allows developer control over confd templates for Drupal without having to build new buildkit images every time.To Test
upstream-20200824-f8d1e8e-12-gd582c0a
), fo intoidc-isle-dc
development branch and use that value forTAG
in.env
. Rebuilddocker-compose.yml
(ormake reset
), and start up the environment. It should start without error (i.e. this change causes no harm if there is norootfs
directory.codebase/rootfs/etc/confd/foo.bar
. Start up the stack. Hop into the drupal container interactively and verify that your file is now under/etc/confd
.A subsequent PR to idc-isle-dc will leverage this capability to add confd templates for
settings.php
.