Skip to content
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

Resolves #119: Upgrade CakePHP to 3.9.3 #115

Merged
merged 1 commit into from
Oct 30, 2020
Merged

Resolves #119: Upgrade CakePHP to 3.9.3 #115

merged 1 commit into from
Oct 30, 2020

Conversation

cuppett
Copy link
Contributor

@cuppett cuppett commented Jul 6, 2020

Have refreshed the source tree to catch up to CakePHP 3.9. Various comment and structural changes in the base PHP files in addition to the composer updates.

While CakePHP 4.x is now available, it requires PHP 7.2. I'm not clear if that's a safe update for the master branch given the OCP 3.11 catalog still refers to this branch. CakePHP 3.9 is still PHP 5.6+ and is a safe upgrade.

@cuppett
Copy link
Contributor Author

cuppett commented Aug 16, 2020

@hhorak Can you take a look here?

@pkubatrh pkubatrh self-assigned this Aug 19, 2020
@pkubatrh
Copy link
Member

@cuppett Taking a look at this, it makes more sense to me to move the part that introduces .git directory removal during assemble step into the actual image since the issue is not specific to the example application. Would you mind opening a new PR against the php image (over at https://github.com/sclorg/s2i-php-container) for all currently supported versions?

@cuppett
Copy link
Contributor Author

cuppett commented Aug 21, 2020

Agreed. I'll do that there and prune this one down to just the bump

@cuppett cuppett changed the title Resolve BZ1853593, Upgrade CakePHP to 3.9 Upgrade CakePHP to 3.9.1 Aug 21, 2020
@cuppett
Copy link
Contributor Author

cuppett commented Aug 21, 2020

Done. Thanks!

@cuppett cuppett changed the title Upgrade CakePHP to 3.9.1 Upgrade CakePHP to 3.9.2 Sep 27, 2020
@cuppett
Copy link
Contributor Author

cuppett commented Sep 27, 2020

@pkubatrh I've rebased and picked up the next bump. Can we merge this in soon?

@yselkowitz
Copy link
Contributor

OCP 3.11 might still ship with PHP 5.y imagestreams but they are no longer supported regardless; even 7.2 is about to go out of support (link). Not sure about OCP's thoughts about this (cc @gabemontero).

@gabemontero
Copy link
Contributor

OCP 3.11 might still ship with PHP 5.y imagestreams but they are no longer supported regardless; even 7.2 is about to go out of support (link). Not sure about OCP's thoughts about this (cc @gabemontero).

short term, as I'm assuming you saw on the email thread @yselkowitz , cakephp is broke on OCP ... this PR in part is stemming from investigations @cuppett is doing to try to get it functional .... immediately, I'm good with whatever gets things functional

longer term, I would assume removal of 7.2 or any other EOL images would be part of any of the typically per OCP release EOL efforts that SCL sorts out with @siamaksade

@cuppett cuppett changed the title Upgrade CakePHP to 3.9.2 Upgrade CakePHP to 3.9.3 Oct 27, 2020
@@ -50,7 +49,7 @@
"config": {
"sort-packages": true,
"platform": {
"php": "7.0.10"
"php": "7.2"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the important bit to fix the composer resolution/download issue leading to the new failure.

@cuppett cuppett changed the title Upgrade CakePHP to 3.9.3 Resolves #119: Upgrade CakePHP to 3.9.3 Oct 28, 2020
@cuppett
Copy link
Contributor Author

cuppett commented Oct 28, 2020

Are the newer SCL PHP runtimes available on OCP 3.11 and should the catalog templates saved there be bumped as well? It breaks OCP 3.11 with its original default runtime of PHP 5.6 through 7.1 now. I don't think we can ever get the previous combination of bits back again.

The ultimate culprit was this:

...
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
...
There was 1 error:
1) App\Test\TestCase\ApplicationTest::testBootstrap
Cake\Core\Exception\MissingPluginException: Plugin Migrations could not be found.
...
ERRORS!
Tests: 8, Assertions: 10, Errors: 1, Failures: 5.

Explicitly included vendor libraries was removed with 157b4a8. Should I add a commit to include the vendored libraries going forward?

@bparees
Copy link
Contributor

bparees commented Oct 28, 2020

Are the newer SCL PHP runtimes available on OCP 3.11 and should the catalog templates saved there be bumped as well?

we don't explicitly install them, no. An admin can of course always install the newer imagestreams+templates, there's no reason they shouldn't work.

@hhorak
Copy link
Member

hhorak commented Oct 29, 2020

I've tested that with OCP4.4 and the updated app works fine when running with oc new-app <git>... but when I try to use the templates, it does not seem to work for me:

oc create -f  php-centos.json 
oc process -f cakephp.json -p NAMESPACE=$(oc project -q) -p SOURCE_REPOSITORY_URL=https://github.com/cuppett/cakephp-ex.git | oc create -f -

results in:

$ oc logs pod/cakephp-example-1-deploy
--> Scaling cakephp-example-1 to 1
error: update acceptor rejected cakephp-example-1: pods for rc 'testhhorak6/cakephp-example-1' took longer than 600 seconds to become available

It might be easily something with my cluster.. Anyway, did you test the attached templates? Do they work for you?

@gabemontero
Copy link
Contributor

hey @hhorak

oc new-app "cakephp-mysql-example" -p "OPCACHE_REVALIDATE_FREQ=0" -p "SOURCE_REPOSITORY_URL=https://github.com/cuppett/cakephp-ex" worked for me

technically speaking, these are the only 2 cakephp templates we ship with OCP:

cakephp-mysql-example An example CakePHP application with a MySQL database. For more information ab... 20 (4 blank) 8
cakephp-mysql-persistent An example CakePHP application with a MySQL database. For more information ab... 21 (4 blank) 9

I've attached the build log.

cakephp-bld.log

@hhorak
Copy link
Member

hhorak commented Oct 29, 2020

I've attached the build log.

The build works for me too, but the app does not start after that. It either stops in the pod/cakephp-mysql-persistent-1-deploy pod or pod/cakephp-mysql-persistent-1-hook-pre crashes with this traceback (7.3-ubi7 image`):

Caused by: [PDOException] SQLSTATE[HY000] [2002] Connection refused in /opt/app-root/src/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php on line 79
Stack Trace:
#0 /opt/app-root/src/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php(79): PDO->__construct('mysql:host=172....', 'cakephp', 'xrTPkSWdQvLKw2y...', Array)
#1 /opt/app-root/src/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/MysqlAdapter.php(116): Phinx\Db\Adapter\PdoAdapter->createPdoConnection('mysql:host=172....', 'cakephp', 'xrTPkSWdQvLKw2y...', Array)
#2 /opt/app-root/src/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php(148): Phinx\Db\Adapter\MysqlAdapter->connect()
#3 /opt/app-root/src/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/AdapterWrapper.php(496): Phinx\Db\Adapter\PdoAdapter->getConnection()
#4 /opt/app-root/src/vendor/cakephp/migrations/src/CakeAdapter.php(56): Phinx\Db\Adapter\AdapterWrapper->getConnection()
#5 /opt/app-root/src/vendor/cakephp/migrations/src/Command/CommandTrait.php(78): Migrations\CakeAdapter->__construct(Object(Phinx\Db\Adapter\TimedOutputAdapter), Object(Cake\Database\Connection))
#6 /opt/app-root/src/vendor/robmorgan/phinx/src/Phinx/Console/Command/Migrate.php(63): Migrations\Command\Migrate->bootstrap(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /opt/app-root/src/vendor/cakephp/migrations/src/Command/CommandTrait.php(35): Phinx\Console\Command\Migrate->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /opt/app-root/src/vendor/cakephp/migrations/src/Command/Migrate.php(66): Migrations\Command\Migrate->parentExecute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /opt/app-root/src/vendor/symfony/console/Command/Command.php(255): Migrations\Command\Migrate->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /opt/app-root/src/vendor/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /opt/app-root/src/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Migrations\Command\Migrate), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /opt/app-root/src/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /opt/app-root/src/vendor/cakephp/migrations/src/Shell/MigrationsShell.php(108): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /opt/app-root/src/vendor/cakephp/cakephp/src/Console/Shell.php(531): Migrations\Shell\MigrationsShell->main('migrations', 'migrate')
#15 /opt/app-root/src/vendor/cakephp/migrations/src/Shell/MigrationsShell.php(169): Cake\Console\Shell->runCommand(Array, true, Array)
#16 /opt/app-root/src/vendor/cakephp/cakephp/src/Console/CommandRunner.php(384): Migrations\Shell\MigrationsShell->runCommand(Array, true)
#17 /opt/app-root/src/vendor/cakephp/cakephp/src/Console/CommandRunner.php(162): Cake\Console\CommandRunner->runShell(Object(Migrations\Shell\MigrationsShell), Array)
#18 /opt/app-root/src/bin/cake.php(12): Cake\Console\CommandRunner->run(Array)
#19 {main}

@remicollet can you help here, please?

@gabemontero
Copy link
Contributor

Interesting.

the pods are clean with my attempt ... I'll attach the pod listing and pod log

cakephp-podlist-podlogs.txt

@cuppett
Copy link
Contributor Author

cuppett commented Oct 29, 2020

I've attached the build log.

The build works for me too, but the app does not start after that. It either stops in the pod/cakephp-mysql-persistent-1-deploy pod or pod/cakephp-mysql-persistent-1-hook-pre crashes with this traceback (7.3-ubi7 image`):

Caused by: [PDOException] SQLSTATE[HY000] [2002] Connection refused in /opt/app-root/src/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php on line 79
Stack Trace:
#0 /opt/app-root/src/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php(79): PDO->__construct('mysql:host=172....', 'cakephp', 'xrTPkSWdQvLKw2y...', Array)
#1 /opt/app-root/src/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/MysqlAdapter.php(116): Phinx\Db\Adapter\PdoAdapter->createPdoConnection('mysql:host=172....', 'cakephp', 'xrTPkSWdQvLKw2y...', Array)
#2 /opt/app-root/src/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php(148): Phinx\Db\Adapter\MysqlAdapter->connect()
#3 /opt/app-root/src/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/AdapterWrapper.php(496): Phinx\Db\Adapter\PdoAdapter->getConnection()
#4 /opt/app-root/src/vendor/cakephp/migrations/src/CakeAdapter.php(56): Phinx\Db\Adapter\AdapterWrapper->getConnection()
#5 /opt/app-root/src/vendor/cakephp/migrations/src/Command/CommandTrait.php(78): Migrations\CakeAdapter->__construct(Object(Phinx\Db\Adapter\TimedOutputAdapter), Object(Cake\Database\Connection))
#6 /opt/app-root/src/vendor/robmorgan/phinx/src/Phinx/Console/Command/Migrate.php(63): Migrations\Command\Migrate->bootstrap(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /opt/app-root/src/vendor/cakephp/migrations/src/Command/CommandTrait.php(35): Phinx\Console\Command\Migrate->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /opt/app-root/src/vendor/cakephp/migrations/src/Command/Migrate.php(66): Migrations\Command\Migrate->parentExecute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /opt/app-root/src/vendor/symfony/console/Command/Command.php(255): Migrations\Command\Migrate->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /opt/app-root/src/vendor/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /opt/app-root/src/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Migrations\Command\Migrate), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /opt/app-root/src/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /opt/app-root/src/vendor/cakephp/migrations/src/Shell/MigrationsShell.php(108): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /opt/app-root/src/vendor/cakephp/cakephp/src/Console/Shell.php(531): Migrations\Shell\MigrationsShell->main('migrations', 'migrate')
#15 /opt/app-root/src/vendor/cakephp/migrations/src/Shell/MigrationsShell.php(169): Cake\Console\Shell->runCommand(Array, true, Array)
#16 /opt/app-root/src/vendor/cakephp/cakephp/src/Console/CommandRunner.php(384): Migrations\Shell\MigrationsShell->runCommand(Array, true)
#17 /opt/app-root/src/vendor/cakephp/cakephp/src/Console/CommandRunner.php(162): Cake\Console\CommandRunner->runShell(Object(Migrations\Shell\MigrationsShell), Array)
#18 /opt/app-root/src/bin/cake.php(12): Cake\Console\CommandRunner->run(Array)
#19 {main}

@remicollet can you help here, please?

For connection refused... you need to check the MySQL pod came up okay. I noticed on OCP4 or somewhere that the mysql:8.0-el (or something similar) tag isn't a thing in the openshift namespace, but mysql:8 is.

@cuppett
Copy link
Contributor Author

cuppett commented Oct 29, 2020

This is the report on that: #94

@gabemontero
Copy link
Contributor

imagestreamtags are going to vary release to release for OCP

in the case of the cakephp templates, the mysql imagestreamtag appears to be hardcoded: https://github.com/openshift/cluster-samples-operator/blob/master/assets/operator/ocp-x86_64/cakephp/templates/cakephp-mysql-example.json#L422

that should probably be a template parameters to allow for using the latest version of a template on older OCP's like 4.4

@bparees
Copy link
Contributor

bparees commented Oct 30, 2020

in the case of the cakephp templates, the mysql imagestreamtag appears to be hardcoded: https://github.com/openshift/cluster-samples-operator/blob/master/assets/operator/ocp-x86_64/cakephp/templates/cakephp-mysql-example.json#L422
that should probably be a template parameters to allow for using the latest version of a template on older OCP's like 4.4

agree, but in the meantime the template we shipped w/ a given OCP release should work w/ (reference) the imagestreamtags we shipped w/ that release. Assuming that is the case here, i'd expect we're good to go.

@gabemontero
Copy link
Contributor

in the case of the cakephp templates, the mysql imagestreamtag appears to be hardcoded: https://github.com/openshift/cluster-samples-operator/blob/master/assets/operator/ocp-x86_64/cakephp/templates/cakephp-mysql-example.json#L422
that should probably be a template parameters to allow for using the latest version of a template on older OCP's like 4.4

agree, but in the meantime the template we shipped w/ a given OCP release should work w/ (reference) the imagestreamtags we shipped w/ that release. Assuming that is the case here, i'd expect we're good to go.

I'll boot up a 4.4 cluster today and see if

oc new-app "cakephp-mysql-example" -p "OPCACHE_REVALIDATE_FREQ=0" -p "SOURCE_REPOSITORY_URL=https://github.com/cuppett/cakephp-ex"

works with

https://github.com/openshift/cluster-samples-operator/blob/release-4.4/tmp/build/assets/operator/ocp-x86_64/cakephp/templates/cakephp-mysql-example.json#L421

or if I get errors similar to @hhorak

@gabemontero
Copy link
Contributor

ok it worked for me in 4.4

oc new-app "cakephp-mysql-example" -p "OPCACHE_REVALIDATE_FREQ=0" -p "SOURCE_REPOSITORY_URL=https://github.com/cuppett/cakephp-ex"

resulted in this list of pods:

gmontero ~ $ oc get pods 
NAME                               READY   STATUS      RESTARTS   AGE
cakephp-mysql-example-1-build      0/1     Completed   0          3m11s
cakephp-mysql-example-1-deploy     0/1     Completed   0          90s
cakephp-mysql-example-1-hook-pre   0/1     Completed   0          87s
cakephp-mysql-example-1-zwxwm      1/1     Running     0          63s
mysql-1-deploy                     0/1     Completed   0          3m10s
mysql-1-lmcr8                      1/1     Running     0          3m4s
gmontero ~ $

And the cakephp-mysql-example-1-zwxwm pod logs look clean

@hhorak
Copy link
Member

hhorak commented Oct 30, 2020

Awesome, I totally forget about mysql streams, it works for me now as well:

oc create -f  php-centos.json 
oc create -f  mysql-centos.json
oc process -f cakephp-ex/openshift/templates/cakephp-mysql.json -p NAMESPACE=$(oc project -q) -p SOURCE_REPOSITORY_URL=https://github.com/cuppett/cakephp-ex.git | oc create -f -

So let's merge.

@hhorak hhorak merged commit fddfeb3 into sclorg:master Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants