Chat Bot for Infrastructure Management

Everyone is definitely familiar with all those great development and infrastructure tools that should be used when you create and/or maintain a mature software solution. Some of them are integrated with each other, like Atlassian stack, some require additional tweaking, as AWS and other monitoring tools, and some may require extra routines to be used (say, you secure all with firewalls and VPNs).

Having all parts properly and securely set up, you will need to login into each and every tool to either use it or see the inside data. Obviously, most of the time you are simply looking into what’s going on with your servers, issues, builds, documents and other as a snapshot.

slack-logoOne of the options will be using an integration tool like Slack that will allow you to tire most of the parts together. It has a great a powerful integration abilities as as well as own Slack API, but will not allow you to perform any action remotely.

And what if you are ✈️travelling or in a middle of an important 👔meeting and you need to not only see what’s going on with your system but also 🛠influence on it and 🕹manipulate?

We faced with the same needs while working on an Online Wealth Manager solution. Thus, as an obvious solution we required a Bot that will solve daily operations and development problems, such as:

  • Start/stop environment in private or public clouds;
  • Apply configuration changes (orchestration) on each machine or the whole group;
  • Trigger builds on CI/CD servers;
  • Grab statistics and performance data and represent those as charts;
  • Tail and grep logs across multiple application instances.

What is done

So, we assigned our DevOps guru to implement this on top of Slack messaging tool. Bot resulted in the following feature set:

  • Transport tolerant to any messaging platform, including Slack, Telegram, XMPP, IRC or any custom messaging protocol;
  • Ready for IVR-system and/or SMS integration;
  • Asynchronous and fault tolerant, distributed and fast-recovery;
  • Horizontally scalable;
  • Lean and low resource usage (average memory consumption 70 Mb);
  • Flexible and extendible via plugin API having isolated Core, Plugin and Transport layers;
  • Existing integration with Amazon AWS, Ansible, Bamboo, Gitlab, RRD Tool, Monit and more;
  • Human-friendly text interface, with pre-formatted or graphical responses;
  • REST API for integration with third-party services;
  • Support for periodical operations through cron expressions to schedule tasks with 1 second granularity;
  • Passive-commands to monitor the channel and provide assistance as soon as it’s required.

slack-chat-bot

Implementation details

What is inside and how it is implemented:

  • Implemented using modern Go/Scala technology stack;
  • Asynchronous calls to native AWS SDK;
  • Concurrent channels (commands) via Go-routines;
  • Bot is not a subject of C10K problem due to concurrency nature of the Core (handles over 10,000 connections);
  • Zero-config via service discovery, agentless and plug-and-play;
  • Functionality can be also extended with Bash/Python scripts, which are triggered and managed by the Bot;
  • Listening for incoming connections and spawn go-routine; main thread is working in synchronous mode (inspired by event-driven implementation of Node.js);
  • Tolerant to operation system (Linux, Windows, macOS);
  • Collects statistics about itself, including users’ activity and performance data.

Near future

In additional to all done and to facilitate the usage of the Bot, we plan to extend it with following features:

  • Installation options: on-premises or SaaS;
  • Lightweight web-based interface (reactive and responsible) to monitor the Bot and manage its connections and plugins;
  • Single-click installation and integration;
  • LDAP integration (starting from $1.99 per user 😂);
  • VPN tunnel for customers in private networks;
  • Certification Authority plugin easy to deploy;
  • Integration with Microsoft Server Management APIs.

 

Also facing with issues like that or need a similar Bot? Just give us a shout!