Update Oro Platform to Version 4.0

PHP error.log

[03-Dec-2019 16:08:08] WARNING: [pool www] child 15777 said into stderr: "NOTICE: PHP message: PHP Fatal error:  Uncaught RuntimeException: "
[03-Dec-2019 16:08:08] WARNING: [pool www] child 15777 said into stderr: "In ContainerBuilder.php line 1023:"
[03-Dec-2019 16:08:08] WARNING: [pool www] child 15777 said into stderr: "                                                     "
[03-Dec-2019 16:08:08] WARNING: [pool www] child 15777 said into stderr: "  You have requested a non-existent service "mail".  "
[03-Dec-2019 16:08:08] WARNING: [pool www] child 15777 said into stderr: "                                                     "
[03-Dec-2019 16:08:08] WARNING: [pool www] child 15777 said into stderr: ""
[03-Dec-2019 16:08:08] WARNING: [pool www] child 15777 said into stderr: " in /usr/share/nginx/html/misoro/vendor/oro/platform/src/Oro/Bundle/EntityExtendBundle/OroEntityExtendBundle.php:129"
[03-Dec-2019 16:08:08] WARNING: [pool www] child 15777 said into stderr: "Stack trace:"
[03-Dec-2019 16:08:08] WARNING: [pool www] child 15777 said into stderr: "#0 /usr/share/nginx/html/misoro/vendor/oro/platform/src/Oro/Bundle/EntityExtendBundle/OroEntityExtendBundle.php(101): Oro\Bundle\EntityExtendBundle\OroEntityExtendBundle->checkConfigs()"
[03-Dec-2019 16:08:08] WARNING: [pool www] child 15777 said into stderr: "#1 /usr/share/nginx/html/misoro/vendor/oro/platform/src/Oro/Bundle/EntityExtendBundle/OroEntityExtendBundle.php(72): Oro\Bundle\EntityExtendBundle\OroEntityExtendBundle->ensureInitialized()"
[03-Dec-2019 16:08:08] WARNING: [pool www] child 15777 said into stderr: "#2 /usr/share/nginx/html/misoro/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(679): Oro\Bundle\EntityExtendBundle\OroEntityExtendBundle->build(Object(Oro\Component\DependencyInjection\ExtendedContainerBuilder))"
[03-Dec-2019 16:08:08] WARNING: [pool www] child 15777 said into stderr: "#3 /usr/share/ngi..."

In version 4.0.0-rc(2019-05-29 Show archive.org snapshot ):

Due to the updated version of symfony/swiftmailer-bundle parameter mailer_transport: mail is not supported anymore. Using old transport will cause such an exception - Unable to replace alias “swiftmailer.mailer.default.transport.real” with actual definition “mail”. You have requested a non-existent service “mail”. Please use mailer_transport: sendmail instead or another available swiftmailer transport type.

Fix

Edit the file /config/parameters.yml and change

from

mailer_transport: mail 

to

mailer_transport: sendmail

Update By Checkout from the GitHub Repository Show archive.org snapshot

1. Switch to maintenance mode

cd /path/to/application
sudo -unginx bin/console lexik:maintenance:lock --env=prod

2. Stop cron tasks

Launch the crontab editor:

sudo crontab -e -unginx

Comment this line:

# */1 * * * * /usr/bin/php /path/to/application/bin/console --env=prod oro:cron >> /dev/null

In the editor, press Esc and type :wq to quit.

3. Pull from upstream and merge to master

I created a local branch upstream_master for synching with upstream remote repo.

First, update branch upstream_master from upstream:

[kiat@reporting misoro]$ git checkout upstream_master
[kiat@reporting misoro]$ git pull upstream master
[kiat@reporting misoro]$ git push origin upstream_master

Second, merge upstream_master to master:

[kiat@reporting misoro]$ git checkout master
[kiat@reporting misoro]$ git merge upstream_master
[kiat@reporting misoro]$ git push origin_master

4. Update composer Dependencies

sudo -u nginx composer update --prefer-dist --no-dev

PHP Fatal error: Allowed memory size of 5368709120 bytes exhausted ...

If run out of memory, set memory_limit = -1 and try updating dependencies again.

5. Remove old caches

sudo rm -rf var/cache/prod
sudo rm -rf var/cache/dev

6. Upgrade Oro platform

Error On Updating Oro Platform

