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->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());
}
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!');