### 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 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 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 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 ``` -------------------------------- ### Get Information About an Installed Pack Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/chatops/pack_deploy.rst Retrieve metadata and Git information for an installed pack. If the pack is not installed but available, the bot will offer to install it. ```bash !pack get ``` -------------------------------- ### 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 < 'https://private.domain.tld/git/stackstorm-private.git', } # install pack and apply configuration st2::pack { 'slack': config => { 'post_message_action' => { 'webhook_url' => 'XXX', }, }, } ``` -------------------------------- ### Install Python st2client Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/reference/client_libraries.rst Use pip to install the official Python client library for StackStorm. ```bash pip install st2client ``` -------------------------------- ### Install Packs from Mixed Sources Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/chatops/pack_deploy.rst Combine installing packs from StackStorm Exchange and GitHub repositories in a single command. ```bash !pack install github,slack,trello,https://github.com/stackstorm/openstack ``` -------------------------------- ### 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 ``` -------------------------------- ### Enable and Start Services on Ubuntu 20.04 Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/u20.rst Enables and starts the MongoDB, Redis, and RabbitMQ services. This is typically required for StackStorm to function correctly. ```bash sudo systemctl enable mongod redis-server rabbitmq-server sudo systemctl start mongod redis-server rabbitmq-server ``` -------------------------------- ### 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 Nginx on Blueprint Box Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/reference/ha.rst Installs the Nginx web server on the blueprint nodes, which will be used for load balancing and serving st2web. ```bash $ sudo apt-get install -y nginx ``` -------------------------------- ### Install Core Dependencies on Controller Box Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/reference/ha.rst Installs MongoDB, RabbitMQ, and Redis server packages on Ubuntu 18.04. Ensure these services are running and accessible. ```bash $ sudo apt-get install -y mongodb-server rabbitmq-server redis-server ``` -------------------------------- ### 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 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 ``` -------------------------------- ### 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! ``` -------------------------------- ### 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 ``` -------------------------------- ### 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 ``` -------------------------------- ### Install Samba Client on RHEL/RockyLinux/CentOS Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/install/config/windows_runners.rst Installs the Samba client package on RHEL, RockyLinux, and CentOS systems, which is a prerequisite for Windows runners. ```bash sudo yum install samba-client ``` -------------------------------- ### Role Definition Example (YAML) Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/rbac.rst Example of a role definition in YAML format, illustrating how permissions are assigned to roles. ```yaml --- name: "role_five" permissions: - resource_type: "action" resource_id: "action:dummy_pack_1:my_action_1" permissions: ["execute"] - resource_type: "action" resource_id: "action:dummy_pack_1:my_action_2" permissions: ["execute"] ``` ```yaml --- name: "role_six" permissions: - resource_type: "action" resource_id: "action:dummy_pack_1:my_action_1" permissions: ["execute"] - resource_type: "action" resource_id: "action:dummy_pack_1:my_action_2" permissions: ["execute"] ``` -------------------------------- ### 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 < /etc/yum.repos.d/nginx.repo [nginx] name=nginx repo baseurl=http://nginx.org/packages/rhel/\$releasever/x86_64/ gpgcheck=1 enabled=1 EOT" sudo sed -i 's/^\(enabled=1\)$/exclude=nginx\n\1/g' /etc/yum.repos.d/epel.repo sudo yum install -y nginx sudo yum install -y st2web sudo mkdir -p /etc/ssl/st2 sudo openssl req -x509 -newkey rsa:2048 -keyout /etc/ssl/st2/st2.key -out /etc/ssl/st2/st2.crt \ -days 365 -nodes -subj "/C=US/ST=California/L=Palo Alto/O=StackStorm/OU=Information \ Technology/CN=$(hostname)" sudo cp /usr/share/doc/st2/conf/nginx/st2.conf /etc/nginx/conf.d/ sudo sed -i 's/default_server//g' /etc/nginx/nginx.conf sudo systemctl restart nginx sudo systemctl enable nginx ``` -------------------------------- ### Run StackStorm Self-Check Script Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/troubleshooting/self_verification.rst Execute the self-check script after setting up encryption keys. This command also installs and registers example packs, potentially downloading fixtures from st2tests. ```bash sudo ST2_AUTH_TOKEN=$(st2 auth st2admin -p '' -t) /opt/stackstorm/st2/bin/st2-self-check ``` -------------------------------- ### 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 StackStorm Web UI Dependencies Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/development/sources.rst Install Node.js, npm, and essential global packages like n, gulp-cli, lerna, and yarn for building the StackStorm Web UI. ```bash sudo apt install npm sudo npm install -g n sudo n v10.15.3 sudo npm install -g gulp-cli lerna yarn ``` -------------------------------- ### 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 ``` -------------------------------- ### Sensor Implementation (sensor1.py) Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/reference/packs.rst The Python script for the sensor. This example publishes a custom event periodically. ```python from st2reactor.sensor.base import TriggerAwareSensor class SampleSensor(TriggerAwareSensor): def setup(self): self.sensor_name = self.sensor_name.replace(".", "_") self.logger.info('Sensor setup for %s', self.sensor_name) def run(self, **kwargs): self.logger.info('Sensor is running...') self.publish_trigger(payload={'message': 'Hello from sensor1!'}) def stop(self): self.logger.info('Sensor stopped.') ``` -------------------------------- ### 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 ``` -------------------------------- ### 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 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 ``` -------------------------------- ### 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 ``` -------------------------------- ### 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 ``` -------------------------------- ### 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= ``` -------------------------------- ### Build and Run StackStorm Docs with Docker Source: https://github.com/stackstorm/st2docs/blob/master/README.md Builds a Docker image for StackStorm documentation and runs it in a container, serving the docs live at http://localhost:8000 with live updates. ```bash make docker-build make docker-run ``` -------------------------------- ### List All Traces Source: https://github.com/stackstorm/st2docs/blob/master/docs/source/reference/traces.rst CLI command to list all traces present in the system. ```bash $ st2 trace list ```