You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following instructions to build a custom docker image, when adding any plugin which declares an sql-dir extra parameter for SQL database initialisation, it fails.
This is logical, as the database engine is not running in this build environment, in fact the actual configuration is not even loaded at this stage. And even if the script where to find the database, in docker the core database is not initialised until first execution, thus there will be no "standard" tables either, and plugins' scripts who rely on those will fail.
By removing the assumption that roundcube is set up and running when executing a composer require command, some of these issues could be avoided.
One alternative would be to have an execution switch to avoid executing database initialisation script (maybe post-installation scripts too).
Another way is to detect the condition the database is accessible with current configuration, and if it not the case append the plugin SQL initialisation scripts to the "core SQL initialisation scripts" (the scripts in roundcube/SQL/ directory); this still complies with the specification and enables the command to continue. I have been using this technique when "manually" building my docker image, and it works fine as the initialisation is handled just like the core SQL initialisation. This of course only works with clean installs, plugin updates in roundcube-docker are not considered; thus manual SQL initialisation is always necessary in these cases anyway.
UPDATE: Failed to connect to database exception is handled to end the execution, so the condition needs to be detected before the exception.
The text was updated successfully, but these errors were encountered:
Following instructions to build a custom docker image, when adding any plugin which declares an
sql-dir
extra parameter for SQL database initialisation, it fails.This is logical, as the database engine is not running in this build environment, in fact the actual configuration is not even loaded at this stage. And even if the script where to find the database, in docker the core database is not initialised until first execution, thus there will be no "standard" tables either, and plugins' scripts who rely on those will fail.
By removing the assumption that roundcube is set up and running when executing a
composer require
command, some of these issues could be avoided.One alternative would be to have an execution switch to avoid executing database initialisation script (maybe post-installation scripts too).
Another way is to detect the condition the database is accessible with current configuration, and if it not the case append the plugin SQL initialisation scripts to the "core SQL initialisation scripts" (the scripts in roundcube/SQL/ directory); this still complies with the specification and enables the command to continue. I have been using this technique when "manually" building my docker image, and it works fine as the initialisation is handled just like the core SQL initialisation. This of course only works with clean installs, plugin updates in roundcube-docker are not considered; thus manual SQL initialisation is always necessary in these cases anyway.
UPDATE:
Failed to connect to database
exception is handled to end the execution, so the condition needs to be detected before the exception.The text was updated successfully, but these errors were encountered: