Skip to content

Deploying on Stratus

MageMojo has created Stratus to be as simple as possible for code deployments. Despite the incredible sophistication of the Stratus cloud platform, Stratus deployments are fairly straightforward and familiar.

Before deploying code to a Stratus instance:

  • Make sure that all symlinks are using absolute paths.
  • Note that CloudFront may take up to 15 minutes to clear.

To deploy code to Stratus, use SSH and push the code, move symlinks, and flush caches. The built-in CLI commands provided in the Stratus Control panel can also be used to assist.

After deploying, you should run the following additional commands:

/usr/share/stratus/cli autoscaling.reinit;
sleep 150s;
/usr/share/stratus/cli cache.all.clear;
  • autoscaling.reinit performs a rolling update of the php-fpm containers. When a store is scalled this will ensure a seamless update across the scaled php-fpm services.
  • sleep 5s pauses to wait rolling update of php-fpm containers to complete because autoscaling.reinit is called asynchronously.

Troubleshooting

If files (other than js, css files that may still be clearing in CloudFront) are not clearing properly from CloudFront or if the Magento cache status (on/off) is reported differently between the CLI and the Magento Admin, use the following following the deployment:

DISABLE CRON FIRST
php bin/magento maintenance:enable;
n98-magerun2 cache:disable;
php bin/magento cache:flush;
/usr/share/stratus/cli cache.all.clear;

php bin/magento setup:upgrade;
php bin/magento setup:di:compile;
php bin/magento setup:static-content:deploy -f -j 10;
php bin/magento indexer:reindex;

n98-magerun2 cache:enable;
/usr/share/stratus/cli autoscaling.reinit;
sleep 150s;
php bin/magento cache:flush;
/usr/share/stratus/cli cache.all.clear;
php bin/magento maintenance:disable;

Then, be sure to re-enable cron.

See also: