diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index aa66f4f3..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,135 +0,0 @@ -# -defaults: &defaults - working_directory: /build - docker: - - image: docker:18.06.0-ce-git - -version: 2 -jobs: - nightly-build: - <<: *defaults - steps: - - checkout - - setup_remote_docker: - docker_layer_caching: true - - run: - name: Install bash - command: apk add --no-cache bash coreutils - - run: - name: Build image - command: bin/build.sh - environment: - BUILD_DEV: true - - run: - name: Save image - command: bin/save.sh - environment: - BUILD_DEV: true - - persist_to_workspace: - root: /workspace - paths: - - tar - nightly-deploy: - <<: *defaults - steps: - - checkout - - attach_workspace: - at: /workspace - - setup_remote_docker: - docker_layer_caching: true - - run: - name: Install bash - command: apk add --no-cache bash coreutils - - run: - name: Load image - command: bin/load.sh - - run: - name: Deploy image to Docker Hub - command: | - docker login --username ${DOCKER_USERNAME} --password ${DOCKER_PASSWORD} - bin/deploy.sh - environment: - BUILD_DEV: true - build: - <<: *defaults - steps: - - checkout - - setup_remote_docker: - docker_layer_caching: true - - run: - name: Install bash - command: apk add --no-cache bash coreutils - - run: - name: Build image - command: bin/build.sh - - run: - name: Save image - command: bin/save.sh - - persist_to_workspace: - root: /workspace - paths: - - tar - deploy: - <<: *defaults - steps: - - attach_workspace: - at: /workspace - - checkout - - setup_remote_docker: - docker_layer_caching: true - - run: - name: Install bash - command: apk add --no-cache bash coreutils - - run: - name: Load image from workspace - command: bin/load.sh - - run: - name: Deploy image to Docker Hub - command: | - docker login --username ${DOCKER_USERNAME} --password ${DOCKER_PASSWORD} - bin/deploy.sh - -workflows: - version: 2 - nightly-workflow: - triggers: - - schedule: - cron: "0 9 * * *" - filters: - branches: - only: - - master - jobs: - - nightly-build: - filters: - tags: - only: - - /.*/ - - nightly-deploy: - requires: - - nightly-build - filters: - branches: - only: - - master - tags: - only: - - /^v.*/ - commit-workflow: - jobs: - - build: - filters: - tags: - only: - - /.*/ - - deploy: - requires: - - build - filters: - branches: - only: - - master - - feature/circleci - tags: - only: - - /^v.*/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 635bbc55..00000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -dist: trusty -sudo: required - -language: python - -branches: - only: - - master - -services: - - docker - -before_install: - - docker build --build-arg ST2_REPO=unstable --build-arg CIRCLE_SHA1=${TRAVIS_COMMIT} --build-arg CIRCLE_PROJECT_USERNAME=stackstorm --build-arg CIRCLE_PROJECT_REPONAME=st2-docker -t stackstorm/stackstorm:dev images/stackstorm - - docker login -u ${DOCKER_USER} -p ${DOCKER_PASSWORD} - - docker push stackstorm/stackstorm:dev - -install: true - -script: true - -notifications: - email: - recipients: - - warren.van.winckel@gmail.com - on_success: never - on_failure: always diff --git a/CHANGELOG.rst b/CHANGELOG.rst deleted file mode 100644 index 0c5eac66..00000000 --- a/CHANGELOG.rst +++ /dev/null @@ -1,34 +0,0 @@ -Changelog -========= - -2018-06-28 ----------- - -Changed -~~~~~~~ - -* Add ``st2workflowengine`` to ``entrypoint-1ppc.sh`` and ``compose-1ppc/docker-compose.yml``. - -2018-06-18 ----------- - -Changed -~~~~~~~ - -* The ``TAG`` environment variable is replaced by ``ST2_IMAGE_TAG``. - -2018-02-27 ----------- - -Changed -~~~~~~~ - -* Pin DB's to specific, tested versions. - -2017-10-23 ----------- - -Changed -~~~~~~~ - -* Rename ``/entrypoint.d/`` to ``/st2-docker/entrypoint.d/``. diff --git a/Makefile b/Makefile deleted file mode 100644 index 18d2f423..00000000 --- a/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -SHA := $(shell git describe --match=NeVeRmAtCh --always --abbrev=40 --dirty=*) - -build: - docker build --build-arg CIRCLE_SHA1="$(SHA)" -t stackstorm/stackstorm:latest images/stackstorm - -dev-build: - docker build --build-arg ST2_REPO=unstable --build-arg CIRCLE_SHA1="$(SHA)" -t stackstorm/stackstorm:local-dev images/stackstorm - -env: - bin/write-env.sh conf - -up: - docker-compose up -d - -down: - docker-compose down - -rmi: - docker rmi $$(docker images -f dangling=true -q) - -exec: - docker-compose exec stackstorm /bin/bash diff --git a/README.md b/README.md deleted file mode 100644 index b13c73da..00000000 --- a/README.md +++ /dev/null @@ -1,259 +0,0 @@ -# StackStorm in all-in-one Docker container - -> **DEPRECATED!** -> -> This all-in-one Docker demo deployment wasn't supported for a long time and is deprecated. -> Latest StackStorm release that supported all-in-one docker was `v3.1.0` based on outdated `Ubuntu Trusty` with `python 2`. - -[![Circle CI Build Status](https://circleci.com/gh/StackStorm/st2-docker/tree/master.svg?style=shield)](https://circleci.com/gh/StackStorm/st2-docker) -[![Go to Docker Hub](https://img.shields.io/badge/Docker%20Hub-%E2%86%92-blue.svg)](https://hub.docker.com/r/stackstorm/stackstorm/) - - -## READ FIRST!! - -- **Check the [CHANGELOG.rst](https://github.com/StackStorm/st2-docker/blob/master/CHANGELOG.rst)** - file for any potential changes that may require restarting containers. -- Be sure to use the latest `docker-compose.yml`. Run `git pull` in your `st2-docker` workspace! -- Run `st2ctl reload --register-all` to reload all services. -- **For information on how the stackstorm docker image is versioned, see - [VERSIONING.md](https://github.com/StackStorm/st2-docker/blob/master/VERSIONING.md)**. -- If a specific image version is required, it is always best to be explicit and specify the image - digest. See the example of setting `ST2_IMAGE_TAG` environment variable [below](#EnvVars). -- Kubernetes installation is available via Helm charts at https://docs.stackstorm.com/install/k8s_ha.html - and provides High Availability deployment for both StackStorm Community and Enterprise editions. - - -## TL;DR - -``` -git clone git@github.com:stackstorm/st2-docker -cd st2-docker -make env -docker-compose up -d -docker-compose exec stackstorm bash -``` - -Open `https://localhost` in your browser. StackStorm Username/Password can be found in: `cat conf/stackstorm.env` - - -## Usage - -### Prerequisites - -- Docker Engine 1.13.0+ - - -### Container configuration - -The default container configuration is as follows: - - - stackstorm (st2 + st2web + st2mistral) - - mongo - - rabbitmq - - postgres - - redis - - -### Step by step instructions - -We use Version 3 of the compose file format, so if you want to run docker-compose, you'll need to -ensure you're running Docker Engine release 1.13.0+. - -First, execute - - ``` - make env - ``` - -to create the environment files used by `docker-compose`. You may want to change the values of the -variables as necessary, but the defaults should be okay if you are not using any off-cluster -services (e.g. mongo, redis, postgres, rabbitmq). - -NOTE: `make env` only needs to be run once. - -As an example, if you want to change the username and password used by StackStorm, change the -`ST2_USER` and `ST2_PASSWORD` variables in `conf/stackstorm.env` prior to bringing up your docker -environment. - -Second, start the docker environment. execute - - ``` - docker-compose up -d - ``` - -This will pull the required images from docker hub, and then start them. - -To stop the docker environment, run: - - ``` - docker-compose down - ``` - -## Building the stackstorm image - -The pre-built `stackstorm/stackstorm` image may not meet your requirements. You may need to install -additional libraries, packages or files into the image. For example, if you want to install the -Ansible pack, you must first install the `libkrb5-dev` package. While the package could be installed -using a script in `/st2-docker/entrypoint.d`, this will increase the startup time of the container -and may result in containers that execute different code than others. - -Make any necessary changes to `images/stackstorm/Dockerfile`. For example, append `libkrb5-dev` to -the first `apt-get install` command. Next, run: - - ``` - REPO=stable - docker build --build-arg ST2_REPO=${REPO} -t stackstorm/stackstorm:${REPO} images/stackstorm - ``` - -where REPO is one of 'stable', 'unstable', 'staging-stable', 'staging-unstable'. Otherwise, -the following `docker-compose` command will download the specified image from docker hub. - - -### Getting started: Simple Tutorial Tour - -After you spin up the environment, you can play around with st2 *in container-ized environment* by following [this tutorial guide](./docs/tutorial.md). - - -## Data persistence - -It's designed to suffice the ordinary use case by default. If you need to customize it, check below and modify `docker-compose.yml` - -- The mongo, rabbitmq, postgres and redis containers store their data on persistent storage -- The stackstorm container persists the contents in following directories - - `/var/log` - - `/opt/stackstorm/packs` - - `/opt/stackstorm/virtualenvs` - - `/opt/stackstorm/configs` - -Since data directories may persist between invocations of `docker-compose`, you may see the following error: - -``` -2018-02-21 16:36:21.453 UTC [1] FATAL: database files are incompatible with server -2018-02-21 16:36:21.453 UTC [1] DETAIL: The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.2 (Debian 10.2-1.pgdg90+1). -``` - -In `docker-compose.yml`, pin the postgres version to `9.6` and you will not see the error again. - -``` -- image: postgres:latest -+ image: postgres:9.6 -``` - -## Environment variables - -Below is the complete list of available options that can be used to customize your container. - -| Parameter | Description | -|-----------|-------------| -| `ST2_USER` | StackStorm account username | -| `ST2_PASSWORD` | StackStorm account password | -| `MONGO_HOST` | MongoDB server hostname | -| `MONGO_PORT` | MongoDB server port (typically `27017`) | -| `MONGO_DB` | *(Optional)* MongoDB dbname (will use `st2` if not specified) | -| `MONGO_USER` | *(Optional)* MongoDB username (will connect without credentials if this and `MONGO_PASS` are not specified) | -| `MONGO_PASS` | *(Optional)* MongoDB password | -| `RABBITMQ_HOST` | RabbitMQ server hostname | -| `RABBITMQ_PORT` | RabbitMQ server port (typically `5672`) | -| `RABBITMQ_DEFAULT_USER` | RabbitMQ username | -| `RABBITMQ_DEFAULT_PASS` | RabbitMQ password | -| `POSTGRES_HOST` | PostgreSQL server hostname | -| `POSTGRES_PORT` | PostgreSQL server port (typically `5432`) | -| `POSTGRES_DB` | PostgreSQL database | -| `POSTGRES_USER` | PostgreSQL username | -| `POSTGRES_PASSWORD` | PostgreSQL password | -| `REDIS_HOST` | Redis server hostname | -| `REDIS_PORT` | Redis server port | -| `REDIS_PASSWORD` | *(Optional)* Redis password | - -Also, you can export an additional variable to control which StackStorm version to run by specifying -the exact Docker image tag: - - ``` - export ST2_IMAGE_TAG="2.7.1@sha256:4920fd479c907149d9a062c939f158291f0f641fcd1730d9dd2df2696cad2dae" - docker-compose up -d - ``` - -## Running custom shell scripts on boot - -The `stackstorm` container supports running arbitrary shell scripts when the container launches: - -* Scripts located in `/st2-docker/entrypoint.d` are executed before the init process starts any -stackstorm services. -* Scripts located in `/st2-docker/st2.d` are executed after stackstorm services are running. - -NOTE: Only scripts with a suffix of `.sh` will be executed, and in alphabetical order of the file -name. - -### /st2-docker/entrypoint.d - -For example, if you want to modify `/etc/st2/st2.conf` to set `system_packs_base_path` parameter, -create `modify-st2-config.sh` with the follwing content: - - ``` - #/bin/bash - crudini --set /etc/st2/st2.conf content system_packs_base_path /opt/stackstorm/custom_packs - ``` - -Then bind mount it to `/st2-docker/entrypoint.d/modify-st2-config.sh` - -- via `docker run` - - ``` - docker run -it -d --privileged \ - -v /path/to/modify-st2-config.sh:/st2-docker/entrypoint.d/modify-st2-config.sh \ - stackstorm/stackstorm:latest - ``` - -- via `docker-compose.yml` - - ``` - services: - stackstorm: - image: stackstorm/stackstorm:${ST2_IMAGE_TAG:-latest} - : (snip) - volumes: - - /path/to/modify-st2-config.sh:/st2-docker/entrypoint.d/modify-st2-config.sh - ``` - -The above example shows just modifying st2 config but basically there is no limitation so you can -do almost anything. - -You can also bind mount a specific directory to `/st2-docker/entrypoint.d` then place scripts as -much as you want. - -### /st2-docker/st2.d - -Scripts in this directory can be used to register packs, reload or restart services, etc. -You can bind mount these scripts as mentioned in the previous section. - -NOTE: These scripts are currently not available when running in 1ppc mode. - - -## To enable chatops - -Chatops is installed in the `stackstorm` image, but not started by default. - -To enable chatops, delete the file `/etc/init/st2chatops.override` using a script in -`/st2-docker/entrypoint.d`. - - ``` - #!/bin/bash - - sudo rm /etc/init/st2chatops.override - ``` - -You also need to configure st2chatops, replace `/opt/stackstorm/chatops/st2chatops.env` with one -that is properly configured. The easiest way is to use bind-mount. - -See [st2chatops.env](https://github.com/StackStorm/st2chatops/blob/master/st2chatops.env) for the required variables. - -## packs.dev directory - -By default, `./packs.dev` directory is bind-mounted to `/opt/stackstorm/packs.dev` in `stackstorm` container and registered as a secondary pack location. This is done by the startup script at [./runtime/entrypoint.d/add-packs-dev.sh](./runtime/entrypoint.d/add-packs-dev.sh) - -This feature exists just for convenience, for testing and developing packs, and for [tutorial](./docs/tutorial.md). You can use it for arbitrary purpose, or ignore, or even disable it completely by removing corresponding entries and files. -Refer to the official StackStorm document for the list of available configuration parameters for `st2chatops`. - -## Advanced: using 1ppc image - -Official image now supports running in 1ppc mode: stands for *One Process Per Container*. Interested? Check [runtime/compose-1ppc](./runtime/compose-1ppc) diff --git a/VERSIONING.md b/VERSIONING.md deleted file mode 100644 index a7676a42..00000000 --- a/VERSIONING.md +++ /dev/null @@ -1,16 +0,0 @@ -# StackStorm Docker Image Versioning - -See https://github.com/StackStorm/st2-docker/issues/78 for more information. - -| Image:Tag | StackStorm Version | Description | -|-----------|--------------------|-------------| -| stackstorm:dev | 2.7dev | Latest 2.7dev, and most recent st2-docker changes from the st2-docker `master` branch. | -| stackstorm:latest | 2.6.0 (latest stable version of Stackstorm) | Changes merged to st2-docker `master` branch will result in a new image being deployed tagged 'latest'. | -| stackstorm:2.6 | 2.6.0 | Mutable. This tag is updated when there is a new 2.6.x release. | -| stackstorm:2.6.0 | 2.6.0 | Immutable, even if changes merged to st2-docker `master` branch | -| stackstorm:2.5 | 2.5.1 | Mutable. This tag is updated when there is a new 2.5.x release. | -| stackstorm:2.5.1 | 2.5.1 | Immutable, even if changes merged to st2-docker `master` branch | -| stackstorm:2.5.0 | 2.5.0 | Immutable, even if changes merged to st2-docker `master` branch | -| stackstorm:2.4 | 2.4.1 | Mutable. This tag is updated when there is a new 2.4.x release. | -| stackstorm:2.4.1 | 2.4.1 | Immutable, even if changes merged to st2-docker `master` branch | -| stackstorm:2.4.0 | 2.4.0 | Immutable, even if changes merged to st2-docker `master` branch | diff --git a/bin/build.sh b/bin/build.sh deleted file mode 100755 index 5eb9ffbb..00000000 --- a/bin/build.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# -# This script runs within the CircleCI environment to build stackstorm images. - -set -euo pipefail -IDS=$'\n\t' - -source bin/common.sh - -for name in stackstorm; do - if [ ! -z ${BUILD_DEV} ]; then - # Triggered to run nightly via ops-infra - # Build unstable, and tag as "dev". - - ${dry_run} docker build --no-cache --build-arg ST2_REPO=unstable --build-arg CIRCLE_SHA1=${CIRCLE_SHA1} \ - --build-arg CIRCLE_PROJECT_USERNAME=${CIRCLE_PROJECT_USERNAME:-} \ - --build-arg CIRCLE_PROJECT_REPONAME=${CIRCLE_PROJECT_REPONAME:-} \ - --build-arg CIRCLE_BUILD_URL=${CIRCLE_BUILD_URL:-} \ - -t stackstorm/${name}:dev images/${name} - - continue - fi - - # From this point on, not a dev build... - - name_tag="${name}:${tag}" - - # Build the ${name_tag} image using Dockerfile in images/${name} - ${dry_run} docker build --no-cache --build-arg ST2_TAG=${st2_tag} --build-arg CIRCLE_SHA1=${CIRCLE_SHA1} \ - --build-arg CIRCLE_PROJECT_USERNAME=${CIRCLE_PROJECT_USERNAME:-} \ - --build-arg CIRCLE_PROJECT_REPONAME=${CIRCLE_PROJECT_REPONAME:-} \ - --build-arg CIRCLE_BUILD_URL=${CIRCLE_BUILD_URL:-} \ - -t stackstorm/${name_tag} images/${name} -done diff --git a/bin/common.sh b/bin/common.sh deleted file mode 100644 index baffad46..00000000 --- a/bin/common.sh +++ /dev/null @@ -1,76 +0,0 @@ -# The following variables will be set for use by the calling script - -# latest - the highest version tagged in the repo (beginning with "v") -# st2_tag - the MAJOR.MINOR.PATCH version of st2 installed in the image -# short_tag - MAJOR.MINOR from ${st2_tag} -# latest_short - contains the highest version beginning with ${short_tag} -# tagged_build - true if build was tagged, else false -# tag - tag image with this value (if tagged_build st2_tag else latest) - -# Set debug to 'echo' to test -dry_run='' -if [ ${DRY_RUN:-} ]; then - dry_run='echo' - echo "Dry run mode enabled..." - sleep 2 -fi - -WORKSPACE=/workspace/tar -echo WORKSPACE=${WORKSPACE} - -CIRCLE_SHA1=${CIRCLE_SHA1:-} -echo CIRCLE_SHA1=${CIRCLE_SHA1} - -if [ -z ${CIRCLE_SHA1} ]; then - echo "ERROR: CIRCLE_SHA1 is not defined." - echo "To resolve, run:" - echo " $ export CIRCLE_SHA1=" - echo " $ $0" - exit 1 -fi - -CIRCLE_TAG=${CIRCLE_TAG:-} -echo CIRCLE_TAG=${CIRCLE_TAG} - -BUILD_DEV=${BUILD_DEV:-} -echo BUILD_DEV=${BUILD_DEV} - -# Get the highest tag prefixed with 'v' -# NOTE: We remove the 'v' prefix before returning -latest=`git tag -l "v*" | sort -rV | head -1 | cut -c 2-` - -if [ ! -z ${CIRCLE_TAG} ]; then - if [[ ${CIRCLE_TAG} =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+).*$ ]]; then - CIRCLE_TAG_MAJOR=${BASH_REMATCH[1]} - CIRCLE_TAG_MINOR=${BASH_REMATCH[2]} - CIRCLE_TAG_PATCH=${BASH_REMATCH[3]} - else - echo "ERROR: CIRCLE_TAG must begin with format 'vMAJOR.MINOR.PATCH'" - exit 1 - fi -fi - -short_tag='' - -if [[ ${CIRCLE_TAG} =~ ^v(.+)$ ]]; then - # A tag was pushed, so we'll build an image using this specific release. - tagged_build=true - st2_tag=${BASH_REMATCH[1]} - tag=${st2_tag} - short_tag="${CIRCLE_TAG_MAJOR}.${CIRCLE_TAG_MINOR}" - latest_short=`git tag -l "v${short_tag}*" | sort -rV | head -1 | cut -c 2-` - echo latest_short=${latest_short} -else - # NOTE: A valid version tag was not pushed - # Build and tag an image using the highest StackStorm release - tagged_build=false - tag='latest' - st2_tag=${latest} -fi - -# These variables are available in calling scripts -echo latest=${latest} -echo short_tag=${short_tag} -echo st2_tag=${st2_tag} -echo tag=${tag} -echo tagged_build=${tagged_build} diff --git a/bin/deploy.sh b/bin/deploy.sh deleted file mode 100755 index e4098ad4..00000000 --- a/bin/deploy.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# -# This script runs within the CircleCI environment to deploy st2-docker images -# to Docker Hub. - -set -euo pipefail -IDS=$'\n\t' - -source bin/common.sh - -for name in stackstorm; do - if [ ! -z ${BUILD_DEV} ]; then - # Build unstable, and tag as "dev". - - # TODO: Potentially useful to prepend "dev" with revision of latest unstable - # release (e.g. "2.4dev") - ${dry_run} docker push stackstorm/${name}:dev - continue - fi - - # From this point on, not a dev build... - name_tag="${name}:${tag}" - - if ${tagged_build}; then - # gatekeeper.sh returns 'allow' on STDOUT if the images can be pushed - if [ `bin/gatekeeper.sh ${name} ${tag}` != 'allow' ]; then - echo "${name_tag} already exists on docker hub.. not pushing again!" - exit 1 - fi - fi - - ${dry_run} docker push stackstorm/${name}:${tag} - - if ${tagged_build}; then - if [ "${st2_tag}" == "${latest_short}" ]; then - ${dry_run} docker tag stackstorm/${name_tag} stackstorm/${name}:${short_tag} - ${dry_run} docker push stackstorm/${name}:${short_tag} - fi - - if [ "${st2_tag}" == "${latest}" ]; then - ${dry_run} docker tag stackstorm/${name_tag} stackstorm/${name}:latest - ${dry_run} docker push stackstorm/${name}:latest - fi - fi -done diff --git a/bin/gatekeeper.sh b/bin/gatekeeper.sh deleted file mode 100755 index c0e8c016..00000000 --- a/bin/gatekeeper.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -set -euo pipefail -IDS=$'\n\t' - -if [ $# -lt 2 ]; then - echo "Usage: $0 " - exit 1 -fi - -name=$1 -tag=$2 - -if [ ${tag} == 'latest' ]; then - echo 'allow' - exit 0 -fi - -wget -q https://registry.hub.docker.com/v1/repositories/stackstorm/${name}/tags -O - \ - | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n' | awk -F: '{print $3}' | grep ${tag} \ - || echo 'allow' diff --git a/bin/load.sh b/bin/load.sh deleted file mode 100755 index 00ba08ba..00000000 --- a/bin/load.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# -# This script runs within the CircleCI environment to build stackstorm images. - -set -euo pipefail -IDS=$'\n\t' - -source bin/common.sh - -for name in stackstorm; do - # Load the tarball (tags are automatically loaded) - ${dry_run} docker load -i ${WORKSPACE}/${name}.tar -done diff --git a/bin/save.sh b/bin/save.sh deleted file mode 100755 index e27e99ea..00000000 --- a/bin/save.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# -# This script runs within the CircleCI environment to build stackstorm images. - -set -euo pipefail -IDS=$'\n\t' - -source bin/common.sh - -${dry_run} mkdir -p ${WORKSPACE} - -for name in stackstorm; do - if [ ! -z ${BUILD_DEV} ]; then - ${dry_run} docker save -o ${WORKSPACE}/${name}.tar stackstorm/${name}:dev - - continue - fi - - # From this point on, not a dev build... - - name_tag="${name}:${tag}" - - # Save the image ${name} using tag ${tag} - tags="stackstorm/${name_tag}" - - ${dry_run} docker save -o ${WORKSPACE}/${name}.tar ${tags} -done diff --git a/bin/write-env.sh b/bin/write-env.sh deleted file mode 100755 index aca8906f..00000000 --- a/bin/write-env.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -# Create env files in the specified directory - -CONF_DIR=${1:-conf} - -# Create a random password of length specified by $1 -function randpwd() -{ - echo $(openssl rand -base64 $1 | tr '/' 'A') -} - -mkdir -p ${CONF_DIR} - -if [ ! -f ${CONF_DIR}/mongo.env ]; then - echo "MONGO_HOST=${MONGO_HOST:-mongo}" > ${CONF_DIR}/mongo.env - echo "MONGO_PORT=${MONGO_PORT:-27017}" >> ${CONF_DIR}/mongo.env - if [ -z ${MONGO_DB} ]; then - echo "#MONGO_DB=" >> ${CONF_DIR}/mongo.env - else - echo "MONGO_DB=${MONGO_DB}" >> ${CONF_DIR}/mongo.env - fi - if [ -z ${MONGO_USER} ]; then - echo "#MONGO_USER=" >> ${CONF_DIR}/mongo.env - else - echo "MONGO_USER=${MONGO_USER}" >> ${CONF_DIR}/mongo.env - fi - if [ -z ${MONGO_PASS} ]; then - echo "#MONGO_PASS=" >> ${CONF_DIR}/mongo.env - else - echo "MONGO_PASS=${MONGO_PASS}" >> ${CONF_DIR}/mongo.env - fi -fi -if [ ! -f ${CONF_DIR}/postgres.env ]; then - echo "POSTGRES_USER=${POSTGRES_USER:-mistral-user}" > ${CONF_DIR}/postgres.env - echo "POSTGRES_PASSWORD=${POSTGRES_PASS:-$(randpwd 18)}" >> ${CONF_DIR}/postgres.env - echo "POSTGRES_HOST=${POSTGRES_HOST:-postgres}" >> ${CONF_DIR}/postgres.env - echo "POSTGRES_PORT=${POSTGRES_PORT:-5432}" >> ${CONF_DIR}/postgres.env - echo "POSTGRES_DB=${POSTGRES_DB:-mistral}" >> ${CONF_DIR}/postgres.env -fi -if [ ! -f ${CONF_DIR}/rabbitmq.env ]; then - echo "RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER:-admin}" > ${CONF_DIR}/rabbitmq.env - echo "RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS:-$(randpwd 18)}" >> ${CONF_DIR}/rabbitmq.env - echo "RABBITMQ_HOST=${RABBITMQ_HOST:-rabbitmq}" >> ${CONF_DIR}/rabbitmq.env - echo "RABBITMQ_PORT=${RABBITMQ_PORT:-5672}" >> ${CONF_DIR}/rabbitmq.env -fi -if [ ! -f ${CONF_DIR}/redis.env ]; then - echo "REDIS_PASSWORD=${REDIS_PASSWORD:-$(randpwd 18)}" > ${CONF_DIR}/redis.env - echo "REDIS_HOST=${REDIS_HOST:-redis}" >> ${CONF_DIR}/redis.env - echo "REDIS_PORT=${REDIS_PORT:-6379}" >> ${CONF_DIR}/redis.env -fi -if [ ! -f ${CONF_DIR}/stackstorm.env ]; then - echo "ST2_USER=${ST2_USER:-st2admin}" > ${CONF_DIR}/stackstorm.env - echo "ST2_PASSWORD=${ST2_PASSWORD:-$(randpwd 6)}" >> ${CONF_DIR}/stackstorm.env -fi diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 33bb9ab2..00000000 --- a/docker-compose.yml +++ /dev/null @@ -1,95 +0,0 @@ -version: '3' - -services: - stackstorm: - image: stackstorm/stackstorm:${ST2_IMAGE_TAG:-latest} - env_file: - - conf/stackstorm.env - - conf/mongo.env - - conf/rabbitmq.env - - conf/postgres.env - - conf/redis.env - ports: - - "443:443" - depends_on: - - mongo - - postgres - - rabbitmq - - redis - networks: - - public - - private - volumes: - - stackstorm-packs-volume:/opt/stackstorm/packs - - stackstorm-virtualenvs-volume:/opt/stackstorm/virtualenvs - - stackstorm-configs-volume:/opt/stackstorm/configs - - stackstorm-log-volume:/var/log - - ./packs.dev:/opt/stackstorm/packs.dev - - ./runtime/entrypoint.d:/st2-docker/entrypoint.d - - ./runtime/st2.d:/st2-docker/st2.d - - ./conf/stackstorm.env:/st2-docker/env - dns_search: . - -### External Services - - mongo: - image: mongo:3.4 - env_file: - - conf/mongo.env - networks: - - private - volumes: - - mongo-volume:/data/db - - mongo-configdb-volume:/data/configdb - dns_search: . - rabbitmq: - image: rabbitmq:3.6-management - env_file: - - conf/rabbitmq.env - networks: - - private - volumes: - - rabbitmq-volume:/var/lib/rabbitmq - dns_search: . - postgres: - image: postgres:9.6 - env_file: - - conf/postgres.env - networks: - - private - volumes: - - postgres-volume:/var/lib/postgresql/data - dns_search: . - redis: - image: redis:4.0 - env_file: - - conf/redis.env - networks: - - private - volumes: - - redis-volume:/data - dns_search: . - command: [ - "bash", "-c", - ' - docker-entrypoint.sh - --requirepass "$$REDIS_PASSWORD" - ' - ] - -volumes: - mongo-volume: - mongo-configdb-volume: - postgres-volume: - rabbitmq-volume: - redis-volume: - stackstorm-packs-volume: - stackstorm-virtualenvs-volume: - stackstorm-configs-volume: - stackstorm-log-volume: - -networks: - public: - driver: bridge - private: - driver: bridge diff --git a/docs/tutorial.md b/docs/tutorial.md deleted file mode 100644 index 031c6551..00000000 --- a/docs/tutorial.md +++ /dev/null @@ -1,283 +0,0 @@ -# Simple Tutorial Tour - -## Adding a simple action - -We will add a simple action that runs a local shell command. -Run the following from your docker host. - -``` -sudo chown $USERNAME:$USERNAME packs.dev -mkdir -p packs.dev/tutorial/actions -sudo chown -R $USERNAME:$USERNAME packs.dev -cp tutorial/actions/hello.yaml packs.dev/tutorial/actions -``` - -Get a bash shell in the `stackstorm` container: - - ``` - docker-compose exec stackstorm /bin/bash - ``` - -Load the new action into StackStorm. Whenever you change the yaml file, you need -to run `st2ctl reload`. Within the container, run the following: - - ``` - root@aff39eda0bdd:/# st2ctl reload --register-all - - ... output trimmed ... - - ``` - -Now, let's run the action: - - ``` - root@aff39eda0bdd:/# st2 run tutorial.hello - . - id: 58f67dbf33a99300bdc4d618 - status: succeeded - parameters: None - result: - failed: false - return_code: 0 - stderr: '' - stdout: Hello human! - succeeded: true - ``` - -The action takes a single parameter `name`, which as we can see above, -defaults to 'human' if `name` is not specified. If we specify a value for -`name`, then as expected, the value is found in `result.stdout`. - - ``` - root@aff39eda0bdd:/# st2 run tutorial.hello name=Stanley - . - id: 58f67dc533a99300bdc4d61b - status: succeeded - parameters: - name: Stanley - result: - failed: false - return_code: 0 - stderr: '' - stdout: Hello Stanley! - succeeded: true - ``` - -Congratulations, you have created your first simple action! - -### A Slight Variation: Concurrency - -If you want to take advantage of concurrency, use a slight variation on the above. -On the host, run: - -``` -mkdir -p packs.dev/tutorial/policies -cp tutorial/actions/hello-concurrency.yaml packs.dev/tutorial/actions -cp tutorial/policies/hello-concurrency.yaml packs.dev/tutorial/policies -``` - -Inside the `stackstorm` container, run: - -``` -st2ctl reload --register-all -``` - -Open two terminals to the `stackstorm` container. In the first, type (but don't execute): - -``` -st2 run tutorial.hello-concurrency name=1 -``` - -In the second, type: - -``` -st2 run tutorial.hello-concurrency name=2 -``` - -Now, execute the command in the first terminal, wait 5 seconds and then execute the command in the -second terminal. After a second or so, you should see the following in the second terminal: - -``` -root@258b11849aa7:/# st2 run examples.hello-concurrency name=2 -. -id: 590cec228964ad01567f61e3 -status: delayed -parameters: - name: 2 -result: None -``` - -If you run `st2 execution list` before 10 seconds have elapsed, the status of the second action should -be "delayed". Between 10 and 20 seconds, the status of the second action should be "running". After -20 seconds, the status of the second action should be "succeeded". - -``` -root@ffc8bc7909c6:/# st2 execution list -+--------------------------+----------------------------+--------------+-------------------------+-------------------------------+-------------------------------+ -| id | action.ref | context.user | status | start_timestamp | end_timestamp | -+--------------------------+----------------------------+--------------+-------------------------+-------------------------------+-------------------------------+ - : -(snip) - : -| 5a366f07a1d7aa00ecfd3cef | tutorial.hello-concurrency | st2admin | succeeded (11s elapsed) | Sun, 17 Dec 2017 13:20:07 UTC | Sun, 17 Dec 2017 13:20:18 UTC | -| 5a366f0aa1d7aa00ecfd3cf2 | tutorial.hello-concurrency | st2admin | succeeded (18s elapsed) | Sun, 17 Dec 2017 13:20:10 UTC | Sun, 17 Dec 2017 13:20:28 UTC | -+--------------------------+----------------------------+--------------+-------------------------+-------------------------------+-------------------------------+ - -``` - -## Adding a rule - -To perform a very basic end-to-end test of StackStorm, let's create a simple rule. -Run the following from your docker host. - - ``` - mkdir packs.dev/tutorial/rules - cp tutorial/rules/monitor_file.yaml packs.dev/tutorial/rules - ``` - -Take a look at `monitor_file.yaml`. The `core.local` action is triggered when the -contents of `/tmp/watcher.log` change. - -Use `docker-compose exec` to connect to the `stackstorm` container: - - ``` - docker-compose exec stackstorm /bin/bash - ``` - -Run the following: - - ``` - st2ctl reload - ``` - -When we append to `/tmp/watcher.log`, the sensor will inject a trigger and the -action will be executed. Now let's append a line to the file in the container. - -``` -echo "hello" >> /tmp/watcher.log -``` - -You should see that the action was fired: - - ``` - root@ffc8bc7909c6:/# st2 execution list - +--------------------------+----------------------------+--------------+-------------------------+-------------------------------+-------------------------------+ - | id | action.ref | context.user | status | start_timestamp | end_timestamp | - +--------------------------+----------------------------+--------------+-------------------------+-------------------------------+-------------------------------+ - : - (snip) - : - | 5a36702fa1d7aa00373b785c | core.local | stanley | succeeded (0s elapsed) | Sun, 17 Dec 2017 13:25:03 UTC | Sun, 17 Dec 2017 13:25:03 UTC | - +--------------------------+----------------------------+--------------+-------------------------+-------------------------------+-------------------------------+ - root@ffc8bc7909c6:/# st2 execution get 5a36702fa1d7aa00373b785c - id: 5a36702fa1d7aa00373b785c - status: succeeded (0s elapsed) - parameters: - cmd: 'echo "{''file_name'': ''watcher.log'', ''line'': u''hello'', ''file_path'': ''/tmp/watcher.log''}"' - result: - failed: false - return_code: 0 - stderr: '' - stdout: '{''file_name'': ''watcher.log'', ''line'': u''hello'', ''file_path'': ''/tmp/watcher.log''}' - succeeded: true - ``` - -Congratulations, you have created your first rule! - -## Adding a python action - -As an example of how to create a new action, let's add a new action called `echo_action`. - -First, on the host, we create the metadata file `./packs.dev/tutorial/actions/my_echo_action.yaml`: - -```yaml ---- -name: "echo_action" -runner_type: "python-script" -description: "Print message to standard output." -enabled: true -entry_point: "my_echo_action.py" -parameters: - message: - type: "string" - description: "Message to print." - required: true - position: 0 -``` - -Then, add the action script at `./packs.dev/tutorial/actions/my_echo_action.py`. - -```python -import sys - -from st2common.runners.base_action import Action - -class MyEchoAction(Action): - def run(self, message): - print(message) - - if message == 'working': - return (True, message) - return (False, message) -``` - -When you rename, or create a new action, you must run `st2ctl reload` inside the `st2` -container. Next, to initialize the virtualenv, run: - -``` -st2 run packs.setup_virtualenv packs=tutorial -``` - -Then you can run your action using the following: - -``` -st2 run tutorial.echo_action message=working -``` - -You should see output similar to: - -``` -. -id: 58c0abcff4aa45009f42dca3 -status: succeeded -parameters: - message: working -result: - exit_code: 0 - result: working - stderr: '' - stdout: 'working - - ' -``` - -Congratulations! You have successfully added your first action! - -## Adding a simple mistral workflow - -To add a simple mistral workflow, run the following from your docker host. - - ``` - mkdir -p packs.dev/tutorial/actions/workflows - cp -R tutorial/actions/mistral-basic.yaml packs.dev/tutorial/actions/mistral-basic.yaml - cp -R tutorial/actions/workflows/mistral-basic.yaml packs.dev/tutorial/actions/workflows/mistral-basic.yaml - ``` - -Use `docker-compose exec` to connect to the `stackstorm` container: - - ``` - docker-compose exec stackstorm /bin/bash - ``` - -Within the container, run the following: - - ``` - st2 action create /opt/stackstorm/packs.dev/tutorial/actions/mistral-basic.yaml - st2 run examples.mistral-basic cmd=date -a - ``` - -The `st2 run` command should complete successfully. Please see -[mistral documentation](https://docs.stackstorm.com/mistral.html#basic-workflow) -for more details about this basic workflow. - -Congratulations, you have created your first mistral workflow! diff --git a/images/stackstorm/Dockerfile b/images/stackstorm/Dockerfile deleted file mode 100644 index f49a15a7..00000000 --- a/images/stackstorm/Dockerfile +++ /dev/null @@ -1,144 +0,0 @@ -FROM ubuntu:trusty - -# let Upstart know it's in a container -ENV container docker - -COPY config/init-fake.conf /etc/init/fake-container-events.conf - -# uuid-runtime is required, otherwise the last test in 'test_quickstart_key.yaml' fails -RUN DEBIAN_FRONTEND=noninteractive \ - apt-get update \ - && apt-get install -y \ - openssh-server \ - sudo \ - curl \ - gdebi-core \ - sshpass \ - cron \ - netcat \ - net-tools \ - crudini \ - uuid-runtime \ - apache2-utils \ - bash-completion - -# enable bash-completion -RUN dpkg-divert /etc/bash.bashrc && \ - sed -i '/^# enable bash completion/,/^# sudo hint/{//p;//d;s/^#//}' /etc/bash.bashrc - -RUN echo -e "#!/bin/sh\nexit 101\n" > /usr/sbin/policy-rc.d \ - && rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl \ - && locale-gen en_US.UTF-8 - -ENV LANG=en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 - -# remove some pointless services -RUN /usr/sbin/update-rc.d -f ondemand remove; \ - for f in \ - /etc/init/u*.conf \ - /etc/init/mounted-dev.conf \ - /etc/init/mounted-proc.conf \ - /etc/init/mounted-run.conf \ - /etc/init/mounted-tmp.conf \ - /etc/init/mounted-var.conf \ - /etc/init/hostname.conf \ - /etc/init/networking.conf \ - /etc/init/tty*.conf \ - /etc/init/plymouth*.conf \ - /etc/init/hwclock*.conf \ - /etc/init/module*.conf\ - ; do \ - dpkg-divert --local --rename --add "$f"; \ - done; \ - echo '# /lib/init/fstab: cleared out for bare-bones Docker' > /lib/init/fstab - -# Default value of ST2_REPO is "stable" -ARG ST2_REPO=stable - -# Configure system so that the "stable" ST2 packages -# are fetched from packagecloud.io -RUN curl -s https://packagecloud.io/install/repositories/StackStorm/${ST2_REPO}/script.deb.sh | sudo bash - -# The following variable is the most recent commit in -# the st2-docker repo used to fetch this Dockerfile. -ARG CIRCLE_SHA1 -ARG CIRCLE_BUILD_URL -ARG CIRCLE_PROJECT_USERNAME -ARG CIRCLE_PROJECT_REPONAME - -# Override these values if you want to specify different package versions -ARG ST2_TAG -ARG ST2_VERSION -ARG ST2WEB_VERSION -ARG ST2MISTRAL_VERSION - -COPY bin/install.sh /install.sh - -# It is not possible to dynamically set ARG's, so we do the needful in bin/install.sh -# Install st2, st2web, st2mistral and st2chatops -RUN /install.sh - -# Unless these lines are changed, the services are not started when runlevel -> 2 -# Call mistral-db-manage before mistral starts -RUN sed -i 's/start on filesystem and net-device-up IFACE!=lo/start on runlevel \[2345\]/' /etc/init/st2*.conf \ - && sed -i 's/stop on starting rc RUNLEVEL=\[016\]/stop on runlevel \[!2345\]/' /etc/init/st2*.conf \ - && sed -i 's/start on filesystem and net-device-up IFACE!=lo/start on runlevel \[2345\]/' /etc/init/mistral.conf \ - && sed -i 's/stop on starting rc RUNLEVEL=\[016\]/stop on runlevel \[!2345\]/' /etc/init/mistral.conf \ - && sed -i '/start mistral-api/i\ /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head\n\ - /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf populate\n' /etc/init/mistral.conf - -# Setup symmetric crypto key for datastore -RUN mkdir -p /etc/st2/keys \ - && st2-generate-symmetric-crypto-key --key-path /etc/st2/keys/datastore_key.json \ - && usermod -a -G st2 st2 && chgrp st2 /etc/st2/keys && chmod o-r /etc/st2/keys \ - && chgrp st2 /etc/st2/keys/datastore_key.json && chmod o-r /etc/st2/keys/datastore_key.json \ - && crudini --set /etc/st2/st2.conf keyvalue encryption_key_path /etc/st2/keys/datastore_key.json \ - && crudini --set /etc/st2/st2.conf auth enable True - -# Install redis client library for coordination backend -# see: https://docs.stackstorm.com/latest/reference/policies.html -RUN bash -c 'source /opt/stackstorm/st2/bin/activate && pip install redis' - -# Setup SSH and SUDO access for stanley user -RUN mkdir -p /home/stanley/.ssh && chmod 0700 /home/stanley/.ssh \ - && ssh-keygen -f /home/stanley/.ssh/stanley_rsa -P "" \ - && cat /home/stanley/.ssh/stanley_rsa.pub >> /home/stanley/.ssh/authorized_keys \ - && chown -R stanley:stanley /home/stanley/.ssh \ - && echo "stanley ALL=(ALL) NOPASSWD: SETENV: ALL" >> /etc/sudoers.d/st2 \ - && chmod 0440 /etc/sudoers.d/st2 \ - && sed -i -r "s/^Defaults\s+\+?requiretty/# Defaults +requiretty/g" /etc/sudoers - -# Install and configure nginx -# Use hkp://...:80 explicitly to grab the GPG key for nginx because port 11371 -# is sometimes blocked by firewalls. See: -# https://github.com/StackStorm/st2-docker/issues/135#issuecomment-392186954 -RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys ABF5BD827BD9BF62 \ - && echo "deb http://nginx.org/packages/mainline/ubuntu/ trusty nginx" >> /etc/apt/sources.list \ - && echo "deb-src http://nginx.org/packages/mainline/ubuntu/ trusty nginx" >> /etc/apt/sources.list \ - && apt-get update \ - && apt-get install -y nginx \ - && cp /usr/share/doc/st2/conf/nginx/st2.conf /etc/nginx/conf.d/st2-base.cnf \ - && ( cd /etc/nginx/conf.d && ln -s st2-base.cnf st2.conf ) \ - && mkdir -p /etc/ssl/st2 \ - && mkdir /var/run/sshd \ - && openssl req -x509 -newkey rsa:2048 -keyout /etc/ssl/st2/st2.key -out /etc/ssl/st2/st2.crt -days 3650 -nodes -subj '/O=st2 self signed/CN=localhost' - -EXPOSE 22 443 - -COPY bin/entrypoint.sh /st2-docker/bin/entrypoint.sh -COPY bin/st2.sh /st2-docker/bin/st2.sh -COPY config/local.conf /etc/init/local.conf - -# 1ppc -RUN wget -O /dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 \ - && chmod +x /dumb-init -COPY bin/entrypoint-1ppc.sh /st2-docker/bin/entrypoint-1ppc.sh -COPY bin/inject_env.py /st2-docker/bin/inject_env.py -COPY config/nginx.st2-1ppc.conf.tpl /etc/nginx/conf.d/st2-1ppc.conf.tpl - -# Default username/password is used unless overridden by supplying ST2_USER and/or ST2_PASSWORD -# environment variables to `docker run` after the name of the image: -# docker run -e ST2_USER... image -ENTRYPOINT ["/st2-docker/bin/entrypoint.sh"] diff --git a/images/stackstorm/bin/entrypoint-1ppc.sh b/images/stackstorm/bin/entrypoint-1ppc.sh deleted file mode 100755 index 759076a4..00000000 --- a/images/stackstorm/bin/entrypoint-1ppc.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/bash - -ST2_CONF=/etc/st2/st2.conf -crudini --set ${ST2_CONF} auth api_url ${ST2_API_URL} -crudini --set ${ST2_CONF} mistral api_url ${ST2_API_URL} -crudini --set ${ST2_CONF} mistral v2_base_url ${ST2_MISTRAL_API_URL} - -# Configure CORS to accept any source -# st2api gunicorn process is directly exposed to clients in 1ppc mode -crudini --set ${ST2_CONF} api allow_origin '*' - -# Generate nginx config for st2web to support load balancing to st2api, st2auth and st2stream -/st2-docker/bin/inject_env.py \ - < /etc/nginx/conf.d/st2-1ppc.conf.tpl \ - > /etc/nginx/conf.d/st2.conf - -case "$ST2_SERVICE" in - "nop" ) - exec tail -f /dev/null - ;; - "st2api" ) - DAEMON_ARGS="-k eventlet -b 0.0.0.0:9101 --workers 1 --threads 1 --graceful-timeout 10 --timeout 30" - exec /opt/stackstorm/st2/bin/gunicorn st2api.wsgi:application $DAEMON_ARGS - ;; - "st2auth" ) - DAEMON_ARGS="-k eventlet -b 0.0.0.0:9100 --workers 1 --threads 1 --graceful-timeout 10 --timeout 30" - exec /opt/stackstorm/st2/bin/gunicorn st2auth.wsgi:application $DAEMON_ARGS - ;; - "st2stream" ) - DAEMON_ARGS="-k eventlet -b 0.0.0.0:9102 --workers 1 --threads 10 --graceful-timeout 10 --timeout 30" - exec /opt/stackstorm/st2/bin/gunicorn st2stream.wsgi:application $DAEMON_ARGS - ;; - "st2sensorcontainer" ) - DAEMON_ARGS="--config-file /etc/st2/st2.conf" - exec /opt/stackstorm/st2/bin/st2sensorcontainer ${DAEMON_ARGS} - ;; - "st2rulesengine" ) - DAEMON_ARGS="--config-file /etc/st2/st2.conf" - exec /opt/stackstorm/st2/bin/st2rulesengine ${DAEMON_ARGS} - ;; - "st2timersengine" ) - DAEMON_ARGS="--config-file /etc/st2/st2.conf" - exec /opt/stackstorm/st2/bin/st2timersengine ${DAEMON_ARGS} - ;; - "st2workflowengine" ) - DAEMON_ARGS="--config-file /etc/st2/st2.conf" - exec /opt/stackstorm/st2/bin/st2workflowengine ${DAEMON_ARGS} - ;; - "st2actionrunner" ) - DAEMON_ARGS="--config-file /etc/st2/st2.conf" - exec /opt/stackstorm/st2/bin/st2actionrunner ${DAEMON_ARGS} - ;; - "st2scheduler" ) - DAEMON_ARGS="--config-file /etc/st2/st2.conf" - exec /opt/stackstorm/st2/bin/st2scheduler ${DAEMON_ARGS} - ;; - "st2resultstracker" ) - DAEMON_ARGS="--config-file /etc/st2/st2.conf" - exec /opt/stackstorm/st2/bin/st2resultstracker ${DAEMON_ARGS} - ;; - "st2notifier" ) - DAEMON_ARGS="--config-file /etc/st2/st2.conf" - exec /opt/stackstorm/st2/bin/st2notifier ${DAEMON_ARGS} - ;; - "st2garbagecollector" ) - DAEMON_ARGS="--config-file /etc/st2/st2.conf" - exec /opt/stackstorm/st2/bin/st2garbagecollector ${DAEMON_ARGS} - ;; - "mistral-api" ) - set -e - /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head - /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf populate - API_ARGS="--log-file /var/log/mistral/mistral-api.log -b 0.0.0.0:8989 -w 2 mistral.api.wsgi --graceful-timeout 10" - exec /opt/stackstorm/mistral/bin/gunicorn $API_ARGS - ;; - "mistral-server" ) - set -e - /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head - /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf populate - SERVER_ARGS="--config-file /etc/mistral/mistral.conf --log-file /var/log/mistral/mistral-server.log" - exec /opt/stackstorm/mistral/bin/mistral-server --server engine,executor,notifier ${SERVER_ARGS} - ;; - "st2web" ) - exec /usr/sbin/nginx -g 'daemon off;' - ;; - "st2chatops" ) - set -e - export ST2_API=${ST2_API_URL} - cd /opt/stackstorm/chatops - exec bin/hubot $DAEMON_ARGS - ;; - "st2-register-content" ) - set -ex - PACKS=${PACKS:-"chatops core default linux packs"} - for PACK in ${PACKS}; do - st2-register-content --config-file /etc/st2/st2.conf \ - --register-all \ - --register-setup-virtualenvs \ - --register-pack /opt/stackstorm/packs/${PACK} - done - ;; - -esac diff --git a/images/stackstorm/bin/entrypoint.sh b/images/stackstorm/bin/entrypoint.sh deleted file mode 100755 index 320b2bf9..00000000 --- a/images/stackstorm/bin/entrypoint.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash - -# Create htpasswd file and login to st2 using specified username/password -htpasswd -b /etc/st2/htpasswd ${ST2_USER} ${ST2_PASSWORD} - -mkdir -p /root/.st2 - -ROOT_CONF=/root/.st2/config - -touch ${ROOT_CONF} - -crudini --set ${ROOT_CONF} credentials username ${ST2_USER} -crudini --set ${ROOT_CONF} credentials password ${ST2_PASSWORD} - -ST2_CONF=/etc/st2/st2.conf - -ST2_API_URL=${ST2_API_URL:-http://127.0.0.1:9101} -MISTRAL_BASE_URL=${MISTRAL_BASE_URL:-http://127.0.0.1:8989/v2} - -crudini --set ${ST2_CONF} auth api_url ${ST2_API_URL} -crudini --set ${ST2_CONF} mistral api_url ${ST2_API_URL} -crudini --set ${ST2_CONF} mistral v2_base_url ${MISTRAL_BASE_URL} -crudini --set ${ST2_CONF} messaging url \ - amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@${RABBITMQ_HOST}:${RABBITMQ_PORT} -crudini --set ${ST2_CONF} coordination url \ - redis://:${REDIS_PASSWORD}@${REDIS_HOST}:${REDIS_PORT} -crudini --set ${ST2_CONF} database host ${MONGO_HOST} -crudini --set ${ST2_CONF} database port ${MONGO_PORT} -if [ ! -z ${MONGO_DB} ]; then - crudini --set ${ST2_CONF} database db_name ${MONGO_DB} -fi -if [ ! -z ${MONGO_USER} ]; then - crudini --set ${ST2_CONF} database username ${MONGO_USER} -fi -if [ ! -z ${MONGO_PASS} ]; then - crudini --set ${ST2_CONF} database password ${MONGO_PASS} -fi - -# NOTE: Only certain distros of MongoDB support SSL/TLS -# 1) enterprise versions -# 2) those built from source (https://github.com/mongodb/mongo/wiki/Build-Mongodb-From-Source) -# -#crudini --set ${ST2_CONF} database ssl True -#crudini --set ${ST2_CONF} database ssl_keyfile None -#crudini --set ${ST2_CONF} database ssl_certfile None -#crudini --set ${ST2_CONF} database ssl_cert_reqs None -#crudini --set ${ST2_CONF} database ssl_ca_certs None -#crudini --set ${ST2_CONF} database ssl_match_hostname True - -MISTRAL_CONF=/etc/mistral/mistral.conf - -crudini --set ${MISTRAL_CONF} DEFAULT transport_url \ - rabbit://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@${RABBITMQ_HOST}:${RABBITMQ_PORT} -crudini --set ${MISTRAL_CONF} database connection \ - postgresql+psycopg2://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB} - -# Run custom init scripts -for f in /st2-docker/entrypoint.d/*; do - case "$f" in - *.sh) echo "$0: running $f"; . "$f" ;; - *) echo "$0: ignoring $f" ;; - esac - echo -done - -# 1ppc: launch entrypoint-1ppc.sh via dumb-init if $ST2_SERVICE is set -if [ ! -z ${ST2_SERVICE} ]; then - exec /dumb-init -- /st2-docker/bin/entrypoint-1ppc.sh -fi - -# Ensure the base st2 nginx config is used - -( cd /etc/nginx/conf.d && ln -sf st2-base.cnf st2.conf ) - -exec /sbin/init diff --git a/images/stackstorm/bin/inject_env.py b/images/stackstorm/bin/inject_env.py deleted file mode 100755 index 8c4c47b0..00000000 --- a/images/stackstorm/bin/inject_env.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/opt/stackstorm/st2/bin/python - -""" - jinja2 template converter script - - This script will accept template input from STDIN, then render output to STDOUT - Within a template, you can access environment variables with `env['YOUR_ENVVAR']` - - Usage example: - env HOGE=fuga inject_env.py < template_file > output_file -""" - -import os -import sys -import jinja2 - -def striptrailingslash(value): - """ - custom filter that strips forwarding slashes - """ - return value.strip('/') - -# create jinja environment and add custom filters -environment = jinja2.Environment(loader=None) -environment.filters['striptrailingslash'] = striptrailingslash - -# load template string from STDIN, then render to STDOUT -template = environment.from_string(sys.stdin.read()) -sys.stdout.write(template.render(env=os.environ)) diff --git a/images/stackstorm/bin/install.sh b/images/stackstorm/bin/install.sh deleted file mode 100755 index 8b49b268..00000000 --- a/images/stackstorm/bin/install.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash - -set -euo pipefail -IDS=$'\n\t' - -# apt-cache may not have current package data without apt-get update -apt-get update - -declare -A vers=() -declare -A pkgs=( ["ST2_VERSION"]="st2" \ - ["ST2WEB_VERSION"]="st2web" \ - ["ST2MISTRAL_VERSION"]="st2mistral" \ - ["ST2CHATOPS_VERSION"]="st2chatops" ) - -# Expand keys of pkgs array. -for i in "${!pkgs[@]}" -do - # Save the newest available version of $pkgs[$i] - if [ -z ${!i:-} ]; then - vers["$i"]=$(apt-cache madison ${pkgs["$i"]} | cut -f 2 -d '|' | tr -d '[ \t]' | grep "^${ST2_TAG:-}" | head -1) - else - vers["$i"]=${!i} - fi -done - -# Install st2, st2web, and st2mistral -sudo apt-get install -y st2=${vers['ST2_VERSION']} st2web=${vers['ST2WEB_VERSION']} st2mistral=${vers['ST2MISTRAL_VERSION']} - -# Install st2chatops, but disable unless entrypoint.d file is present -# Using GNU sort's version comparison, this performs a descending sort on -# a two element list containing "2.10" and ${vers['ST2CHATOPS_VERSION']}. -# If the "2.10.0" element is the first element, then install node.js v10. -# Else, install node.js v6. -node_script="setup_6.x" -if [ $(printf "2.10.0\n${vers['ST2CHATOPS_VERSION']}\n" | sort -V | head -n 1) = "2.10.0" ]; then - node_script="setup_10.x" -fi - -curl -sL https://deb.nodesource.com/${node_script} \ - | sudo -E bash - && sudo apt-get install -y st2chatops=${vers['ST2CHATOPS_VERSION']} && echo manual \ - | sudo tee /etc/init/st2chatops.override - -MANIFEST="/st2-manifest.txt" - -echo "Image built at $(date)" > $MANIFEST - -if [[ "${CIRCLE_PROJECT_REPONAME:-}" != "" ]] && [[ "${CIRCLE_PROJECT_USERNAME:-}" != "" ]] && [[ "${CIRCLE_SHA1:-}" != "" ]]; then - echo "GitHub URL: https://github.com/${CIRCLE_PROJECT_USERNAME:-}/${CIRCLE_PROJECT_REPONAME:-}/commit/${CIRCLE_SHA1:-}" >> $MANIFEST -fi -if [[ "${CIRCLE_PROJECT_REPONAME:-}" == "" ]] && [[ "${CIRCLE_PROJECT_USERNAME:-}" == "" ]] && [[ "${CIRCLE_SHA1:-}" != "" ]]; then - echo "Commit SHA: ${CIRCLE_SHA1:-}" >> $MANIFEST -fi -if [[ "${CIRCLE_BUILD_URL:-}" != "" ]]; then - echo "Build URL: ${CIRCLE_BUILD_URL:-}" >> $MANIFEST -fi -if [[ "${ST2_TAG:-}" != "" ]]; then - echo "Tag: ${ST2_TAG:-}" >> $MANIFEST -fi - -echo "" >> $MANIFEST - -echo "Installed versions:" >> $MANIFEST -for i in "${!pkgs[@]}" -do - echo " - ${pkgs[$i]}-${vers[$i]}" >> $MANIFEST -done diff --git a/images/stackstorm/bin/st2.sh b/images/stackstorm/bin/st2.sh deleted file mode 100755 index 3f2492b8..00000000 --- a/images/stackstorm/bin/st2.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -ENV_FILE=/st2-docker/env - -if [ -f ${ENV_FILE} ]; then - source ${ENV_FILE} -fi - -# Run custom init scripts which require ST2 to be running -for f in /st2-docker/st2.d/*; do - case "$f" in - *.sh) echo "$0: running $f"; . "$f" ;; - *) echo "$0: ignoring $f" ;; - esac - echo -done diff --git a/images/stackstorm/bin/test.sh b/images/stackstorm/bin/test.sh deleted file mode 100755 index 2a968f49..00000000 --- a/images/stackstorm/bin/test.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -eux - -# Run Integration Tests via Inspec Infra testing framework -# https://www.inspec.io - -echo -e '\033[33mRunning Inspec Integration Tests ...\033[0m' -cd /st2-docker/test/integration -for dir in */; do - dir=$(basename $dir) - if [ -f "${dir}/inspec.yml" ]; then - echo -e "\nRunning tests for \033[1;36m${dir}\033[0m ..." - sudo inspec exec --show-progress ${dir} - fi -done diff --git a/images/stackstorm/config/init-fake.conf b/images/stackstorm/config/init-fake.conf deleted file mode 100644 index 46c39c99..00000000 --- a/images/stackstorm/config/init-fake.conf +++ /dev/null @@ -1,13 +0,0 @@ -# fake some events needed for correct startup other services - -description "In-Container Upstart Fake Events" - -start on startup - -script - rm -rf /var/run/*.pid - rm -rf /var/run/network/* - /sbin/initctl emit stopped JOB=udevtrigger --no-wait - /sbin/initctl emit started JOB=udev --no-wait - /sbin/initctl emit runlevel RUNLEVEL=3 --no-wait -end script diff --git a/images/stackstorm/config/local.conf b/images/stackstorm/config/local.conf deleted file mode 100644 index 0ad081ef..00000000 --- a/images/stackstorm/config/local.conf +++ /dev/null @@ -1,9 +0,0 @@ -description "Post ST2 API start scripts" -author "StackStorm" - -start on started st2api -stop on shutdown - -script -/st2-docker/bin/st2.sh -end script diff --git a/images/stackstorm/config/nginx.st2-1ppc.conf.tpl b/images/stackstorm/config/nginx.st2-1ppc.conf.tpl deleted file mode 100644 index e5cea707..00000000 --- a/images/stackstorm/config/nginx.st2-1ppc.conf.tpl +++ /dev/null @@ -1,151 +0,0 @@ -# -# nginx configuration to expose st2 webui, redirect HTTP->HTTPS, -# provide SSL termination, and reverse-proxy st2api and st2auth API endpoint. -# To enable: -# cp ${LOCATION}/st2.conf /etc/nginx/sites-available -# ln -l /etc/nginx/sites-available/st2.conf /etc/nginx/sites-enabled/st2.conf -# see https://docs.stackstorm.com/install.html for details - -server { - listen *:80 default_server; - - add_header Front-End-Https on; - add_header X-Content-Type-Options nosniff; - - if ($ssl_protocol = "") { - return 301 https://$host$request_uri; - } - - index index.html; - - access_log /var/log/nginx/st2webui.access.log combined; - error_log /var/log/nginx/st2webui.error.log; -} - -server { - listen *:443 ssl; - - ssl on; - - ssl_certificate /etc/ssl/st2/st2.crt; - ssl_certificate_key /etc/ssl/st2/st2.key; - ssl_session_cache shared:SSL:10m; - ssl_session_timeout 5m; - ssl_protocols TLSv1 TLSv1.1 TLSv1.2; - ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:ECDHE-RSA-AES128-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA128:DHE-RSA-AES128-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA128:ECDHE-RSA-AES128-SHA384:ECDHE-RSA-AES128-SHA128:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:AES128-GCM-SHA384:AES128-GCM-SHA128:AES128-SHA128:AES128-SHA128:AES128-SHA:AES128-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4; - ssl_prefer_server_ciphers on; - - index index.html; - - access_log /var/log/nginx/ssl-st2webui.access.log combined; - error_log /var/log/nginx/ssl-st2webui.error.log; - - add_header Front-End-Https on; - add_header X-Content-Type-Options nosniff; - - resolver {{ env['ST2WEB_DNS_RESOLVER'] | default('127.0.0.1') }} valid=10s ipv6=off; - - location @apiError { - add_header Content-Type application/json always; - return 503 '{ "faultstring": "Nginx is unable to reach st2api. Make sure service is running." }'; - } - - location /api/ { - error_page 502 = @apiError; - - set $st2_api_url {{ env['ST2_API_URL'] | striptrailingslash }}; - - rewrite ^/api/(.*) /$1 break; - - proxy_pass $st2_api_url$uri$is_args$args; - proxy_read_timeout 90; - proxy_connect_timeout 90; - proxy_redirect off; - - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - - proxy_set_header Connection ''; - chunked_transfer_encoding off; - proxy_buffering off; - proxy_cache off; - proxy_set_header Host $host; - } - - location @streamError { - add_header Content-Type text/event-stream; - return 200 "retry: 1000\n\n"; - } - - # For backward compatibility reasons, rewrite requests from "/api/stream" - # to "/stream/v1/stream" and "/api/v1/stream" to "/stream/v1/stream" - location /api/stream { - rewrite ^/api/stream/?(.*)$ /stream/v1/stream/$1 last; - } - location /api/v1/stream { - rewrite ^/api/v1/stream/?(.*)$ /stream/v1/stream/$1 last; - } - location /stream/ { - error_page 502 = @streamError; - - set $st2_stream_url {{ env['ST2_STREAM_URL'] | striptrailingslash }}; - - rewrite ^/stream/(.*) /$1 break; - - proxy_pass $st2_stream_url$uri$is_args$args; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - - sendfile on; - tcp_nopush on; - tcp_nodelay on; - - # Disable buffering and chunked encoding. - # In the stream case we want to receive the whole payload at once, we don't - # want multiple chunks. - proxy_set_header Connection ''; - chunked_transfer_encoding off; - proxy_buffering off; - proxy_cache off; - } - - location @authError { - add_header Content-Type application/json always; - return 503 '{ "faultstring": "Nginx is unable to reach st2auth. Make sure service is running." }'; - } - - location /auth/ { - error_page 502 = @authError; - - set $st2_auth_url {{ env['ST2_AUTH_URL'] | striptrailingslash }}; - - rewrite ^/auth/(.*) /$1 break; - - proxy_pass $st2_auth_url$uri$is_args$args; - proxy_read_timeout 90; - proxy_connect_timeout 90; - proxy_redirect off; - - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_pass_header Authorization; - - proxy_set_header Connection ''; - chunked_transfer_encoding off; - proxy_buffering off; - proxy_cache off; - proxy_set_header Host $host; - } - - location / { - root /opt/stackstorm/static/webui/; - index index.html; - - sendfile on; - tcp_nopush on; - tcp_nodelay on; - } -} diff --git a/runtime/compose-1ppc/.gitignore b/runtime/compose-1ppc/.gitignore deleted file mode 100644 index c9a5c234..00000000 --- a/runtime/compose-1ppc/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/conf diff --git a/runtime/compose-1ppc/README.md b/runtime/compose-1ppc/README.md deleted file mode 100644 index e7a206b7..00000000 --- a/runtime/compose-1ppc/README.md +++ /dev/null @@ -1,119 +0,0 @@ -# StackStorm 1ppc: One Process Per Container - -**What's this?** - -StackStorm Docker image that runs one st2 service per container. - -**Why we need this?** - -> Each container should have only one concern - -*Quote from [Best practices for writing Dockerfiles](https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/)* - -## Getting started - -A sample `docker-compose.yml` file is located under `runtime/compose-1ppc` directory. -Follow the instruction below to setup a running StackStorm instance which consists of -containers that each are running individual st2 service. - -1. Generate .env files - -``` -(cd ../../ && make env) -cp -r ../../conf . -``` - -2. Start containers - -``` -docker-compose up -d -``` - -Now you can access StackStorm Web UI. - -3. Register initial content - -``` -docker-compose exec st2actionrunner \ - st2-register-content --config-file /etc/st2/st2.conf \ - --register-all --register-setup-virtualenvs -``` - -Note: `/opt/stackstorm/virtualenvs` directory needs to be mounted as a shared volume on -the container that you run the above command. - -4. Run simple action - -``` -docker-compose exec st2client st2 run core.local cmd=date -``` - -5. Install examples - -``` -docker-compose exec st2client st2 pack install https://github.com/shusugmt/st2-pack-examples -``` - -6. Run mistral example - -``` -docker-compose exec st2client st2 run examples.mistral_examples -``` - -**FAQ** - -- Q: Fails to run mistral actions -- A: Restart `mistrap-api` or `mistral-server` container once by `docker-compose up -d --force-recreate mistral-api` - - This is caused by the conflict of `mistral-db-manage` command being invoked by both `mistral-api` and - `mistral-server`. When you first run `docker-compose up -d` the command runs in both containers almost at the - same time and simply fails to load the required content into database. Restarting one of them will re-run - the command again and populate postgres with a proper data. -- Q: I can login to the Web UI but when I click any link, I'm redirected back to login page -- A: Check you docker host clock - -### Scaling out - -``` -docker-compose up --scale st2actionrunner=3 -d -``` - -## Additional environment variables in 1ppc - -| Parameter | Description | -|-----------|-------------| -| `ST2WEB_DNS_RESOLVER` | *(Optional)* Hostname or address of the DNS resolver that nginx running in st2web container will use. Default is `127.0.0.1` which is suitable for sidecar pattern in Kubernetes. | - -### Sharing Content - -See [official document](https://docs.stackstorm.com/reference/ha.html#sharing-content) for details. - -- `/opt/stackstorm/packs` - - st2api - - st2actionrunner - - st2sensorcontainer -- `/opt/stackstorm/virtualenvs` - - st2actionrunner - - st2sensorcontainer - - -### Running st2chatops - -Add following service entry to `docker-compose.yml` - -``` - st2chatops: - <<: *base - environment: - - ST2_SERVICE=st2chatops - - HUBOT_ADAPTER=slack - - HUBOT_SLACK_TOKEN=xoxb-CHANGE-ME-PLEASE - - ST2_API_KEY=CHANGE-ME-PLEASE -``` - -See official docs and `/opt/stackstorm/chatops/st2chatops.env` for chatops configuration details. - - -### Notes - -- Currently all inter-service connections are done via plain http, which might be a problem in - production setup. diff --git a/runtime/compose-1ppc/common.env b/runtime/compose-1ppc/common.env deleted file mode 100644 index 0851c659..00000000 --- a/runtime/compose-1ppc/common.env +++ /dev/null @@ -1,5 +0,0 @@ -ST2_AUTH_URL=http://st2auth:9100/ -ST2_API_URL=http://st2api:9101/ -ST2_STREAM_URL=http://st2stream:9102/ - -ST2_MISTRAL_API_URL=http://mistral-api:8989/v2 diff --git a/runtime/compose-1ppc/docker-compose.yml b/runtime/compose-1ppc/docker-compose.yml deleted file mode 100644 index 12debd77..00000000 --- a/runtime/compose-1ppc/docker-compose.yml +++ /dev/null @@ -1,165 +0,0 @@ -version: '3' - -services: - st2client: &base - image: stackstorm/stackstorm:${ST2_IMAGE_TAG:-latest} - env_file: - - conf/stackstorm.env - - conf/mongo.env - - conf/rabbitmq.env - - conf/postgres.env - - conf/redis.env - - common.env - networks: - - private - restart: on-failure - environment: - - ST2_SERVICE=nop - dns_search: . - st2api: - <<: *base - environment: - - ST2_SERVICE=st2api - volumes: - - stackstorm-packs:/opt/stackstorm/packs - st2auth: - <<: *base - environment: - - ST2_SERVICE=st2auth - st2stream: - <<: *base - environment: - - ST2_SERVICE=st2stream - st2sensorcontainer: - <<: *base - environment: - - ST2_SERVICE=st2sensorcontainer - volumes: - - stackstorm-packs:/opt/stackstorm/packs - - stackstorm-virtualenvs:/opt/stackstorm/virtualenvs - st2rulesengine: - <<: *base - environment: - - ST2_SERVICE=st2rulesengine - st2timersengine: - <<: *base - environment: - - ST2_SERVICE=st2timersengine - st2workflowengine: - <<: *base - environment: - - ST2_SERVICE=st2workflowengine - st2actionrunner: - <<: *base - environment: - - ST2_SERVICE=st2actionrunner - - ST2_ACTION_AUTH_URL=http://st2auth:9100/ - volumes: - - stackstorm-packs:/opt/stackstorm/packs - - stackstorm-virtualenvs:/opt/stackstorm/virtualenvs - st2scheduler: - <<: *base - environment: - - ST2_SERVICE=st2scheduler - st2resultstracker: - <<: *base - environment: - - ST2_SERVICE=st2resultstracker - st2notifier: - <<: *base - environment: - - ST2_SERVICE=st2notifier - st2garbagecollector: - <<: *base - environment: - - ST2_SERVICE=st2garbagecollector - mistral-api: - <<: *base - environment: - - ST2_SERVICE=mistral-api - restart: on-failure - mistral-server: - <<: *base - environment: - - ST2_SERVICE=mistral-server - restart: on-failure - st2web: - <<: *base - environment: - - ST2_SERVICE=st2web - - ST2WEB_DNS_RESOLVER=st2web-dns - ports: - - "443:443" - networks: - - public - - private - - st2web-dns: - image: janeczku/go-dnsmasq:latest - environment: - - DNSMASQ_ENABLE_SEARCH=1 - networks: - - private - dns_search: . - -### External Services - - mongo: - image: mongo:3.4 - env_file: - - conf/mongo.env - networks: - - private - volumes: - - mongo-volume:/data/db - - mongo-configdb-volume:/data/configdb - dns_search: . - rabbitmq: - image: rabbitmq:management - env_file: - - conf/rabbitmq.env - networks: - - private - volumes: - - rabbitmq-volume:/var/lib/rabbitmq - dns_search: . - postgres: - image: postgres:latest - env_file: - - conf/postgres.env - networks: - - private - volumes: - - postgres-volume:/var/lib/postgresql/data - dns_search: . - redis: - image: redis:latest - env_file: - - conf/redis.env - networks: - - private - volumes: - - redis-volume:/data - dns_search: . - command: [ - "bash", "-c", - ' - docker-entrypoint.sh - --requirepass "$$REDIS_PASSWORD" - ' - ] - -volumes: - mongo-volume: - mongo-configdb-volume: - postgres-volume: - rabbitmq-volume: - redis-volume: - stackstorm-packs: - stackstorm-virtualenvs: - -networks: - public: - driver: bridge - private: - driver: bridge diff --git a/runtime/entrypoint.d/README.md b/runtime/entrypoint.d/README.md deleted file mode 100644 index d4ff4002..00000000 --- a/runtime/entrypoint.d/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Description - -As soon as the `stackstorm` container is started, and before StackStorm services are started -by init, shell scripts with suffix `.sh` located in this directory are executed in alphanumeric -order of the file name. - -Scripts in this directory can be used to write configuration files required by StackStorm. - -NOTE: The scripts must not rely on any StackStorm service being available. If you require -StackStorm to be running, then place the scripts in the `st2.d` directory instead. diff --git a/runtime/entrypoint.d/add-packs-dev.sh b/runtime/entrypoint.d/add-packs-dev.sh deleted file mode 100755 index 78901cdf..00000000 --- a/runtime/entrypoint.d/add-packs-dev.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -mkdir -p /opt/stackstorm/packs.dev -crudini --set /etc/st2/st2.conf content packs_base_paths /opt/stackstorm/packs.dev diff --git a/runtime/st2.d/README.md b/runtime/st2.d/README.md deleted file mode 100644 index 1ec8332a..00000000 --- a/runtime/st2.d/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Description - -As soon as the `st2api` service is running, scripts with suffix `.sh` located in this -directory are executed in alphanumeric order of the file name. - -Scripts in this directory can be used to interact with StackStorm. For example: - - - reload and/or restart StackStorm services, or - - perform any operation that requires StackStorm to be running. diff --git a/runtime/st2.d/reload.sh b/runtime/st2.d/reload.sh deleted file mode 100755 index e9effa5c..00000000 --- a/runtime/st2.d/reload.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -st2ctl reload --register-all diff --git a/runtime/st2.d/virtualenv.sh b/runtime/st2.d/virtualenv.sh deleted file mode 100755 index e88ab4c2..00000000 --- a/runtime/st2.d/virtualenv.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -EXAMPLES=/opt/stackstorm/packs/examples - -if [ ! -d "$EXAMPLES" ]; then - echo "Installing examples..." - cp -R /usr/share/doc/st2/examples /opt/stackstorm/packs - chgrp -R st2packs /opt/stackstorm/packs/examples - st2 run packs.setup_virtualenv packs=examples -fi diff --git a/tutorial/actions/hello-concurrency.yaml b/tutorial/actions/hello-concurrency.yaml deleted file mode 100644 index f0ae415f..00000000 --- a/tutorial/actions/hello-concurrency.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -name: "hello-concurrency" -runner_type: "local-shell-cmd" -description: "Says hello with a shell command" -entry_point: "" -parameters: - cmd: - immutable: true - default: "sleep 10 && echo Hello {{name}}!" - name: - type: string - description: "A human name" - default: "human" diff --git a/tutorial/actions/hello.yaml b/tutorial/actions/hello.yaml deleted file mode 100644 index aac824d7..00000000 --- a/tutorial/actions/hello.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -name: "hello" -runner_type: "local-shell-cmd" -description: "Says hello with a shell command" -entry_point: "" -parameters: - cmd: - immutable: true - default: "echo Hello {{name}}!" - name: - type: string - description: "A human name" - default: "human" diff --git a/tutorial/actions/mistral-basic.yaml b/tutorial/actions/mistral-basic.yaml deleted file mode 100644 index 3d2b9cd8..00000000 --- a/tutorial/actions/mistral-basic.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -description: Run a local linux command -enabled: true -entry_point: workflows/mistral-basic.yaml -name: mistral-basic -pack: tutorial -parameters: - cmd: - required: true - type: string -runner_type: mistral-v2 diff --git a/tutorial/actions/workflows/mistral-basic.yaml b/tutorial/actions/workflows/mistral-basic.yaml deleted file mode 100644 index 12d8443d..00000000 --- a/tutorial/actions/workflows/mistral-basic.yaml +++ /dev/null @@ -1,15 +0,0 @@ -version: '2.0' - -examples.mistral-basic: - description: A basic workflow that runs an arbitrary linux command. - type: direct - input: - - cmd - output: - stdout: <% $.stdout %> - tasks: - task1: - action: core.local cmd=<% $.cmd %> - publish: - stdout: <% task(task1).result.stdout %> - stderr: <% task(task1).result.stderr %> diff --git a/tutorial/policies/hello-concurrency.yaml b/tutorial/policies/hello-concurrency.yaml deleted file mode 100644 index b60d2b03..00000000 --- a/tutorial/policies/hello-concurrency.yaml +++ /dev/null @@ -1,8 +0,0 @@ -name: hello-concurrency -description: Limits the concurrent executions for hello. -enabled: true -resource_ref: tutorial.hello-concurrency -policy_type: action.concurrency -parameters: - action: delay - threshold: 1 diff --git a/tutorial/rules/monitor_file.yaml b/tutorial/rules/monitor_file.yaml deleted file mode 100644 index 65000291..00000000 --- a/tutorial/rules/monitor_file.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: monitor_file -pack: "tutorial" -description: "Monitor file for change" -enabled: true - -trigger: - parameters: - file_path: /tmp/watcher.log - type: linux.file_watch.line - -criteria: {} - -action: - parameters: - cmd: echo "{{trigger}}" - ref: core.local