Zuluru / Zuluru3

Open source web-based sports league management application
Other
38 stars 20 forks source link

Install failure on Mac M1 #49

Open mmerry opened 5 months ago

mmerry commented 5 months ago

A fresh git pull from today for a first time install results in the installation plugin not loading (and not present in the plugins directory).

With the current version of composer.json, running composer update fails with:

composer update
Loading composer repositories with package information
Updating dependencies                                 
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires muffin/footprint dev-master -> satisfiable by muffin/footprint[dev-master].
    - muffin/footprint dev-master requires cakephp/cakephp ^5.0 -> found cakephp/cakephp[5.0.0-beta1, ..., 5.x-dev] but it conflicts with your root composer.json require (3.10.*).
  Problem 2
    - Root composer.json requires cakephp-app-installer/installer dev-master#de2ce42 -> satisfiable by cakephp-app-installer/installer[dev-master].
    - cakephp-app-installer/installer dev-master requires cakephp/cakephp ^4.3.0 -> found cakephp/cakephp[4.3.0-RC1, ..., 4.x-dev] but it conflicts with your root composer.json require (3.10.*).

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

I updated composer.json to what I think are approximate correct verisons of the package given the hard requirement on cakepho 3.10.*. The updates I made to composer.json were:

...
"muffin/footprint": "^1.2",
...
"cakephp-app-installer/installer": "^3.0",
...

And after that I successfully ran composer install. Navigating to http://localhost/installer/install with debug=true in app.php results in an error:

Error: The application is trying to load a file from the Installer plugin. 

Make sure your plugin Installer is in the /Users/username/Zuluru3/plugins/ directory and was loaded.
<?php
// src/Application.php
public function bootstrap()
{
    parent::bootstrap();

    $this->addPlugin('Installer');
}

I'm not well versed in cake, so I'm not sure if Installer is indeed a plugin and if it is, why it's not present.

Also, would be good to mention in the readme that mod_rewrite should be enabled :) I had to dig through the Zuluru v1 GitHub project to figure that one out.

Zuluru commented 5 months ago

You shouldn't ever need to do a composer update, just composer install; update is for developers working on the project, not end users. Perhaps that's the root of all the problems? I'm in the midst of an upgrade which will do those updates, but when that's done the operations on your side would be git pull and composer install.

The installer plugin should be found in vendor/cakephp-app-installer/installer, but again maybe you have an incompatible version of that now.

I'll be sure to update the installation instructions with required PHP and Apache modules when I release this update.

mmerry commented 5 months ago

Thanks for the info! a clean git clone then composer install still yields the same error as above. I can confirm that I do have vendor/cakephp-app-installer/installer present after the composer install and I have dev-master de2ce42 installed.

If I run composer clear-cache and then rm -rf vendor and then composer install I get a different error:

Warning: require(/Users/matthewmerry/Zuluru3/vendor/composer/../zuluru/compatibility/stats.php): failed to open stream: No such file or directory in /Users/matthewmerry/Zuluru3/vendor/composer/autoload_real.php on line 41

Fatal error: require(): Failed opening required '/Users/matthewmerry/Zuluru3/vendor/composer/../zuluru/compatibility/stats.php' (include_path='.:/opt/homebrew/Cellar/php@7.4/7.4.33_6/share/php@7.4/pear') in /Users/matthewmerry/Zuluru3/vendor/composer/autoload_real.php on line 41
Zuluru commented 5 months ago

Just to let you know where I'm at with this... I'm most of the way through a fairly significant upgrade, which will include changes to the installer plugin. Aiming to have that done and released by early May.

The "failed to open" issue is because there is something from the Zuluru repository in the vendor folder, which got lost when you rm -rf-ed it. That's bad form, and will also be resolved in the coming update. To resolve for now, wipe the whole Zuluru folder out and start from a fresh download of that repo.

mmerry commented 5 months ago

Awesome. Let me know if you want a hand testing , I am happy to help.

Thanks Matt


From: Zuluru @.> Sent: Monday, April 22, 2024 8:52:30 AM To: Zuluru/Zuluru3 @.> Cc: mmerry @.>; Author @.> Subject: Re: [Zuluru/Zuluru3] Install failure on Mac M1 (Issue #49)

Just to let you know where I'm at with this... I'm most of the way through a fairly significant upgrade, which will include changes to the installer plugin. Aiming to have that done and released by early May.

The "failed to open" issue is because there is something from the Zuluru repository in the vendor folder. That's bad form, and will also be resolved in the coming update. To resolve for now, wipe the whole Zuluru folder out and start from a fresh download of that repo.

— Reply to this email directly, view it on GitHubhttps://github.com/Zuluru/Zuluru3/issues/49#issuecomment-2069987449, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABJRTN74CX4UTL3A3FBYHITY6UW35AVCNFSM6AAAAABGIT4I4GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRZHE4DONBUHE. You are receiving this because you authored the thread.Message ID: @.***>

Zuluru commented 4 months ago

Hi Matt, can you give the feature/cakephp4 branch a try? All the updates are done, and it worked for me today. And it supports MySQL 8 now too. :-)

Probably best to entirely wipe out the folder you have for this, pull from scratch, and run composer install per the normal install directions. Let me know how it goes.

Zuluru commented 4 months ago

Oh, one thing I'm still trying to sort out. After cloning the repository and running composer install, please do cd webroot; ln -s ../vendor/friendsofcake/bootstrap-ui/webroot bootstrap_u_i. Hope to get a better long term solution for this in place shortly.

mmerry commented 4 months ago

Exciting :) I took a peak at this last weekend, but it was not ready yet.

I used git clone -b feature/cakephp4 https://github.com/Zuluru/Zuluru3.git

I'm getting an error in post-install, and can confirm that app_local.example.php is not present in the config directory. Do you mean app_local.default.php?

> post-install-cmd: App\Console\Installer::postInstall
Script App\Console\Installer::postInstall handling the post-install-cmd event terminated with an exception

In Installer.php line 85:

  [ErrorException]                                                                                                  
  copy(/Users/matthewmerry/Zuluru3/config/app_local.example.php): failed to open stream: No such file or directory  

Exception trace:
  at /Users/matthewmerry/Zuluru3/src/Console/Installer.php:85
 Composer\Util\ErrorHandler::handle() at n/a:n/a
 copy() at /Users/matthewmerry/Zuluru3/src/Console/Installer.php:85
 App\Console\Installer::createAppLocalConfig() at /Users/matthewmerry/Zuluru3/src/Console/Installer.php:62
 App\Console\Installer::postInstall() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:479
 Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:266
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:131
 Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///usr/local/bin/composer/src/Composer/Installer.php:410
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/InstallCommand.php:147
 Composer\Command\InstallCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:394
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:148
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:93
 require() at /usr/local/bin/composer:29

Copying app_local.default.php to app_local.example.php lets me continue the install. The next issue is the config directory is not writable on the install check at http://localhost/installer/install

I added $changePerms($dir . '/config'); to line 173 in Installer.php and this gets me through to setting up the database.

I'll finish this when I get back from coaching little league and update this response.

Zuluru commented 4 months ago

Yes, I only just finished up the installer updates yesterday. Odd that it worked for me without that fix. There were a couple of files that got renamed, I've updated this bit of code to match it. Please give it another try now.

mmerry commented 4 months ago

A fresh git pull in a new directory this morning seems to be broken:

Fatal error: Uncaught Error: Interface 'Authentication\AuthenticationServiceProviderInterface' not found in /Users/matthewmerry/Zuluru3/src/Application.php:63 Stack trace: #0 /Users/matthewmerry/Zuluru3/vendor/composer/ClassLoader.php(576): include() #1 /Users/matthewmerry/Zuluru3/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}('/Users/matthewm...') #2 [internal function]: Composer\Autoload\ClassLoader->loadClass('App\\Application') #3 /Users/matthewmerry/Zuluru3/webroot/index.php(34): spl_autoload_call('App\\Application') #4 {main} thrown in /Users/matthewmerry/Zuluru3/src/Application.php on line 63

Zuluru commented 4 months ago

You did composer install after the pull? It would seem so, or else I'd think that vendor/composer wouldn't exist at all. But then the authentication plugin should exist too. Does the vendor/cakephp/authentication folder exist?

mmerry commented 4 months ago

Yes, I ran composer install. No, vendor/cakephp/authenticationfolder does not exist. I have in the vendor/cakephpfolder:

(base) matthewmerry@Matthews-MacBook-Air Zuluru3 % ls vendor/cakephp/    
cakephp         chronos         plugin-installer

And, rolling back to yesterday, app_local.php is not writeable on connecting to the database. chmod 666 on that file gets me past that. Once I try to create the schema, I get the following error:

Database Import Failed: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect date value: '0000-00-00' for column 'birthdate' at row 1

Zuluru commented 4 months ago

How bizarre! I did a fresh checkout, composer install, and a bunch of the things that are supposed to be in vendor are instead in a Plugin folder that I've never seen before, and have no idea where it came from. But when I run composer install on my existing setup, it does not create that, and does not try to do anything like this. Going to take some Googling to see what's going on here.

Zuluru commented 4 months ago

A short-term workaround seems to be to simply delete the entire Plugin folder (note, not the plugins folder, that should remain as it is), then re-run composer install. That put things back in the right place for me. Maybe there's some order of operations that I need to enforce in the composer file in order for this to work correctly out of the box.

mmerry commented 4 months ago

Sounds good. The timestamp that is working for me up to the data-time mismatch is this in case it helps track it down:

(base) matthewmerry@Matthews-MacBook-Air Zuluru3 % git show -1 --stat
commit 63c19d3dba84686f8310969efeecc72b1c0918b9 (HEAD -> feature/cakephp4, origin/feature/cakephp4)
Author: gregs <git@zuluru.org>
Date:   Sat Jun 1 02:02:37 2024 -0400

    Person approval service

 composer.json                                      |   6 +--
 composer.lock                                      |  23 ++++--------
 src/Controller/PeopleController.php                | 192 ++++++++++++++++--------------------------------------------------------------------------------
 src/Exception/ApproveException.php                 |  10 +++++
 src/Exception/EmailException.php                   |  10 +++++
 src/Service/People/ApproveService.php              | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 templates/People/approve.php                       |   2 +-
 tests/Factory/PersonFactory.php                    |  33 ++++++++++++++---
 tests/Scenario/DiverseUsersScenario.php            |  18 ++++-----
 tests/TestCase/Controller/AppControllerTest.php    |   4 +-
 tests/TestCase/Controller/PeopleControllerTest.php |  78 +++++++++++++++++++++++++++++++++++++--
 tests/TestCase/Controller/TeamsControllerTest.php  |   1 +
 tests/TestCase/Model/Entity/PersonTest.php         |  35 ++++++++++++++++--
 13 files changed, 373 insertions(+), 203 deletions(-)
mmerry commented 4 months ago

The only diffs that I can find between the two working/non-working are these:

(base) matthewmerry@Matthews-MacBook-Air ~ % diff /Users/matthewmerry/Zuluru3/vendor/composer/autoload_static.php /Users/matthewmerry/newZuluru/Zuluru3/vendor/composer/autoload_static.php
347,348c347,348
<             0 => __DIR__ . '/..' . '/psr/http-factory/src',
<             1 => __DIR__ . '/..' . '/psr/http-message/src',
---
>             0 => __DIR__ . '/..' . '/psr/http-message/src',
>             1 => __DIR__ . '/..' . '/psr/http-factory/src',
(base) matthewmerry@Matthews-MacBook-Air ~ % diff /Users/matthewmerry/Zuluru3/vendor/composer/autoload_psr4.php /Users/matthewmerry/newZuluru/Zuluru3/vendor/composer/autoload_psr4.php
42c42
<     'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'),
---
>     'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src', $vendorDir . '/psr/http-factory/src'),
(base) matthewmerry@Matthews-MacBook-Air ~ % diff /Users/matthewmerry/Zuluru3/vendor/composer/installed.php /Users/matthewmerry/newZuluru/Zuluru3/vendor/composer/installed.php
6c6
<         'reference' => '63c19d3dba84686f8310969efeecc72b1c0918b9',
---
>         'reference' => 'f238c88c37d13665235bb6ca5820aaac0ad4eb21',
1273c1273
<             'reference' => '63c19d3dba84686f8310969efeecc72b1c0918b9',
---
>             'reference' => 'f238c88c37d13665235bb6ca5820aaac0ad4eb21',
Zuluru commented 4 months ago

Just pushed up a little update that resolves the Plugin vs vendor issue, at least for me. Give it a try.

As for the incorrect date thing, that's also very weird. 0000-00-00 used to be the default value for some date fields, for obsolete reasons, and MySQL 8 doesn't support that without changing some default settings, so I've updated everything to not use those values any more. The only remaining reference to them is in the migration script that changes from that to null. The error message seems to indicate that it's having this issue when importing some data, but there's no data imported that looks like that any more. The most obvious one would be the birthdate in the record for "person 1", but the seed for that doesn't specify a birthdate at all, and the default value should be set to null, so I really don't know where it's coming from.

You're definitely running the feature/cakephp4 branch, right? Didn't clone the repo from scratch and forget to switch branches?

mmerry commented 4 months ago

Ok, so the latest does resolve the Plugin vs vendor issue, and gets through the install process up to setting up the database schema, with the following changes:

  1. Adding $changePerms($dir . '/config'); to ./src/Console/Installer.php
  2. Running chmod 666 ./config/app_local.php

But, this still fails on the same date problem above: Database Import Failed: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect date value: '0000-00-00' for column 'birthdate' at row 1

mmerry commented 4 months ago

A few more import challenges once the date-times are fixed up in 20240329190537_AllowNullDates.php.

Database Import Failed: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'short_name' at row 1

And once you have hit this, you can't re-create the schema as it tries to create new _translation tables in 20240417223514_ConvertTranslationsToShadowStrategy.php and this fails as the tables already exist. The exception perhaps needs to be caught?

I can't figure out where the bad short_name is coming from. I don't know how to debug this :) If you have pointers for me to read on how to debug, I'll do so to figure out where it's failing.