Search the site:

Copyright 2010 - 2024 @ DevriX - All rights reserved.

How to Use Slack and Node.js for a Stress-Free Deployment Planning

Slack and Node js for Deployment Planning

As you may already know, here at DevriX, we love Slack.

As a matter of fact, many remote working teams love Slack. 🙂

As a distributed team, scattered among three different continents, Slack is part of our virtual workspace: a second home, where we meet and discuss our work every day. Plus, we are time management maniacs as well.

If you are managing a deployment process, too and–like us–feel there is always room for additional optimization, here is how you can save a huge chunk of time and efforts, using Slack.

We should say. We have channels about pretty much everything in Slack: from working with clients, strategic discussions, separate teams, and different Asana projects all the way to channels about success stories, inspirational information and resources, Meet&Greet and… yes, channels where we order food for each other daily. 🙂

Because of that, we decided to create an important Slack Integration as a part of our deployment process. We did that using the Node.js environment. Our initial goal was to make a command which needs to open a Dialog which will handle all necessary questions before asking for permission to deploy to production. Then it posts it in the relevant Slack channel for teammates to see.

Here are the tips and tricks on how to do the same.

How to Create a Workflow That Works

Sit down with your colleagues and introduce the new sheriff in town – his name is the Deployer.

Before anyone deploys to production, they need to send a review request via the /deployer command. After that, your reviewers need to review the changes, and once everything is ready to deploy, they can approve, using the /deployer approve command.

That’s it!

deployer-approve-command@2x

Daily Deployment Meetings

Each morning our buddy Slackbot starts a meeting for us to schedule our deployments for the day.

slackbot

At this meetings, we discuss each deployment in detail just to be sure that we cover all possible edge cases and fix any blockers. We involve every Project Owner and the QA Team. We like to promote transparency and a stressless environment in all internal tasks.

Before the Deployment Request

  • As always: test, test and test.
  • Make sure that everyone involved is online.
  • Merge pull request with all features that are included in the release and make a new tag.
  • Deploy to staging and check with your QA Team once they pass all their final tests on staging to continue with the deployment request.

After Deployment Request

after-deployment-request

  • Wait until you receive approval for it.
  • Prepare everything that you need to deploy to production.
  • Check the steps that you need to follow.

deployment-request

After the Reviewer’s Approval

  • Inform all people involved that you are starting the process of deployment to production.
  • Deploy to production.
  • As always, test, test, and test.
  • Inform everyone who is involved when you are done with the deployment.
  • Sync with your QA team to check all released tasks and wait to be QA approved 🙂

After the QA’s Approval

  • Inform the client that everything is fine and everything is deployed.
  • Keep watching the site for a few hours (everything depends on the deployment impact).

How Can This Help Me?

Preparation is key to preventing unwanted circumstances. You need to ensure transparency, time management, and quality control.

If you already have an established software development process, the integration helps you to keep transparency at a high level and establish full control over your deployments.

So Let’s Start Creating a Slack App

  • Create an app at api.slack.com/apps
  • Click to the button “Create New App.”
  • Fill out the form with app name and workspace.
  • For this integration, we will use Slash Commands, Interactive Components, Bots, and Permissions. (But you can be more creative and use webhooks and event subscriptions.)
  • Add short description and app icon.

Done, Now What?

Let’s do some configurations and make it all shiny.

Interactive Components

Change the request URL to your domain/interactive-component.
You can also add an external data source URL here in case you want to add a custom data source to your options.

Slash Commands

slash-commands

Click on the button “Create New Command.”

Then click on the “Save” button.

Permissions

Copy the “OAuth Access Token” for later use.

Add a few permissions here:

permissions

Then if you like (recommended), add an Allowed IP to your server IP.

Bots

Let’s set a Display name and a default username (keep in mind that you can change it from the code). If you like, you can choose to turn on the “Always Show my Bot as Online” setting.

Code Setup

*Stay tuned for us to share a Git Clone link with you soon!

A few commands…

mv .env.sample to .env

Open .env and replace your tokens

code-setup

SLACK_ACCESS_TOKEN='YOUR OAuth Access Token'
PORT=3000
SLACK_VERIFICATION_TOKEN='Verification Token'

Let’s try to install it!

npm install

Let’s run it!

npm start

When you start the server, go back to the Slack App and enter command /deployer.

You will see this dialog. Let’s explain what each field is:

We need to add when you will deploy.

How long will you take to deploy?

deployment-estimate

Add deployment steps.

Add a link to your task management system’s task.

Add a link to Git PR.

link-to-git-pr

Once you are done filling this form and you click on the “Submit” button, the system will send a message to the current channel with your Deployment Request. Simple as that.

new-deployment-request

Once the reviewer is done with his/her part, he/she can send the approval the same way, using the /deployer approve command.

Wrapping Up

You’ve just met our new slack bot, the Deployer. 🙂

The idea behind it is to improve our company goals in a stress-free way, providing easy and quick control over production deployment.

Most of our stressful moments are related to deployment to production, as we are trying to optimize our time and teamwork to review each and every deployment.

We have created our slack bot to be our helper with that challenge.

When deploying to production now, we use the */deployer* command inside the respected channel at least 30 minutes before it.

Using this command, we produce a deployment request which needs to be approved by our code reviewers and deployment managers.

You can create a #deployer-test Slack channel and test the commands inside.
As you saw, after you execute command */deployer* 4 fields appear:

When?
This is pretty clear – What is the time when you will deploy to production?

Deployment Estimate?
Time estimated for the deployment in a stressless condition.

Deploy Steps
Describe the steps that you are going to use during the deployment.

Link to Your Task Management System’s Task
This will help the reviewer check all tasks related to the deployment.

Link to Git PR
This is important for the reviewer to check the exact code that is pushed to production.

That’s all. Simple and clear.

Once the reviewer approves the deployment, it is displayed as “Approved” inside the channel.

We can then continue our journey as a lean software development machine.
We’ll keep working on fresh new ideas to implement, using Slack bot.

You can see just how we can improve the integration functionality and make it even more effective and stress-free? Leave your comments below.