[kiat@reporting misoro]$ sudo -u nginx php bin/console oro:platform:update --env=prod --force
Check system requirements
+---------+-------------------------------------+
| Check   | Oro specific requirements           |
+---------+-------------------------------------+
| ERROR   | Upgrade NodeJS to ">=12.0" version. |
+---------+-------------------------------------+
+---------+--------------------------------------------------------------------------------------------------------+
| Check   | Optional recommendations                                                                               |
+---------+--------------------------------------------------------------------------------------------------------+
| WARNING | Install and enable the php_posix extension (used to colorize the CLI output).                          |
| WARNING | To get the latest internationalization data upgrade the ICU system package and the intl PHP extension. |
| WARNING | Install and enable the Tidy extension.                                                                 |
| WARNING | Disable Phar extension to reduce the risk of PHP unserialization vulnerability.                        |
| WARNING | Install and enable the IMAP extension.                                                                 |
+---------+--------------------------------------------------------------------------------------------------------+
Found 1 not fulfilled requirement
The command terminated with an exit code: 1.

Fixes

Upgrade node.js to v13. Warning: following may not be the best steps to upgrade nodejs.

[kiat@reporting misoro]$ sudo yum install -y gcc-c++ make
[kiat@reporting misoro]$ curl -sL https://rpm.nodesource.com/setup_13.x | sudo -E bash -
[kiat@reporting misoro]$ sudo yum remove -y nodejs npm
[kiat@reporting misoro]$ sudo yum install -y nodejs
[kiat@reporting misoro]$ node -v
v13.2.0

Install additional php extensions:

$ sudo yum --enablerepo=remi-php71 install php-tidy php-imap
$ sudo systemctl restart php-fpm nginx

Install php_posix

[kiat@reporting misoro]$ sudo yum install php-posix --enablerepo=remi
[kiat@reporting misoro]$ php --ri posix

posix

Revision => $Id: e3a2bc739dee8e0d29094e30e1cfbe3e87e2ceb4 $
$ sudo systemctl restart php-fpm nginx

Install ICU 64.2

Compile from source:

cd /home/kiat
wget http://download.icu-project.org/files/icu4c/64.2/icu4c-64_2-src.tgz
tar -xvf icu4c-*.tgz
cd icu/source/
sed -i '/#define __UCONFIG_H__/a #define UCONFIG_ENABLE_PLUGINS 1' common/unicode/uconfig.h
./configure --prefix=/usr --bindir=/usr/bin --libdir=/usr/lib64 --datadir=/usr/share --enable-plugins
/usr/bin/gmake 
sudo make install

Check installed version

[kiat@reporting source]$ icuinfo | grep version
    <param name="version">64.2</param>
    <param name="version.unicode">12.1</param>
    <param name="cldr.version">35.1</param>
    <param name="tz.version">2019a</param>

Also check in php:

$ php -i

...
intl

Internationalization support => enabled
version => 1.1.0
ICU version => 62.1
ICU Data version => 62.1
...

It's too much hassle to update PHP ICU, I leave it as is.

Now we update Oro Platform again:

[kiat@reporting misoro]$ sudo -u nginx php bin/console oro:platform:update --env=prod --force
Check system requirements
+---------+--------------------------------------------------------------------------------------------------------+
| Check   | Optional recommendations                                                                               |
+---------+--------------------------------------------------------------------------------------------------------+
| WARNING | To get the latest internationalization data upgrade the ICU system package and the intl PHP extension. |
| WARNING | Disable Phar extension to reduce the risk of PHP unserialization vulnerability.                        |
+---------+--------------------------------------------------------------------------------------------------------+
The application meets all mandatory requirements
...
[OK] All assets were successfully installed.
...
[OK] All assets were successfully build.
...
Running code optimizer
Cleaning up
06:52:44 [file+] /usr/share/nginx/html/misoro/public/js/app.min.js
Clearing the cache

7. Start cron tasks

Launch the crontab editor:

sudo crontab -e -unginx

Uncomment this line:

*/1 * * * * /usr/bin/php /path/to/application/bin/console --env=prod oro:cron >> /dev/null

In the editor, press Esc and type :wq to quit.

8. Switch Back to Normal Mode

sudo -ungix bin/console lexik:maintenance:unlock --env=prod

9. Run the Consumer(s)

sudo systemctl restart supervisord

See Configure and Run Required Background Processes Show archive.org snapshot

10. Commit to master

After the application is stable, we commit all tracked files changes to master branch and push to remote.

$ git add .
$ git commit -m "Updated to Oro Platform 4.0"
$ git pull origin
$ git push
kiatng Over 4 years ago