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
Fix Installer Exception Handling - TPROD-194 #9934
Fix Installer Exception Handling - TPROD-194 #9934
Conversation
Codecov Report
@@ Coverage Diff @@
## features #9934 +/- ##
==============================================
+ Coverage 41.88% 41.91% +0.02%
+ Complexity 34518 34495 -23
==============================================
Files 2056 2059 +3
Lines 111361 111390 +29
==============================================
+ Hits 46644 46685 +41
+ Misses 64717 64705 -12
|
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.
I'm still getting the same error when I try installing using a database table prefix with this PR.
An error occurred while attempting to add default data: Table mautic_leads does not exist!
@@ -308,19 +308,20 @@ public function createDatabaseStep($step, $dbParams) | |||
{ | |||
$translator = $this->translator; | |||
|
|||
$messages = $this->validateDatabaseParams($dbParams); | |||
$status = $this->validateDatabaseParams($dbParams); |
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.
validateDatabaseParams() is returning an array of validation errors as well which would be ignored with this change.
Hmmm, this is odd. It seems to work when I don't have xdebug on but does not when I have it off. Maybe a timing issue where the slightest delay in processing allows it to work in my Docker environment. Still doing some digging. |
Ok, it's something to do with Symfony's cache and Doctrine's EntityManager (the reason xdebug affected it above is that I have two containers, one with xdebug and one without, so each had their own compiled cache and thus not related directly to the issue). Deleting app/config/local.php and nuking Symfony's cache will replicate the issue and I've been able to track it down to
|
Doctrine is caching the table names in /prod/doctrine/orm/default_metadata.php and the file is only created when the cache is warmed up (DoctrineMetadataCacheWarmer) so we can't just delete the one file or lose it's benefits. I'd advocate that we remove support for naming a prefix through the UI installer but Mautic and the |
@alanhartless How can I support pushing this PR forward? |
@mabumusa1 we had a discussion on this topic in Slack: https://mautic.slack.com/archives/C01KB7GQFCL/p1619382546118000 |
@mabumusa1 would you like help implementing as discussed in the slack channel? |
e9196ca
to
df8000e
Compare
@mabumusa1 @luguenth we seem to have a big load of tests failing on this PR now - can you please take a look? |
OK I was able to reproduce the issue locally where tests fail if Mautic is not installed. It tries to redirect to I'll have a closer look tomorrow by adding tmate to the CI pipeline, so I can log into the database and see in which database Mautic was actually installed |
Created #10350 as a successor to this PR - it's up to date with the latest changes from the |
…rs (mautic#10303) * button lable in all Translation language folders * de folder change translation for button * Update plugins/GrapesJsBuilderBundle/Translations/cs/javascript.ini Correct translation for form button label Co-authored-by: John Linhart <jan@linhart.email> Co-authored-by: John Linhart <jan@linhart.email>
* docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
* docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
48ba6d4
to
fbb6647
Compare
…db_config_TPROD-194
There were some cases (e.g. when the user doesn't provide a table prefix when installing Mautic) where the installer would throw a warning and simply stop. This commit provides some default parameters for the database, enables PHP strict types and improves some parts of the logic.
For info - the tests in this PR were failing because of Reopened this PR in favor of #10350 |
This PR can now be tested again. Please make sure to test this in the following 4 scenarios:
To clean things up after testing each scenario, you can run For CLI installation, simply run the DDEV command below:
For CLI installation without a prefix, simply leave out
|
I just tested the new fixes, it works as expected. Thanks @dennisameling |
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.
All four scenarios are now working flawlessly, a huuuuge thank you to everybody who has worked on getting this PR over the line!
Let's go! 🚀
$definition->addOption( | ||
new InputOption( | ||
'--env', | ||
'-e', | ||
InputOption::VALUE_REQUIRED, | ||
'The Environment name.', | ||
$container->getParameter('kernel.environment') | ||
) | ||
); |
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.
@mabumusa1 what was the reason the add the options here and not in the InstallCommand
itself?
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.
@escopecz I think we needed this to be injected before the cache warmup, otherwise, it will not be collected if inserted in the InstallCommand
. I am not 100% sure. but I think this is the reason
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.
Ok. That's one of the reasons why we need to cover the code with tests. A test would show us the need for it.
As the InstallCommand must have dependencies for Symfony 5 I had to simplify the code. I tested it by clearing the cache and then running the install command with a table prefix param and it is present in the compiler pass. See 3cabc82
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.
I totally agree, this PR was not fully covered. Once I am done with the email PR I will work on increasing the coverage for this command
Description:
In 4.0alpha, going through the first step of the installer to configure and install the schema fails if using a db table prefix. It works fine without one but one throws an exception like
An error occurred while attempting to add default data: Table db_leads does not exist!
To reproduce:
Update
@alanhartless wrote some patches that fix the issues on the UI.
The bug exists on the CLI part of the installer, To reproduce the issue
local.php
does not exist.php bin/console mautic:install --db_port 3306 --db_host db --db_name db --db_user db --db_password db --db_table_prefix ma_ https://mautic.ddev.site/ --env=dev
Run this script to reproduce the issue and for quick testing
Steps to test this PR: