geerlingguy / drupal-operator

Drupal Operator for Kubernetes, built with Ansible and the Operator SDK.
32 stars 6 forks source link

Allow setting database options when `manage_database` is set to false #17

Closed geerlingguy closed 4 years ago

geerlingguy commented 4 years ago

Currently there's an option manage_database, and if it's set to false, then the database component managed by this operator are not installed.

However, there are hardcoded values (e.g. the {{ meta.name }}-drupal-config ConfigMap) which refer to things like the database/username/password of drupal, and the host {{ meta.name }}-mariadb.

These values need to be able to be overridden, not only for basic security purposes (the database password drupal is pretty weak and predictable!), but also so I can do something like swap in another database backend easily (e.g. provided by an operator ala #15, or something like AWS Aurora).

geerlingguy commented 4 years ago

Strangely, when installing either with the built in database, or with an external database, I'm getting an error:

Uncaught PHP Exception InvalidArgumentException: "No check has been registered for access_check.permission" at /var/www/html/core/lib/Drupal/Core/Access/CheckProvider.php line 97, referer: http://192.168.64.63:30854/core/install.php?rewrite=ok&langcode=en&profile=standard

Or if I try accessing another page like /user, something like:

Uncaught PHP Exception InvalidArgumentException: "No check has been registered for access_check.user.login_status" at /var/www/html/core/lib/Drupal/Core/Access/CheckProvider.php line 97

It looks like that's a problem with stale caches (don't know how that could be the case on a brand new installation via the UI... but whatever), and the fix was to access the database and clear all the cache tables:

TRUNCATE TABLE cache_bootstrap;
TRUNCATE TABLE cache_config;
TRUNCATE TABLE cache_container;
TRUNCATE TABLE cache_data;
TRUNCATE TABLE cache_default;
TRUNCATE TABLE cache_discovery;
TRUNCATE TABLE cache_entity;
geerlingguy commented 4 years ago

I believe I have this fixed in the above two commits. Going to work on at least a very basic #8 now.

geerlingguy commented 4 years ago

I ran into this again today:

[Wed Mar 18 16:40:28.442373 2020] [php7:notice] [pid 17] [client 172.17.0.7:51456] Uncaught PHP Exception InvalidArgumentException: "No check has been registered for access_check.permission" at /var/www/html/core/lib/Drupal/Core/Access/CheckProvider.php line 97

No clue why this keeps happening :/

geerlingguy commented 4 years ago

Related (but not really) issue: https://github.com/hechoendrupal/drupal-console/issues/1759

harikagujjula commented 4 years ago

I have noticed this while trying to reuse the same database name. The cache_container table has an entry when a new database is created!!

However, Just clearing the cache(drush cr) worked for me.

Thanks @geerlingguy