PHP code example of glowieframework / deploy

1. Go to this page and download the library: Download glowieframework/deploy 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/ */

    

glowieframework / deploy example snippets


'plugins' => [
    // ... other plugins here
    \Glowie\Plugins\Deploy\Deploy::class,
],

'servers' => [

    'localhost' => [
        'local' => true, // Marks this server as local deployment (no SSH)
        'env' => [] // (Optional) Associative array of environment variables to expose to the server
    ],

    'web' => [
        'host' => env('DEPLOY_SSH_HOST'), // SSH hostname or IP address
        'port' => env('DEPLOY_SSH_PORT', 22), // SSH port (defaults to 22)
        'user' => env('DEPLOY_SSH_USER', 'root'), // SSH user name
        'env' => [] // (Optional) Associative array of environment variables to expose to the server
    ],

    // ... other servers can go here

],

public function deploy(){

    $this->command('cd /var/www/my-project');

    $this->command('git pull');

    $this->command('php firefly migrate');

}

// Runs only in "homologation" server
$this->command('cd /var/www/my-project', 'homologation');

// Runs in both "homologation" and "production" servers
$this->command('git pull', ['homologation', 'production']);

$this->onServer('production', function() {
    $this->command('cd /var/www/production-folder');
    $this->command('git pull');
});

$this->print('My custom message');

$this->error('Something failed!');

$this->success('Everything works great.');

$this->warning('Be careful...');

$this->info('Running build...');

public function onTaskInit(string $task){
    // You can do anything here
    $this->info("Starting $task...");
}

public function onTaskDone(string $task){
    // You can do anything here
    $this->success("$task ran successfully!");
}

public function onTaskFail(string $task, Throwable $th){
    // You can do anything here
    $this->error("$task failed! Stack trace:");
    $this->error($th->getTraceAsString());
}

$this->env('custom_env', 'custom_value');

$version = $this->getArg('version'); // returns "1.0.0"

$isProduction = $this->hasOption('production'); // returns true

public function pipeline(){

    $this->task('setup_server');

    $this->task('clone_repository');

    $this->task('build_application');

    $this->task('clear_cache');

}

public function onStoryInit(string $story){
    // You can do anything here
    $this->info("Starting $story...");
}

public function onStoryDone(string $story){
    // You can do anything here
    $this->success("$story ran successfully!");
}

public function onStoryFail(string $story, Throwable $th){
    // You can do anything here
    $this->error("$story failed! Stack trace:");
    $this->error($th->getTraceAsString());
}

$this->notifyDiscord('Write your message to Discord here!');

$this->notifySlack('Write your message to Slack here!');

$this->notifyTelegram('Write your message to Telegram here!');

$this->notifyPush('Write a message to your phone here!');
shell
php firefly publish
shell
php firefly deploy:create
shell
php firefly deploy:run
shell
php firefly deploy:run --task=myTask
shell
php firefly deploy:run --path=/path/to/.deploy-tasks.php
shell
php firefly deploy:run --config=/path/to/.deploy-config.php
shell
php firefly deploy:run --version=1.0.0
shell
php firefly deploy:run -production
shell
php firefly deploy:story --name=pipeline