Sunday, September 4, 2016

Integrate slack recipe with deployer

Hi

Today we will learn how to integrate slack message with deployer. After completing the deployment, a message will be send to slack channel.

First, copy/download the slack recipe from given url

"https://github.com/deployphp/recipes/blob/master/recipes/slack.php", then put it into under your recipe folder.

In this page, please configure below as per your requirement.

 // slack.php
 $defaultConfig = [
     'channel' => '#your slack channel',
     'icon'   => ':sunny:',
     'username' => 'slack username',
     'message' => "Deployment to `{{host}}` on *{{stage}}* was successful\n({{release_path}})",
     'app'   => 'app-name',
   ];
After that, in our deploy.php, include this slack recipe.

 // deploy.php  
 require 'vendor/deployer/deployer/recipe/slack.php';  

after including slack recipe, please configure below setting for slack.

 // deploy.php  
 set('slack', [  
   'token' => 'your slack token',  
   'team' => 'your slack team like team.slack.com',  
   'app'  => 'mrl sandbox',  
 ]);  

Slack token can be generate from slack api website url.

Since we should only notify Slack channel of a successfull deployment, the deploy:slack task should be executed right at the end.

 // deploy.php  
 after('deploy', 'deploy:slack');  

2 comments:

  1. You are doing well. Keep it up. We will also provide Quickbooks Phone Number Contact us 1-855-756-1077 for instant help.

    ReplyDelete
  2. Borrow money here today at 3% interest rate. My company offers all kinds of financial services at 3% interest rate and our services are 100% guarantee and risk-free. to Apply, contact my company via email: sawda.finance@gmail.com

    ReplyDelete