Installtion StackStorm on AWS

gkzz
9 min readMay 26, 2019

AMI: Red Hat Enterprise Linux (RHEL) 7.2 (HVM)

You should check system information, before you install StackStorm.

Although I tried to install stackstorm on Amazon linux2, or Red Hat 8, I failed.

You should make use of recommended systems as much as possible.

Official Document says to us about system requirements bellow;

Linux (64-bit)

Vagrant Box

Amazon AWS AMI

sources;

Installtaion:

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ sudo yum update -y[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ curl -sSL https://stackstorm.com/packages/install.sh | bash -s -- --user=st2admin --password='Ch@ngeMe'20190526T000246-0400 Complete!
20190526T000247-0400 ####################### WARNING ########################
20190526T000247-0400 ######## Chatops requires manual configuration #########
20190526T000247-0400 Edit /opt/stackstorm/chatops/st2chatops.env to specify
20190526T000247-0400 the adapter and settings hubot should use to connect to
20190526T000247-0400 the chat you're using. Don't forget to start the service
20190526T000247-0400 afterwards:
20190526T000247-0400
20190526T000247-0400 $ sudo service st2chatops restart
20190526T000247-0400
20190526T000247-0400 For more information, please refer to documentation at
20190526T000247-0400 https://docs.stackstorm.com/install/rhel7.html#setup-chatops
20190526T000247-0400 ########################################################
20190526T000247-0400
20190526T000247-0400
20190526T000247-0400 ███████╗████████╗██████╗ ██████╗ ██╗ ██╗
20190526T000247-0400 ██╔════╝╚══██╔══╝╚════██╗ ██╔═══██╗██║ ██╔╝
20190526T000247-0400 ███████╗ ██║ █████╔╝ ██║ ██║█████╔╝
20190526T000247-0400 ╚════██║ ██║ ██╔═══╝ ██║ ██║██╔═██╗
20190526T000247-0400 ███████║ ██║ ███████╗ ╚██████╔╝██║ ██╗
20190526T000247-0400 ╚══════╝ ╚═╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝
20190526T000247-0400
20190526T000247-0400 st2 is installed and ready to use.
20190526T000247-0400
20190526T000247-0400 Head to https://YOUR_HOST_IP/ to access the WebUI
20190526T000247-0400
20190526T000247-0400 Don't forget to dive into our documentation! Here are some res
20190526T000247-0400 for you:
20190526T000247-0400
20190526T000247-0400 * Documentation - https://docs.stackstorm.com
20190526T000247-0400 * Pack Exchange - https://exchange.stackstorm.org/
20190526T000247-0400
20190526T000247-0400 Thanks for installing StackStorm! Come visit us in our Slack C
20190526T000247-0400 and tell us how it's going. We'd love to hear from you!
20190526T000247-0400 http://stackstorm.com/community-signup

Check StackStorm Vesrion:

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ st2 --version
st2 3.0.0, on Python 2.7.5

Let’s login!

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ st2 login st2admin -p 'Ch@ngeMe'
Logged in as st2admin
Note: You didn't use --write-password option so the password hasn't been stored in
the client config and you will need to login again in 24 hours when the auth token
expires.
As an alternative, you can run st2 login command with the "--write-password" flag,
but keep it mind this will cause it to store the password in plain-text in the client config file (~/.st2/config).

How to see “action list”, “triger list” and“rule list”:

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ st2 action list --pack=core
+---------------------+------+--------------------------------------------------------------+
| ref | pack | description |
+---------------------+------+--------------------------------------------------------------+
| core.announcement | core | Action that broadcasts the announcement to all stream |
| | | consumers. |
| core.ask | core | Action for initiating an Inquiry (usually in a workflow) |
| core.echo | core | Action that executes the Linux echo command on the |
| | | localhost. |
| core.http | core | Action that performs an http request. |
| core.inject_trigger | core | Action which injects a new trigger in the system. |
| core.local | core | Action that executes an arbitrary Linux command on the |
| | | localhost. |
| core.local_sudo | core | Action that executes an arbitrary Linux command on the |
| | | localhost. |
| core.noop | core | Action that does nothing |
| core.pause | core | Action to pause current thread of workflow/sub-workflow. |
| core.remote | core | Action to execute arbitrary linux command remotely. |
| core.remote_sudo | core | Action to execute arbitrary linux command remotely. |
| core.sendmail | core | This sends an email |
| core.uuid | core | Generate a new UUID (default uuid4) |
| core.winrm_cmd | core | Action to execute arbitrary Windows Command Prompt command |
| | | remotely via WinRM. |
| core.winrm_ps_cmd | core | Action to execute arbitrary Windows PowerShell command |
| | | remotely via WinRM. |
+---------------------+------+--------------------------------------------------------------+
[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ st2 trigger list
+--------------------------------------+-------+--------------------------------------------------------------+
| ref | pack | description |
+--------------------------------------+-------+--------------------------------------------------------------+
| core.st2.CronTimer | core | Triggers whenever current time matches the specified time |
| | | constaints like a UNIX cron scheduler. |
| core.st2.DateTimer | core | Triggers exactly once when the current time matches the |
| | | specified time. e.g. timezone:UTC date:2014-12-31 23:59:59. |
| core.st2.IntervalTimer | core | Triggers on specified intervals. e.g. every 30s, 1week etc. |
| core.st2.action.file_writen | core | Trigger encapsulating action file being written on disk. |
| core.st2.generic.actiontrigger | core | Trigger encapsulating the completion of an action execution. |
| core.st2.generic.inquiry | core | Trigger indicating a new "inquiry" has entered "pending" |
| | | status |
| core.st2.generic.notifytrigger | core | Notification trigger. |
| core.st2.key_value_pair.create | core | Trigger encapsulating datastore item creation. |
| core.st2.key_value_pair.delete | core | Trigger encapsulating datastore item deletion. |
| core.st2.key_value_pair.update | core | Trigger encapsulating datastore set action. |
| core.st2.key_value_pair.value_change | core | Trigger encapsulating a change of datastore item value. |
| core.st2.sensor.process_exit | core | Trigger indicating sensor process is stopped. |
| core.st2.sensor.process_spawn | core | Trigger indicating sensor process is started up. |
| core.st2.webhook | core | Trigger type for registering webhooks that can consume |
| | | arbitrary payload. |
| linux.file_watch.line | linux | Trigger which indicates a new line has been detected |
+--------------------------------------+-------+--------------------------------------------------------------+
[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ st2 rule list
+----------------+---------+-----------------------------------------------+---------+
| ref | pack | description | enabled |
+----------------+---------+-----------------------------------------------+---------+
| chatops.notify | chatops | Notification rule to send results of action | True |
| | | executions to stream for chatops | |
+----------------+---------+-----------------------------------------------+---------+

Just run st2!

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ st2 run core.local -- date -R
.
id: 5cea1e02bae5973a7c6dddd5
status: succeeded
parameters:
cmd: date -R
result:
failed: false
return_code: 0
stderr: ''
stdout: Sun, 26 May 2019 01:02:58 -0400
succeeded: true

All you have to do is execute one command, “st2 execution get <id>”, If you check result:

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ st2 execution get 5cea1e02bae5973a7c6dddd5
id: 5cea1e02bae5973a7c6dddd5
status: succeeded (0s elapsed)
parameters:
cmd: date -R
result:
failed: false
return_code: 0
stderr: ''
stdout: Sun, 26 May 2019 01:02:58 -0400
succeeded: true

All execution records are accessible by the st2 execution list.

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ st2 execution list
+--------------------------+---------------+--------------+-------------------------+---------------------------+----------------------------+
| id | action.ref | context.user | status | start_timestamp | end_timestamp |
+--------------------------+---------------+--------------+-------------------------+---------------------------+----------------------------+
| 5cea0f98bae5973a7c6dddad | core.local | st2admin | succeeded (0s elapsed) | Sun, 26 May 2019 04:01:28 | Sun, 26 May 2019 04:01:28 |
| | | | | UTC | UTC |
| 5cea0f9bbae5973a7c6dddb0 | core.remote | st2admin | succeeded (0s elapsed) | Sun, 26 May 2019 04:01:31 | Sun, 26 May 2019 04:01:31 |
| | | | | UTC | UTC |
| 5cea0f9dbae5973a7c6dddb3 | packs.install | st2admin | succeeded (12s elapsed) | Sun, 26 May 2019 04:01:33 | Sun, 26 May 2019 04:01:45 |
| | | | | UTC | UTC |
| 5cea1d62bae5973a7c6dddd2 | core.local | st2admin | succeeded (0s elapsed) | Sun, 26 May 2019 05:00:18 | Sun, 26 May 2019 05:00:18 |
| | | | | UTC | UTC |
| 5cea1e02bae5973a7c6dddd5 | core.local | st2admin | succeeded (0s elapsed) | Sun, 26 May 2019 05:02:58 | Sun, 26 May 2019 05:02:58 |
| | | | | UTC | UTC |
+--------------------------+---------------+--------------+-------------------------+---------------------------+----------------------------+
[ec2-user@ip-xxx-xxx-xxx-xxx ~]$

You can see outputs formated json by adding “-j option”.

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ st2 run core.local env="VAR=hello" cmd='echo $VAR; date'
.
id: 5cea26f0bae5973a7c6ddddb
status: succeeded
parameters:
cmd: echo $VAR; date
env:
VAR: hello
result:
failed: false
return_code: 0
stderr: ''
stdout: 'hello
Sun May 26 01:41:04 EDT 2019'
succeeded: true
[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ st2 execution get 5cea26f0bae5973a7c6ddddb -j
{
"id": "5cea2639bae5973a7c6dddd8",
"parameters": {
"cmd": "echo $VAR; date",
"env": {
"VAR": "hello"
}
},
"result": {
"failed": false,
"return_code": 0,
"stderr": "",
"stdout": "hello\nSun Sun May 26 01:41:04 EDT 2019",
"succeeded": true
},
"status": "succeeded"
}

You can do something like this:

API?

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ st2 run -j core.http url="https://docs.stackstorm.com" method="GET"{
"id": "5cea2923bae5973a7c6ddde7",
"parameters": {
"method": "GET",
"url": "https://docs.stackstorm.com"
},
"result": {
"body": "\n\n<!DOCTYPE html>\n<!--[if IE 8]><html class=\"no-js lt-ie9\" lang=\"en\" > <![endif]-->\n<!--[if gt IE 8]><!--> <html class=\"no-js\" lang=\"en\" > <!--<![endif]-->\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <meta name=\"google-site-verification\" content=\"ovwnX0ej2kps4UuJ9NOzNjJcLOQD8JPDLNhe-hMYTMk\" />\n <!-- Google Tag Manager -->\n <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','GTM-NKZBMHZ');</script>\n <!-- End Google Tag Manager -->\n \n <title>StackStorm Documentation &mdash; StackStorm 3.0.0 documentation</title>\n \n\n

[...]
<footer>\n \n <div class=\"rst-footer-buttons\" role=\"navigation\" aria-label=\"footer navigation\">\n \n <a href=\"overview.html\" class=\"btn btn-neutral float-right\" title=\"StackStorm Overview\">Next <span class=\"fa fa-arrow-circle-right\"></span></a>\n \n \n
</div>\n \n\n <hr/>\n\n <div role=\"contentinfo\">\n <p>\n &copy; Copyright 2014 - 2019, StackStorm.\n </p>\n </div>\n\n <a href=\"https://github.com/snide/sphinx_rtd_theme\">Sphinx theme</a> provided by <a href=\"https://readthedocs.org\">Read the Docs</a>\n</footer>\n </div>\n </div>\n\n </section>\n\n </div>\n \n <div
id=\"versions\"></div>\n\n \n\n <script type=\"text/javascript\">\n var DOCUMENTATION_OPTIONS = {\n URL_ROOT:'./',\n VERSION:'3.0.0',\n
COLLAPSE_INDEX:false,\n FILE_SUFFIX:'.html',\n HAS_SOURCE: true,\n SOURCELINK_SUFFIX: '.txt'\n };\n </script>\n <script type=\"text/javascript\" src=\"_static/jquery.js\"></script>\n <script type=\"text/javascript\" src=\"_static/underscore.js\"></script>\n <script type=\"text/javascript\" src=\"_static/doctools.js\"></script>\n\n \n\n \n \n <script type=\"text/javascript\" src=\"_static/js/theme.js\"></script>\n \n\n \n \n <script type=\"text/javascript\">\n jQuery(function () {\n SphinxRtdTheme.StickyNav.enable();\n });\n </script>\n \n\n <script type=\"text/javascript\" src=\"/_static/js/versions.js\"></script> \n\n</body>\n</html>",
"headers": {
"Connection": "keep-alive",
"Content-Length": "70521",
"Content-Type": "text/html",
"Date": "Sun, 26 May 2019 05:50:30 GMT",
"ETag": "\"2cdf543ff1ce61b98dca28a994447e37\"",
"Last-Modified": "Mon, 06 May 2019 14:33:06 GMT",
"Server": "AmazonS3",
"Via": "1.1 0c5e11348f181c6aeb0775770f4b4d39.cloudfront.net (CloudFront)",
"X-Amz-Cf-Id": "j9gvmE-8ULOs-PO3oWx490_31sCcEbJLuSad9uAuilZlsON_ilokPw==",
"X-Cache": "Miss from cloudfront",
"x-amz-version-id": "SNPWdZnW73roEMg6Zp8jYA1z8nnjuGK7"
},
"parsed": false,
"status_code": 200
},
"status": "succeeded"
}

Executing commands:

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ st2 run core.local -- ls -al
.
id: 5cea2b2dbae5973a7c6dddea
status: succeeded
parameters:
cmd: ls -al
result:
failed: false
return_code: 0
stderr: ''
stdout: 'total 36
dr-xr-xr-x. 18 root root 4096 May 25 23:54 .
dr-xr-xr-x. 18 root root 4096 May 25 23:54 ..
lrwxrwxrwx. 1 root root 7 May 25 23:54 bin -> usr/bin
dr-xr-xr-x. 5 root root 4096 May 25 23:58 boot
drwxr-xr-x. 2 root root 6 Nov 9 2015 data
drwxr-xr-x. 18 root root 2700 Dec 14 2017 dev
drwxr-xr-x. 82 root root 8192 May 26 00:02 etc
drwxr-xr-x. 4 root root 35 May 26 00:00 home
lrwxrwxrwx. 1 root root 7 May 25 23:54 lib -> usr/lib
lrwxrwxrwx. 1 root root 9 May 25 23:54 lib64 -> usr/lib64
drwxr-xr-x. 2 root root 6 Dec 14 2017 media
drwxr-xr-x. 2 root root 6 Dec 14 2017 mnt
drwxr-xr-x. 3 root root 23 Apr 18 14:31 opt
dr-xr-xr-x. 196 root root 0 Dec 14 2017 proc
dr-xr-x---. 6 root root 4096 May 26 00:02 root
drwxr-xr-x. 30 root root 800 May 26 00:02 run
lrwxrwxrwx. 1 root root 8 May 25 23:54 sbin -> usr/sbin
drwxr-xr-x. 2 root root 6 Dec 14 2017 srv
dr-xr-xr-x. 13 root root 0 Dec 14 2017 sys
drwxrwxrwt. 2 root root 6 May 26 00:01 tmp
drwxr-xr-x. 13 root root 4096 May 25 23:54 usr
drwxr-xr-x. 19 root root 4096 May 25 23:54 var'
succeeded: true

sources;

Check OS Version:

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ cat /etc/os-release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.2 (Maipo)"

ID="rhel"
ID_LIKE="fedora"
VERSION_ID="7.2"
PRETTY_NAME="Red Hat Enterprise Linux Server 7.2 (Maipo)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.2:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.2
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.2"

Thank you!

I’m happy to you to follow me on medium and Twitter!

Read this article bellow, if you’ re interested in how to run actions.

--

--

gkzz

🇯🇵 #SoftwareDeveloper #MeijiUniv @apc_tweet Opinions are my own. #Geek #ギークハウス大倉山 #gkz https://gkzz.github.io/