/deployer-magemojo

With this MageMojo Stratus Deployer Recipe you can use the MageMojo's CLI power

Primary LanguagePHPMIT LicenseMIT


Magemojo Stratus Deployer Recipe

Easily run cache clearing in your deployments

Build Status Tags Total Downloads

Use this tool integrated with the Deployer to use the power of MageMojo Stratus CLI.

If you are using Magento 2 you can use this Magento 2 Deployer Recipe together!

Features

You can run the command followed by dep. Example: dep mm:cache:clear --stage=production.

Command Description
mm:cron:stop Stop Crons from running
mm:cron:start Start crons
mm:zdd:init Zero Downtime Deployment Init
mm:zdd:switch Zero Downtime Deployment Switch with check
mm:autoscaling:reinit It will issue a redeploy of PHP-FPM services
mm:cache:clear Clears everything
mm:cloudfront:clear Clears Cloudfront cache
mm:opcache:clear Clears OPCache cache
mm:redis:clear Clears Redis cache
mm:varnish:clear Clears Varnish cache

How to install

How to install Deployer:

curl -LO https://deployer.org/deployer.phar && sudo mv deployer.phar /usr/local/bin/dep && sudo chmod +x /usr/local/bin/dep

How to install this package:

composer require rafaelstz/deployer-magemojo --dev

How to use

After install it, you can add the line below after the namespace and run dep to check:

// MageMojo Recipe
require __DIR__ . '/vendor/rafaelstz/deployer-magemojo/MageMojo.php';

This recipe when installed automatically will clean all caches after the deploy success, but if you want to restart all services, add these into the bottom:

// MageMojo restart services
after('success', 'mm:autoscaling:reinit');

// MageMojo clean all caches
after('success', 'mm:cloudfront:clear');
after('success', 'mm:varnish:clear');
after('success', 'mm:redis:clear');

For example:

<?php

namespace Deployer;
// MageMojo Recipe
require __DIR__ . '/vendor/rafaelstz/deployer-magemojo/MageMojo.php';

// Project
set('application', 'My Project Name');
set('repository', 'git@bitbucket.org:mycompany/my-project.git');
set('default_stage', 'production');

// Project Configurations
host('production')
    ->hostname('iuse.magemojo.com')
    ->user('my-user')
    ->port(22)
    ->set('deploy_path', '/home/my-project-folder')
    ->set('branch', 'master')
    ->stage('production');

// MageMojo restart services
after('success', 'mm:autoscaling:reinit');

// MageMojo clean all caches
after('success', 'mm:cloudfront:clear');
after('success', 'mm:varnish:clear');
after('success', 'mm:redis:clear');

License

MIT

Rafael Correa Gomes