<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=1063935717132479&amp;ev=PageView&amp;noscript=1 https://www.facebook.com/tr?id=1063935717132479&amp;ev=PageView&amp;noscript=1 "> Bitovi Blog - UX and UI design, JavaScript and Frontend development
Loading

DevOps |

Deploy StackStorm to AWS Using a GitHub Action

Deploying StackStorm to AWS is just a few clicks away with GitHub Actions. Check out this blog post for step-by-step instructions!

Phil Henning

Phil Henning

Twitter Reddit

This blog will explore how you can use GitHub Actions to deploy Stackstorm to AWS in just a few clicks!

Check out the action's companion video, which visually walks through everything here!

A Quick Summary of Stackstorm

StackStorm is an open-source, event-driven automation platform that helps organizations automate tasks, processes, and workflows. You can use StackStorm to automate a wide range of IT operations, including infrastructure management, incident response, and application deployment.

StackStorm uses a rules engine to define automated actions in response to various events, which can be triggered by external sources such as monitoring tools or user input. It also includes a powerful API and a command-line interface (CLI) for interacting with the system and extending its functionality. StackStorm is designed to be highly modular and extensible, allowing organizations to customize and tailor it to their specific needs.

Demo

Prerequisite

To deploy StackStorm to your AWS account with GitHub Actions, you’ll need three things:

The instructions in this post are available in the GitHub Repo Readme and the GitHub Actions Marketplace - Deploy Stackstorm documentation.

Instruction Summary

There are only a few steps you need to take to be up and running with StackStorm!

  1. Create a repo to run actions from
  2. Update the environment variables for the repo
    1. Add AWS_ACCESS_KEY_ID
    2. Add AWS_SECRET_ACCESS_KEY
    3. Add ST2_AUTH_USERNAME
    4. Add ST2_AUTH_PASSWORD
  3. Create a workflow for the ST2 installation
  4. Trigger the workflow
  5. Monitor action
  6. Confirm the deployment

Yes, that’s it!

1. GitHub Repository

 

 

To begin, create a new repo to house your deployment workflow. Using your preferred browser, navigate to GitHub.com. Sign in, then on the top right of the window, click on the add dropdown > New Repository.

Bitovi suggests that you name the repo: Operations-Stackstorm however, nothing restricts you from doing otherwise.

Finally, clone your new repository locally.

2. GitHub Repository Secrets

 

 

Staying in the browser, navigate to the newly created repository page > Settings > Secrets > Actions.

On the top right of the page, click on the green green button Create Repository Secret

Create a Secret with the corresponding name and value for each of the values below.

AWS_ACCESS_KEY_ID="Programmtic Access key"
AWS_SECRET_ACCESS_KEY="Programmtic Access Secret Key"
ST2_AUTH_USERNAME="User to be created during Stackstorm installation"
ST2_AUTH_PASSWORD="User password to be attached to above user during Stackstorm installation"

AWS credentials will be used to create new resources, such as the EC2 instance and security groups.

ST2_AUTH username and password will be used to create a new user identity in the stackstorm instance. Use the ST2_AUTH username and password to log into the Stackstorm console.

3. Create Workflow

 

 

Using your preferred code editor, open the repository.

Create the following two folders in the project root; .github/workflows/

Create a new file called .github/workflows/deploy-st2.yaml with the contents;

name: Deploy ST2 Single VM with GHA

on:
  push:
    branches: [ main ]


jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
    - id: deploy
      name: Deploy
      uses: bitovi/github-actions-deploy-stackstorm@main
      with:
        aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID}}
        aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
        aws_default_region: us-east-1
        st2_auth_username: ${{ secrets.ST2_AUTH_USERNAME}}
        st2_auth_password: ${{ secrets.ST2_AUTH_PASSWORD}}

This file uses the bitovi/github-actions-deploy-stackstorm action, which contains the IaC for provisioning the resources for and deploying Stackstorm to an AWS EC2 instance.

Make changes if you deem them necessary. Save the file and prep the commit to push your newly created folders and files to GitHub.

4. Trigger Workflow

 

 

And finally, the last step… and it’s the easiest one! With your commit loaded and ready to be pushed, let’s take a quick look back at our action to understand what the trigger will be;

on:
  push:
    branches: [ main ]

We can see that the trigger for this action is: Trigger On a Push to the Main Branch

So let’s push our code to trigger our workflow to create infrastructure for and deploy Stackstorm to an EC2 instance!

5. Monitor Action

 

 

6. Confirm the deployment

Back in your browser page, navigate to the above-created repository's main page. On the top repository nav bar, select > Actions > Deploy ST2 Single VM with GHA

If the instructions above have been followed, you should either see a yellow yellow indicator light for in-progress or a green green indicator light for success

 

 

Under the Hood

Platform Engineering using GitHub Actions

GitHub Actions are evolving from simple CI runners into a platform engineering service for developers that provides a powerful and flexible way to automate software development workflows.

BitOps

BitOps is used to orchestrate the deployment sequence for the tools used to provision and deploy to infrastructure. BitOps can be best summarized as a prepared Docker environment for invoking DevOps provisioning and deployment tools. BitOps is highly customizable and completely Open Source! Head over to the BitOps documentation or our GitHub Page to learn more.

Webinar: GitHub Action to Deploy StackStorm

There’s more we want to show and tell. Join us for a free live webinar on April 4, 2023, at 11 am US Central time, where we'll talk about the power of Platform Engineering, GitHub Actions, and StackStorm event-driven automation.

Register Now

Need Help?

Drop into Bitovi’s Community Discord, and talk to us in the DevOps channel!

Need DevOps Consulting services? Bitovi has consultants that can assist with all aspects of your development and DevOps journey.

 

Written by chat.openai.com. Prompted and edited by Bitovi.