PHP code example of rafaelstz / deployer-magento2

1. Go to this page and download the library: Download rafaelstz/deployer-magento2 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rafaelstz / deployer-magento2 example snippets




namespace Deployer;
on', 'My Project Name');
set('repository', '[email protected]:lesite/my-project.git');
set('default_stage', 'staging');
//set('languages', 'en_US pt_BR');
//set('verbose', '-v');

// Env Configurations
set('php', '/usr/bin/php70');
set('magerun', '/usr/bin/n98-magerun2');
set('composer', '/usr/bin/composer');

// Project Configurations
host('my-store.com')
    ->hostname('iuse.magemojo.com')
    ->user('my-user')
    ->port(22)
    ->set('deploy_path', '/home/my-project-folder')
    ->set('branch', 'master')
    ->set('is_production', 1)
    ->stage('staging')
    ->roles('master')
    // ->configFile('~/.ssh/config')
    ->identityFile('~/.ssh/id_rsa')
    ->addSshOption('UserKnownHostsFile', '/dev/null')
    ->addSshOption('StrictHostKeyChecking', 'no');

set('release_path', "{{deploy_path}}");
desc('Deploying...');
task('deploy', [
    'deploy:info',
    'deploy:lock',
    'magento:maintenance:enable',
    'git:update_code',
    'composer:install',
    'deploy:magento',
    'magento:maintenance:disable',
    'deploy:unlock',
    'success'
]);