### StackStorm Development Services Startup Output Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/development/sources.rst Example output shown after successfully starting StackStorm development services using './tools/launchdev.sh start'. It indicates the status of various StackStorm components. ```bash ./tools/launchdev.sh start Initialising system variables ... Current user:group = root:root Using virtualenv: /root/workspace/st2/virtualenv Using python: /root/workspace/st2/virtualenv/bin/python (Python 3.10.12) Log file location: /root/workspace/st2/./tools/../logs Using st2 config file: /root/workspace/st2/conf/st2.dev.conf Starting all st2 servers ... Changing working directory to /root/workspace/st2/./tools/.. Using config base dir: /opt/stackstorm/configs Using content packs base dir: /opt/stackstorm/packs Starting st2-api using gunicorn ... Starting st2-stream using gunicorn ... Starting st2-workflow engine(s): st2-workflow-1 ... Starting st2-actionrunner(s): st2-actionrunner-1 ... ``` -------------------------------- ### Install PAM Authentication Backend Package Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/authentication.rst Example command to manually install the Python package for the PAM authentication backend on the server where st2auth is running. Ensure you have the correct package name. ```bash sudo pip install st2-auth-pam ``` -------------------------------- ### Enable and Start Core Services Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/rhel9.rst Enable the MongoDB, RabbitMQ, and Redis services to start on boot and start them immediately. ```bash sudo systemctl enable mongod rabbitmq-server redis sudo systemctl start mongod rabbitmq-server redis ``` -------------------------------- ### Pack Install Output Example Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/packs.rst When a pack is installed, the output of the `register_pack` action indicates which resources had their metadata overridden with '(overridden)' entries. ```json { "runners": 14, "rule_types": 2, "policy_types": 3, "triggers": 0, "sensors": 2, "sensors(overridden)": 2, "actions": 1, "rules": 1, "aliases": 0, "policies": 0, "configs": 0 } ``` -------------------------------- ### Install and Configure st2chatops Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/rhel8.rst Installs the st2chatops package, starts and enables the st2chatops service, and reloads StackStorm packs to register the chatops.notify rule. ```bash curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash source ~/.bashrc nvm install 20 sudo yum install -y st2chatops sudo systemctl start st2chatops # Start st2chatops on boot sudo systemctl enable st2chatops sudo st2ctl reload --register-all ``` -------------------------------- ### Quick Install Script for StackStorm Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/index.rst Run this command to automatically install and configure all StackStorm components on a single system. It's recommended for getting started quickly. Ensure your system meets the requirements and is a clean installation of Ubuntu or RHEL/RockyLinux/CentOS. ```bash bash <(curl -sSL https://stackstorm.com/packages/install.sh) --user=st2admin --password=Ch@ngeMe ``` -------------------------------- ### Setup StackStorm Stable Repository Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/rhel8.rst Downloads and executes a script to set up the StackStorm stable repository and import its GPG key. This prepares the system for installing StackStorm packages. ```bash curl -s https://packagecloud.io/install/repositories/StackStorm/stable/script.rpm.sh | sudo bash ``` -------------------------------- ### Install and Configure st2chatops for Slack Source: https://context7.com/stackstorm/st2docs/llms.txt Steps to install the st2chatops service and configure it for Slack integration. This involves package installation, environment variable setup for authentication, and service restart. ```bash # Install and configure st2chatops (Slack) sudo apt-get install -y st2chatops # Edit /opt/stackstorm/chatops/st2chatops.env # export HUBOT_ADAPTER=slack # export HUBOT_SLACK_BOT_TOKEN=xoxb-YOUR-BOT-TOKEN # export HUBOT_SLACK_APP_TOKEN=xapp-YOUR-APP-TOKEN sudo service st2chatops restart # In Slack, trigger a StackStorm action: # @hubot deploy myapp to production # @hubot st2 run core.local cmd="uptime" # Register alias st2 action-alias create /opt/stackstorm/packs/mypack/chatops/aliases/deploy.yaml st2 action-alias list ``` -------------------------------- ### Create Example Pack Directory Structure Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/rbac.rst Sets up the directory structure for a new StackStorm pack named 'example'. ```bash cd /opt/stackstorm/packs/ mkdir example mkdir example/actions example/rules example/sensors touch example/pack.yaml touch /opt/stackstorm/configs/example.yaml touch example/requirements.txt cp core/icon.png example/icon.png ``` -------------------------------- ### Install Consul Client Library Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/coordination.rst Install the necessary client library for the Consul coordination backend within the StackStorm virtual environment. This command is an example and may vary for other backends. ```bash sudo su # Example when using consul backend /opt/stackstorm/st2/bin/pip install consul ``` -------------------------------- ### Advanced StackStorm Installation Playbook Example Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/ansible.rst This Ansible playbook demonstrates a more advanced configuration for installing StackStorm with all services on a single node, including customization of st2, st2web, and st2chatops. ```yaml - name: Install StackStorm with all services on a single node hosts: all roles: - mongodb - rabbitmq - nginx - nodejs - name: Install StackStorm Packagecloud repository role: st2repo vars: st2repo_name: stable - name: Install and configure st2 role: st2 vars: st2_version: latest st2_auth_enable: yes st2_auth_username: testu st2_auth_password: testp st2_save_credentials: yes st2_system_user: stanley st2_system_user_in_sudoers: yes # Dict to edit https://github.com/StackStorm/st2/blob/master/conf/st2.conf.sample st2_config: {} - name: Install st2web role: st2web - name: Install st2chatops with "slack" hubot adapter role: st2chatops vars: st2chatops_version: latest st2chatops_st2_api_key: CHANGE-ME-PLEASE # (optional) This can be generated using "st2 apikey create -k" st2chatops_hubot_adapter: slack st2chatops_config: HUBOT_SLACK_TOKEN: xoxb-CHANGE-ME-PLEASE - name: Verify StackStorm Installation role: st2smoketests ``` -------------------------------- ### List and Get Pack Information Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/packs.rst Use these commands to view information about installed packs. 'st2 pack list' shows all installed packs, while 'st2 pack get ' provides detailed information about a specific pack. ```bash # List all installed packs st2 pack list ``` ```bash # Get detailed information about an installed pack st2 pack get core ``` -------------------------------- ### Start st2auth Service Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/authentication.rst Demonstrates various methods to start the st2auth service, including individual and collective starts, and using st2ctl or the launcher for debugging. ```bash sudo service st2auth start ``` ```bash sudo st2ctl start st2auth ``` ```bash sudo st2ctl start ``` ```bash sudo /usr/bin/st2auth --config-file /etc/st2/st2.conf ``` -------------------------------- ### Deploy Example Content Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/start.rst Commands to copy example StackStorm content (rules, sensors, actions) to the correct directory, set permissions, and reload the StackStorm context. This is essential for using provided examples. ```bash sudo cp -r /usr/share/doc/st2/examples/ /opt/stackstorm/packs/ sudo chown -R root:st2packs /opt/stackstorm/packs/examples sudo chmod -R g+w /opt/stackstorm/packs/examples # Run setup st2 run packs.setup_virtualenv packs=examples # Reload stackstorm context st2ctl reload --register-all ``` -------------------------------- ### Install StackStorm Components Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/u22.rst Installs the core StackStorm components using apt-get. ```bash sudo apt-get install -y st2 ``` -------------------------------- ### Install PAM Auth Backend Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/authentication.rst Install the PAM authentication backend using pip. Ensure you are in the correct virtual environment. ```bash sudo /opt/stackstorm/st2/bin/pip install git+https://github.com/StackStorm/st2-auth-backend-pam.git@master#egg=st2_auth_backend_pam ``` -------------------------------- ### Install C# / .NET St2.Client Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/reference/client_libraries.rst Install the .NET client library for StackStorm using the Package Manager Console. ```powershell Install-Package St2.Client ``` -------------------------------- ### Install Pack from Local Directory Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/packs.rst Install a pack that is already present on your local filesystem by providing its directory path prefixed with 'file://'. ```bash # Install a pack from '/home/stanley/bitcoin' dir st2 pack install file:///home/stanley/bitcoin ``` -------------------------------- ### Install MongoDB, RabbitMQ, and Redis Dependencies Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/u22.rst Installs and configures repositories for MongoDB, RabbitMQ, and Redis on Ubuntu 22.04. Ensure these services are enabled and started. ```bash sudo apt-get update sudo apt-get install -y curl export OS_CODENAME=$(source /etc/os-release && echo $VERSION_CODENAME) # Add MongoDB (7.0) repository signing key and apt repository curl -1sLf https://pgp.mongodb.com/server-7.0.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/mongodb-org-7.0.gpg echo "deb http://repo.mongodb.org/apt/ubuntu ${OS_CODENAME}/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list # Add RabbitMQ (3.11), RabbitMQ-erlang (25.3) and RabbitMQ's main signing key and associated repositories curl -1sLf "https://keys.openpgp.org/vks/v1/by-fingerprint/0A9AF2115F4687BD29803A206B73A36E6026DFCA" | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/com.rabbitmq.team.gpg curl -1sLf "https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key" | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/io.cloudsmith.dl.rabbitmq.erlang.gpg curl -1sLf "https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/gpg.9F4587F226208342.key" | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/io.cloudsmith.dl.rabbitmq.gpg sudo tee /etc/apt/sources.list.d/rabbitmq.list < ``` -------------------------------- ### Install StackStorm CLI Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/development/sources.rst Install the StackStorm CLI client by developing the package in place. This command should be run from the st2client directory. ```bash cd ./st2client python3 setup.py develop ``` -------------------------------- ### Example Role Definition Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/rbac.rst This example demonstrates how to define a custom role named 'role_sample' with associated permission grants. Roles are stored in `/opt/stackstorm/rbac/roles/`. ```yaml --- ``` -------------------------------- ### Example Pack Configuration File Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/reference/pack_configs.rst A sample configuration file that matches the schema, including static and dynamic (datastore) values. ```yaml --- api_key: "some_api_key" api_secret: "{{st2kv.user.api_secret}}" # user-scoped configuration value which is also a secret as declared in config schema region: "us-west-1" private_key_path: "{{st2kv.system.private_key_path}}" # global datastore value ``` -------------------------------- ### Action Entrypoint (greet.sh) Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/reference/packs.rst This is the script that the action executes. This example is a simple bash script that echoes a greeting. ```bash #!/bin/bash echo "Hello, ${name}!" ``` -------------------------------- ### Install Packs from StackStorm Exchange Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/chatops/pack_deploy.rst Use this command to install one or more packs from StackStorm Exchange by their names. The bot will confirm the deployment. ```bash !pack install github,slack,trello bot: Installing the requested pack(s) for you. @my_user: > Successful deployment of *github*, *slack*, *trello* packs! ``` -------------------------------- ### Start st2chatops Service Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/u22.rst Starts the st2chatops service. This command is used to ensure the chatops service is running after installation or configuration changes. ```bash sudo service st2chatops start ``` -------------------------------- ### ActionChain Example: echochain_param.yaml Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/actionchain.rst An example ActionChain demonstrating how to pass input parameters and data down the workflow. This illustrates referencing outputs from previous tasks as inputs to subsequent ones. ```yaml --- version: "2.0" action_executions: - name: "c1" ref: "core.local" parameters: cmd: "echo hello {{ input.name }}" publish: stdout: "{{ c1.stdout }}" on-success: - "c2" - name: "c2" ref: "core.local" parameters: cmd: "echo c2 {{c1.stdout}}" publish: stdout: "{{ c2.stdout }}" ``` -------------------------------- ### Install WebUI and Nginx Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/u20.rst Installs the StackStorm WebUI and Nginx web server. Nginx is used for serving static files, SSL termination, and reverse proxying. ```bash # Install st2web and nginx sudo apt-get install -y st2web nginx # Generate self-signed certificate or place your existing certificate under /etc/ssl/st2 sudo mkdir -p /etc/ssl/st2 ``` -------------------------------- ### Execute Action - Start New Trace Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/reference/traces.rst CLI command to execute an action and start a new trace using the '--trace-tag' option. ```bash $ st2 run core.local date --trace-tag TraceDateAction ``` -------------------------------- ### Define an Action (greet.yaml) Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/reference/packs.rst Action metadata defines the action's name, description, parameters, and entry point. This example defines a simple 'greet' action. ```yaml name: greet version: 0.1.0 runner_type: python-script description: "A simple action that greets the user." parameters: name: type: "string" description: "The name to greet." required: true entry_point: "greet.py" ``` -------------------------------- ### Sensor Test Case Example Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/development/pack_testing.rst Example of a sensor test case using BaseSensorTestCase. It shows how to get a sensor instance with configuration and call a sensor method. ```python class MySensorSensorTestCase(BaseSensorTestCase): sensor_cls = MySensor def test_method(self): sensor = self.get_sensor_instance(config={'foo': 'bar'}) sensor.poll() # ... ``` -------------------------------- ### Install Dependencies for Ubuntu 20.04 Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/u20.rst Installs MongoDB, RabbitMQ, and Redis on Ubuntu 20.04. Ensure to update your system's package list before running these commands. ```bash sudo apt-get update sudo apt-get install -y curl export OS_CODENAME=$(source /etc/os-release && echo $VERSION_CODENAME) # Add MongoDB (7.0) repository signing key and apt repository curl -1sLf https://pgp.mongodb.org/server-7.0.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/mongodb-org-7.0.gpg echo "deb http://repo.mongodb.org/apt/ubuntu ${OS_CODENAME}/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list # Add RabbitMQ (3.11), RabbitMQ-erlang (25.3) and RabbitMQ's main signing key and associated repositories curl -1sLf "https://keys.openpgp.org/vks/v1/by-fingerprint/0A9AF2115F4687BD29803A206B73A36E6026DFCA" | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/com.rabbitmq.team.gpg curl -1sLf "https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key" | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/io.cloudsmith.dl.rabbitmq.erlang.gpg curl -1sLf "https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/gpg.9F4587F226208342.key" | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/io.cloudsmith.dl.rabbitmq.gpg sudo tee /etc/apt/sources.list.d/rabbitmq.list <' -t) /opt/stackstorm/st2/bin/st2-self-check ``` -------------------------------- ### ActionChain Example: publish_data.yaml Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/actionchain.rst A complete working example demonstrating the use of 'vars' and 'publish' within an ActionChain. This file shows how to define and utilize variables and publish data for subsequent steps. ```yaml --- version: "2.0" action_executions: - name: "get_service_data" ref: "my_pack.get_services" vars: domain: "{{ st2kv.system.domain }}" port: 9101 publish: url_1: "http://{{ get_service_data.result.0.host.name }}.{{ domain }}:{{ port }}" action_executions: - name: "get_service_data_with_vars" ref: "my_pack.get_services" vars: domain: "{{ st2kv.system.domain }}" port: 9101 publish: url_1: "http://{{ get_service_data_with_vars.result.0.host.name }}.{{ domain }}:{{ port }}" action_executions: - name: "get_service_data_with_vars_and_publish" ref: "my_pack.get_services" vars: domain: "{{ st2kv.system.domain }}" port: 9101 publish: url_1: "http://{{ get_service_data_with_vars_and_publish.result.0.host.name }}.{{ domain }}:{{ port }}" ``` -------------------------------- ### Setup Virtual Environment for Pack Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/troubleshooting/sensors.rst Create a virtual environment for a specific sensor's pack if it does not already exist. This is crucial for sensor operation. ```bash st2 run packs.setup_virtualenv packs= ``` -------------------------------- ### Interact with StackStorm REST API using curl Source: https://context7.com/stackstorm/st2docs/llms.txt Examples of using curl to interact with the StackStorm REST API for common operations like listing actions, getting specific actions, executing actions, and polling their status. Requires authentication via X-Auth-Token. ```bash # Discover the API (use --debug to see underlying calls) st2 --debug action list 2>&1 | grep curl ``` ```bash # List all actions curl -H "X-Auth-Token: ${ST2_AUTH_TOKEN}" \ https://myhost.example.com/api/v1/actions ``` ```bash # Get a specific action curl -H "X-Auth-Token: ${ST2_AUTH_TOKEN}" \ https://myhost.example.com/api/v1/actions/core.local ``` ```bash # Execute an action curl -X POST \ -H "X-Auth-Token: ${ST2_AUTH_TOKEN}" \ -H "Content-Type: application/json" \ https://myhost.example.com/api/v1/executions \ --data '{"action": "core.local", "parameters": {"cmd": "date"}}' ``` ```bash # Poll execution status curl -H "X-Auth-Token: ${ST2_AUTH_TOKEN}" \ https://myhost.example.com/api/v1/executions/58de117e49d4af083399181c ``` ```bash # Clone an action via API (v3.7+) curl -X POST \ -H "X-Auth-Token: ${ST2_AUTH_TOKEN}" \ -H "Content-Type: application/json" \ https://myhost.example.com/api/v1/actions/mypack.old_action/clone \ --data '{"dest_pack": "mypack", "dest_action": "new_action", "overwrite": false}' ``` ```bash # Delete action and files curl -X DELETE \ -H "X-Auth-Token: ${ST2_AUTH_TOKEN}" \ -H "Content-Type: application/json" \ https://myhost.example.com/api/v1/actions/mypack.old_action \ --data '{"remove_files": true}' ``` -------------------------------- ### Install StackStorm with Puppet Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/puppet.rst Installs the stackstorm-st2 module and its dependencies, then performs a full StackStorm installation using default settings. Ensure you change the default credentials after installation. ```bash puppet module install stackstorm-st2 puppet apply -e "include ::st2::profile::fullinstall" ``` -------------------------------- ### Install Pack Skipping Dependencies Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/packs.rst Use the --skip-dependencies flag with 'st2 pack install' to forcibly install a pack without installing its dependencies. This is useful for custom packs or when managing dependencies manually. ```bash st2 pack install --skip-dependencies my-custom-pack ``` -------------------------------- ### Configure PAM Auth Backend Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/authentication.rst Sample configuration for the PAM authentication backend in st2.conf. Ensure SSL is configured if required. ```ini [auth] mode = standalone backend = pam enable = True use_ssl = True cert = /path/to/ssl/cert/file key = /path/to/ssl/key/file logging = /etc/st2/logging.auth.conf api_url = https://myhost.examples.com/api/ debug = False ``` -------------------------------- ### Install StackStorm Pack via Puppet Manifest Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/puppet.rst Installs a StackStorm pack from the exchange, from a Git URL, or installs a pack and applies configuration. Use the `st2::pack` defined type for manifest-based installation. ```puppet # install pack from the exchange st2::pack { 'linux': } # install pack from a git URL st2::pack { 'private': repo_url => 'https://private.domain.tld/git/stackstorm-private.git', } # install pack and apply configuration st2::pack { 'slack': config => { 'post_message_action' => { 'webhook_url' => 'XXX', }, }, } ``` -------------------------------- ### Install Custom Runner Package Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/upgrade_notes.rst Install a custom runner by installing its Python package into the StackStorm virtual environment and then registering the runners. ```bash /opt/stackstorm/st2/bin/pip install "git+https://github.com/stackstorm/st2.git#egg=stackstorm-runner-cloudslang&subdirectory=contrib/runners/cloudslang_runner" ``` ```bash sudo st2ctl reload --register-runners ``` -------------------------------- ### Install StackStorm Components Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/rhel8.rst Installs the core StackStorm packages using yum. This command installs the main StackStorm components onto the system. ```bash sudo yum install -y st2 ``` -------------------------------- ### Configure RabbitMQ and Redis Repositories Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/rhel9.rst Add the necessary repositories for installing Erlang, RabbitMQ server, and Redis. ```bash curl -sL https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash curl -sL https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | sudo bash sudo yum makecache -y --disablerepo='*' --enablerepo='rabbitmq_rabbitmq-server' ``` -------------------------------- ### Install Deprecated Windows Runner (winexe) Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/upgrade_notes.rst The winexe-based Windows runner is deprecated but can be installed from its git repository. This command installs the runner into the StackStorm environment. ```bash /opt/stackstorm/st2/bin/pip install "git+https://github.com/StackStorm/stackstorm-runner-windows.git#egg=stackstorm-runner-windows" ``` -------------------------------- ### Install Deprecated CloudSlang Runner Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/upgrade_notes.rst CloudSlang runner has been deprecated but can still be installed from its git repository if needed. This command installs the runner into the StackStorm environment. ```bash /opt/stackstorm/st2/bin/pip install "git+https://github.com/StackStorm/stackstorm-runner-cloudslang.git#egg=stackstorm-runner-cloudslang" ``` -------------------------------- ### Live Preview of StackStorm Docs Locally (Linux) Source: https://github.com/stackstorm/st2docs/blob/master/README.md Builds the StackStorm documentation and serves it live at http://localhost:8000 for local validation. ```bash make livedocs ``` -------------------------------- ### Configure Proxy Settings for Install Script Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/index.rst If you are installing StackStorm behind a proxy, export the necessary environment variables before running the installation script. This ensures the script can access external resources. ```bash export http_proxy=http://proxy.server.io:port export https_proxy=http://proxy.server.io:port export no_proxy=localhost,127.0.0.1 ``` -------------------------------- ### Install Pack from Private GitHub Repo (HTTPS) Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/packs.rst Install a pack from a private GitHub repository using HTTPS authentication with a personal access token. Be aware that the token will be logged. ```bash st2 pack install https://:@github.com/username/repo.git ``` -------------------------------- ### Install st2 with Proxy Environment Variables Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/ansible.rst Use this Ansible task to install st2 while specifying proxy settings via environment variables. This is useful when installing from behind a corporate proxy. ```yaml --- - name: Install st2 hosts: all environment: http_proxy: http://proxy.example.net:8080 https_proxy: http://proxy.example.net:8080 no_proxy: 127.0.0.1,localhost roles: - st2 ``` -------------------------------- ### Install Pack by Copying (Bash) Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/reference/packs.rst This method involves manually copying the pack directory to the StackStorm packs directory and then reloading the service. Use this if you have specific needs or are not using Git. ```bash mv ./hello_st2 /opt/stackstorm/packs st2ctl reload ``` -------------------------------- ### Install st2chatops Package Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/rhel9.rst Installs the st2chatops package, which provides the StackStorm ChatOps integration. ```bash sudo yum install -y st2chatops ``` -------------------------------- ### JSON Payload Example Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/rules.rst An example of a JSON payload structure that can be used with rule criteria. ```json { "data": { "latitude": { "value": 43 } "longitude": { "value": -95 } } } ``` -------------------------------- ### Create TLS Certificate Key File Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/upgrade_notes.rst Migrate from separate SSL key and certificate files to a single TLS certificate key file for database configuration. ```bash cat path/to/ssl_keyfile path/to/ssl_certfile > path/to/tls_certificate_key_file ``` -------------------------------- ### Run StackStorm Docs with Sphinx-autobuild (Linux/Mac) Source: https://github.com/stackstorm/st2docs/blob/master/README.md Sets up a virtual environment and uses sphinx-autobuild to serve the StackStorm documentation live at http://localhost:8000, enabling live updates for edits. Ignores initial build failure. ```bash git clone git@github.com:StackStorm/st2docs.git cd st2docs make docs # make docs will fail; ignore the failure: # it will get st2 and set up virtualenv with sphinx/shinx-autobuild . virtualenv/bin/activate sphinx-autobuild -H 0.0.0.0 -b html ./docs/source/ ./docs/build/html ``` -------------------------------- ### Example Action Parameters with Key-Value Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/chatops/aliases.rst Illustrates how extra key-value parameters provided in a ChatOps command are parsed and passed to the underlying StackStorm action. ```yaml parameters: cmd: date hosts: localhost timeout: 120 ``` -------------------------------- ### Verify StackStorm Installation Commands Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/common/verify.rst Run these commands to verify your StackStorm installation. They should all complete successfully. ```bash st2 --version ``` ```bash st2 -h ``` ```bash # List the actions from a 'core' pack st2 action list --pack=core ``` ```bash # Run a local shell command st2 run core.local -- date -R ``` ```bash # See the execution results st2 execution list ``` ```bash # Fire a remote comand via SSH (Requires passwordless SSH) st2 run core.remote hosts='localhost' -- uname -a ``` ```bash # Install a pack st2 pack install st2 ``` -------------------------------- ### Run All Project Tests Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/development/testing.rst Execute all tests within the project. This command sets up a virtual environment and installs dependencies before running tests. ```bash make pytests ``` -------------------------------- ### Install python3-devel with Temporary Repository Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/upgrades.rst Install python3-devel on RHEL/CentOS 7 by enabling an optional repository temporarily. ```bash sudo yum install python3-devel --enablerepo ``` -------------------------------- ### Install StackStorm Dependencies Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/rhel9.rst Install essential dependencies including crudini, Erlang, RabbitMQ, Redis, and MongoDB. ```bash sudo yum -y install crudini erlang-* rabbitmq-server redis mongodb-org ``` -------------------------------- ### HA Configuration Sample Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/reference/ha.rst Sample configuration file for high availability. Adjust database, messaging, and coordination settings as needed. ```ini [DEFAULT] # ... other configurations ... [database] # db_host = 127.0.0.1 # db_port = 27017 # db_name = st2 # db_username = st2 # db_password = YOUR_DB_PASSWORD [messaging] # host = 127.0.0.1 # port = 5672 # username = guest # password = guest [coordination] # host = 127.0.0.1 # port = 2181 # backend = zookeeper # ... other configurations ... ``` -------------------------------- ### Install Hubot Yammer Adapter Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/chatops/chatops.rst Install the 'hubot-yammer' adapter in the '/opt/stackstorm/chatops' directory to connect StackStorm to Yammer. ```bash cd /opt/stackstorm/chatops sudo npm install hubot-yammer ``` -------------------------------- ### Use API Key with curl Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/authentication.rst Examples demonstrating how to use API keys with curl to authenticate API requests, showing both header and query parameter methods. ```bash $ curl -H "St2-Api-Key: " https://myhost.example.com/api/v1/actions ``` ```bash $ curl https://myhost.example.com/api/v1/actions?st2-api-key= ``` -------------------------------- ### Install StackStorm Components on Blueprint Box Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/reference/ha.rst Installs all StackStorm components on the blueprint nodes after adding the stable repository. ```bash $ sudo apt-get install -y st2 ``` -------------------------------- ### Setup SSH System User and Sudo Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/common/configure_ssh_and_sudo.rst Configure the 'stanley' user with SSH keys and passwordless sudo for local testing of SSH-based actions. ```bash sudo useradd stanley sudo mkdir -p /home/stanley/.ssh sudo chmod 0700 /home/stanley/.ssh # Generate ssh keys sudo ssh-keygen -f /home/stanley/.ssh/stanley_rsa -P "" # Authorize key-based access sudo sh -c 'cat /home/stanley/.ssh/stanley_rsa.pub >> /home/stanley/.ssh/authorized_keys' sudo chown -R stanley:stanley /home/stanley/.ssh # Enable passwordless sudo sudo sh -c 'echo "stanley ALL=(ALL) NOPASSWD: SETENV: ALL" >> /etc/sudoers.d/st2' sudo chmod 0440 /etc/sudoers.d/st2 # Make sure `Defaults requiretty` is disabled in `/etc/sudoers` sudo sed -i -r "s/^Defaults\s+\+?requiretty/# Defaults +requiretty/g" /etc/sudoers ```