Deploy Application Changes to a New Environment (Testing or Production)
This guide explains how to deploy changes for Oro applications.
Hint
The instructions below will help you update a self-hosted application instance. If your application is hosted on OroCloud, follow the OroCloud guide to run the automated upgrade.
Warning
Ensure that you have the recent database and source code dump to roll back changes in case of errors before processing the upgrade
An absolute path to the directory where an application is installed will be used in the guide and will be referred to as <application-root-folder> further in this topic.
Note
We highly recommend running all the commands in this guide from the same user the web server runs (e.g., nginx or www-data).
To retrieve a new version and upgrade your Oro application instance:
Navigate to the Oro application root folder.
cd <application-root-folder>
Make sure that no changes require the database schema update.
php bin/console oro:entity-extend:update --dry-run --env=prod
The platform update is possible only when the database schema is up-to-date.
Switch the application to the maintenance mode.
php bin/console lexik:maintenance:lock --env=prod
Stop the cron tasks.
crontab -e
Comment the line below:
*/1 * * * * /usr/bin/php <application-root-folder>/bin/console --env=prod oro:cron >> /dev/null
Stop all running consumers. They are usually managed by Supervisord.
Create backups of your database and source code.
Check out the new code version from the release tag of your custom application git repository or deploy the latest version from an archive provided by the developer with the new code version.
Remove old caches.
rm -rf var/cache/prod/
Install PHP and NodeJS dependencies, build assets and set up the right owner for the retrieved files.
composer install --prefer-dist --no-dev
Update the application state to correspond to the code changes.
php bin/console oro:platform:update --env=prodNote
To speed up the update process, consider using
--schedule-search-reindexation
or the--skip-search-reindexation
option:
--schedule-search-reindexation
— postpone search reindexation process until the message queue consumer is started (on step 12 below).
--skip-search-reindexation
— skip search reindexation. Later, you can start it manually using commands oro:search:reindex to update search index for the specified entities and oro:website-search:reindex to rebuild storefront search index. See Search Index: Indexation Process.
Remove the caches.
php bin/console cache:clear --env=prod
Alternatively, run:
rm -rf var/cache/prod/ php bin/console cache:warmup --env=prod
Enable cron.
crontab -e
Uncomment the line below.
*/1 * * * * /usr/bin/php <application-root-folder>/bin/console --env=prod oro:cron >> /dev/null
Switch your application back to the normal mode from the maintenance mode.
php bin/console lexik:maintenance:unlock --env=prod
Run the consumer(s) that you stopped at step 5.
Note
If PHP bytecode cache tools (e.g., opcache) are used, PHP-FPM (or Apache web server) should be restarted after the uprgade to flush cached bytecode from the previous installation.
See Also
Business Tip
Looking to harness the new trend of digital commerce? Check out our guide on a B2B marketplace platform.