You can hook into Slack Show archive.org snapshot when using Capistrano for deployment. The slackistrano Show archive.org snapshot gem does most of the heavy lifting for you. Its default messages are unobtrusive and can be adjusted easily.
When deploying, it posts to a Slack channel like this:
How to integrate
Integrating Slackistrano with Capistrano 3 is fairly simple.
If you are not a Slack admin
Find a Slack workspace admin and have them do steps 1-5 for you. You need to tell them your channel name and send a link to this card.
-
In a web browser, open Slack's admin settings Show archive.org snapshot . Navigate to " Integrations Show archive.org snapshot ", then " Custom Integrations Show archive.org snapshot ", and open " Incoming WebHooks Show archive.org snapshot ".
-
Click "Add to Slack" to add a new webhook.
-
Choose channel, and click the "add" button.
-
Scroll down to find the "Customize Name" field. Enter "Slackistrano" (or similar) and click the "Save Settings" button.
- This will not be used for notifications, but clarifies the webhook's purpose when browsing the list of integrations.
- You don't need to specify an icon, Slackistrano sends its own.
-
Copy your "Webhook URL" for use in your project.
-
Add
slackistranoto yourGemfile, in your:deploygroup, andbundleyour project. -
Add the following to your
Capfile.# Slack notifications require 'slackistrano/capistrano' set :slackistrano, { channel: '#your-channel', webhook: 'https://hooks.slack.com/services/your/webhook/url', } -
Optional: Tweak your deployment messages Show archive.org snapshot . See the attached file for our default message formatting. Your
Capfileneeds to be adjusted accordingly:# Slack notifications require 'slackistrano/capistrano' require_relative 'lib/capistrano/slackistrano' set :slackistrano, { klass: Slackistrano::CustomMessaging, channel: '#your-channel', webhook: 'https://hooks.slack.com/services/your/webhook/url', } -
Test Slackistrano:
cap staging slack:deploy:test -
When you are satisfied, do a real deploy to confirm everything works.