From 071eb08a6493864cd8be71d3e77570fa05bf100e Mon Sep 17 00:00:00 2001 From: Amanda McGuinness Date: Thu, 30 Jul 2020 16:36:01 +0000 Subject: [PATCH 1/5] Initial mistral removal --- .circle/buildenv_common.sh | 7 +- .circle/buildenv_mistral.sh | 44 - .circle/configure-postgres.sh | 9 - .circle/configure-services.sh | 1 - .circle/docker-compose.sh | 9 +- .circle/docker-compose2.sh | 6 - .circleci/config.yml | 4 +- README.md | 7 +- Vagrantfile | 4 +- docker-compose.circle.yml | 8 - docker-compose.circle2.yml | 7 - docker-compose.override.yml | 9 - docker-compose.yml | 10 - packages/st2/Makefile | 20 +- packages/st2/component.makefile | 9 +- packages/st2/in-requirements.txt | 1 - packages/st2mistral/Makefile | 90 -- packages/st2mistral/bin/mistral | 8 - packages/st2mistral/conf/helpers-sysvinit | 26 - packages/st2mistral/conf/logrotate.conf | 25 - packages/st2mistral/conf/mistral.conf | 846 ------------------ packages/st2mistral/conf/policy.json | 58 -- .../st2mistral/conf/rhel-functions-sysvinit | 241 ----- packages/st2mistral/debian/README | 6 - packages/st2mistral/debian/README.Debian | 6 - packages/st2mistral/debian/README.source | 10 - packages/st2mistral/debian/changelog | 5 - packages/st2mistral/debian/compat | 1 - packages/st2mistral/debian/conffiles | 1 - packages/st2mistral/debian/control | 17 - packages/st2mistral/debian/copyright | 33 - packages/st2mistral/debian/docs | 0 packages/st2mistral/debian/install | 3 - packages/st2mistral/debian/mistral-api.init | 185 ---- .../st2mistral/debian/mistral-server.init | 184 ---- packages/st2mistral/debian/mistral.init | 131 --- packages/st2mistral/debian/postinst | 63 -- packages/st2mistral/debian/preinst | 47 - packages/st2mistral/debian/rules | 40 - packages/st2mistral/debian/source/format | 1 - packages/st2mistral/debian/st2mistral.dirs | 4 - packages/st2mistral/rpm/mistral-api.init | 122 --- packages/st2mistral/rpm/mistral-api.service | 16 - packages/st2mistral/rpm/mistral-server.init | 122 --- .../st2mistral/rpm/mistral-server.service | 15 - packages/st2mistral/rpm/mistral.init | 95 -- packages/st2mistral/rpm/mistral.service | 14 - packages/st2mistral/rpm/st2mistral.spec | 78 -- rake/build/environment.rb | 12 +- rake/build/package_st2mistral.rake | 51 -- rake/build/setup.rake | 3 - .../default/50-installed-cli-versions_spec.rb | 9 - .../default/60-st2_all-services-ok_spec.rb | 40 - .../default/65-st2mistral_actions_spec.rb | 11 - rake/spec/spec_helper.rb | 19 - rake/spec/spec_package_iterables.rb | 1 - scripts/generate_mistral_config.sh | 37 - scripts/includes/common.sh | 9 +- scripts/includes/rhel.sh | 10 - scripts/setup-vagrant.sh | 13 +- scripts/st2_bootstrap.sh | 2 +- scripts/st2bootstrap-deb.template.sh | 63 +- scripts/st2bootstrap-el7.template.sh | 53 +- scripts/st2bootstrap-el8.template.sh | 3 +- 64 files changed, 24 insertions(+), 2960 deletions(-) delete mode 100755 .circle/buildenv_mistral.sh delete mode 100755 .circle/configure-postgres.sh delete mode 100644 packages/st2mistral/Makefile delete mode 100755 packages/st2mistral/bin/mistral delete mode 100644 packages/st2mistral/conf/helpers-sysvinit delete mode 100644 packages/st2mistral/conf/logrotate.conf delete mode 100644 packages/st2mistral/conf/mistral.conf delete mode 100644 packages/st2mistral/conf/policy.json delete mode 100644 packages/st2mistral/conf/rhel-functions-sysvinit delete mode 100644 packages/st2mistral/debian/README delete mode 100644 packages/st2mistral/debian/README.Debian delete mode 100644 packages/st2mistral/debian/README.source delete mode 100644 packages/st2mistral/debian/changelog delete mode 100644 packages/st2mistral/debian/compat delete mode 100644 packages/st2mistral/debian/conffiles delete mode 100644 packages/st2mistral/debian/control delete mode 100644 packages/st2mistral/debian/copyright delete mode 100644 packages/st2mistral/debian/docs delete mode 100644 packages/st2mistral/debian/install delete mode 100644 packages/st2mistral/debian/mistral-api.init delete mode 100644 packages/st2mistral/debian/mistral-server.init delete mode 100644 packages/st2mistral/debian/mistral.init delete mode 100644 packages/st2mistral/debian/postinst delete mode 100644 packages/st2mistral/debian/preinst delete mode 100755 packages/st2mistral/debian/rules delete mode 100644 packages/st2mistral/debian/source/format delete mode 100644 packages/st2mistral/debian/st2mistral.dirs delete mode 100644 packages/st2mistral/rpm/mistral-api.init delete mode 100644 packages/st2mistral/rpm/mistral-api.service delete mode 100644 packages/st2mistral/rpm/mistral-server.init delete mode 100644 packages/st2mistral/rpm/mistral-server.service delete mode 100644 packages/st2mistral/rpm/mistral.init delete mode 100644 packages/st2mistral/rpm/mistral.service delete mode 100644 packages/st2mistral/rpm/st2mistral.spec delete mode 100644 rake/build/package_st2mistral.rake delete mode 100644 rake/spec/default/65-st2mistral_actions_spec.rb delete mode 100644 scripts/generate_mistral_config.sh diff --git a/.circle/buildenv_common.sh b/.circle/buildenv_common.sh index 7d5f2356..5fc1b52b 100755 --- a/.circle/buildenv_common.sh +++ b/.circle/buildenv_common.sh @@ -10,12 +10,7 @@ write_env() { distros=($DISTROS) DISTRO=${distros[$CIRCLE_NODE_INDEX]} -# NOTE: We don't build Mistral package on Ubuntu Bionic -if [[ "${DISTRO}" = "bionic"} ]] || [[ "${DISTRO}" = "el8"} ]]; then - ST2_PACKAGES="st2" -else - ST2_PACKAGES=${ST2_PACKAGES:-st2 mistral} -fi +ST2_PACKAGES="st2" write_env ST2_PACKAGES diff --git a/.circle/buildenv_mistral.sh b/.circle/buildenv_mistral.sh deleted file mode 100755 index 134d339f..00000000 --- a/.circle/buildenv_mistral.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -set -e - -my_dir="$(dirname "$0")" -source "$my_dir/buildenv_common.sh" - -distros=($DISTROS) -DISTRO=${distros[$CIRCLE_NODE_INDEX]} - -fetch_version() { - if [ -f ../version_st2.py ]; then - # Get st2 version based on hardcoded string in st2common - # build takes place in `st2` repo - python -c 'exec(open("../version_st2.py").read()); print(__version__)' - else - # build takes place in `st2-packages` repo - curl -sSL -o /tmp/mistral_version.py ${ST2MISTRAL_GITURL}/raw/${ST2MISTRAL_GITREV}/version_st2.py - python -c 'exec(open("/tmp/mistral_version.py").read()); print(__version__)' - fi -} - -mistral_giturl() { - # Handle pull requests properly - if [ -z "$CIRCLE_PR_REPONAME" ]; then - echo "https://github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}" - else - echo "https://github.com/${CIRCLE_PR_USERNAME}/${CIRCLE_PR_REPONAME}" - fi -} - -# Mistral versioning -ST2MISTRAL_GITURL=${ST2MISTRAL_GITURL:-https://github.com/StackStorm/mistral} -ST2MISTRAL_GITREV=${ST2MISTRAL_GITREV:-master} -MISTRAL_VERSION=$(fetch_version) -if [ -n "$PACKAGECLOUD_TOKEN" ]; then - MISTRAL_RELEASE=$(.circle/packagecloud.sh next-revision ${DISTRO} ${MISTRAL_VERSION} st2mistral) -else - # is fork - MISTRAL_RELEASE=1 -fi - -write_env ST2MISTRAL_GITURL ST2MISTRAL_GITREV MISTRAL_VERSION MISTRAL_RELEASE DISTRO TESTING - -cat ~/.buildenv diff --git a/.circle/configure-postgres.sh b/.circle/configure-postgres.sh deleted file mode 100755 index ce76a517..00000000 --- a/.circle/configure-postgres.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -CONFIG=$(cat < "#{name}", "ST2_USER" => ENV['ST2USER'] ? ENV['ST2USER'] : 'st2admin', "ST2_PASSWORD" => ENV['ST2PASSWORD'] ? ENV['ST2PASSWORD'] : 'st2admin', - "ST2_PACKAGES" => ENV['ST2_PACKAGES'] ? ENV['ST2_PACKAGES'] : 'st2 st2mistral', + "ST2_PACKAGES" => ENV['ST2_PACKAGES'] ? ENV['ST2_PACKAGES'] : 'st2', "ST2_INSTALL" => ENV['ST2_INSTALL'] ? ENV['ST2_INSTALL'] : 'yes', "ST2_VERIFY" => ENV['ST2_VERIFY'] ? ENV['ST2_VERIFY'] : 'yes', "ST2_GITURL" => ENV['ST2_GITURL'], "ST2_GITREV" => ENV['ST2_GITREV'], - "ST2MISTRAL_GITURL" => ENV['ST2MISTRAL_GITURL'], - "ST2MISTRAL_GITREV" => ENV['ST2MISTRAL_GITREV'], } end end diff --git a/docker-compose.circle.yml b/docker-compose.circle.yml index cc65499f..3f20e505 100644 --- a/docker-compose.circle.yml +++ b/docker-compose.circle.yml @@ -18,16 +18,12 @@ bionic: environment: - BUILDNODE=bionicbuild - TESTNODE=bionictest - # NOTE: We don't build st2mistral package so we don't mix Python 3 - # (StackStorm components) and Python 2 (Mistral) - # Bionic will be first release without a Mistral - ST2_PACKAGES=st2 links: - bionicbuild - bionictest - rabbitmq - mongodb - - postgres el8: image: quay.io/stackstorm/packagingrunner @@ -37,16 +33,12 @@ el8: environment: - BUILDNODE=centos8build - TESTNODE=centos8test - # NOTE: We don't build st2mistral package so we don't mix Python 3 - # (StackStorm components) and Python 2 (Mistral) - # Bionic will be first release without a Mistral - ST2_PACKAGES=st2 links: - centos8build - centos8test - rabbitmq - mongodb - - postgres el7: image: quay.io/stackstorm/packagingrunner diff --git a/docker-compose.circle2.yml b/docker-compose.circle2.yml index 01a88c0a..51977e24 100644 --- a/docker-compose.circle2.yml +++ b/docker-compose.circle2.yml @@ -11,7 +11,6 @@ xenial: - xenialtest - rabbitmq - mongodb - - postgres bionic: image: quay.io/stackstorm/packagingrunner @@ -21,16 +20,12 @@ bionic: environment: - BUILDNODE=bionicbuild - TESTNODE=bionictest - # NOTE: We don't build st2mistral package so we don't mix Python 3 - # (StackStorm components) and Python 2 (Mistral) - # Bionic will be first release without a Mistral - ST2_PACKAGES=st2 links: - bionicbuild - bionictest - rabbitmq - mongodb - - postgres el8: image: quay.io/stackstorm/packagingrunner @@ -45,7 +40,6 @@ el8: - centos8test - rabbitmq - mongodb - - postgres el7: image: quay.io/stackstorm/packagingrunner @@ -60,7 +54,6 @@ el7: - centos7test - rabbitmq - mongodb - - postgres ## Package build nodes # diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 0ce30d1c..1630c900 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -34,7 +34,6 @@ volumes-circle: volumes: - /tmp/st2-packages:/root/build - /tmp/st2-packages/log/st2:/var/log/st2 - - /tmp/st2-packages/log/mistral:/var/log/mistral ## Service used by st2 # @@ -49,11 +48,3 @@ mongodb: image: mongo:4.0 ports: - "27017:27017" - -postgres: - image: postgres - ports: - - "5432:5432" - environment: - - POSTGRES_USER=mistral - - POSTGRES_PASSWORD=StackStorm diff --git a/docker-compose.yml b/docker-compose.yml index 4e903adc..671e14ea 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,7 +11,6 @@ xenial: - xenialtest - rabbitmq - mongodb - - postgres bionic: image: quay.io/stackstorm/packagingrunner @@ -21,16 +20,12 @@ bionic: environment: - BUILDNODE=bionicbuild - TESTNODE=bionictest - # NOTE: We don't build st2mistral package so we don't mix Python 3 - # (StackStorm components) and Python 2 (Mistral) - # Bionic will be first release without a Mistral - ST2_PACKAGES=st2 links: - bionicbuild - bionictest - rabbitmq - mongodb - - postgres el8: image: quay.io/stackstorm/packagingrunner @@ -40,16 +35,12 @@ el8: environment: - BUILDNODE=centos8build - TESTNODE=centos8test - # NOTE: We don't build st2mistral package so we don't mix Python 3 - # (StackStorm components) and Python 2 (Mistral) - # Bionic will be first release without a Mistral - ST2_PACKAGES=st2 links: - centos8build - centos8test - rabbitmq - mongodb - - postgres el7: @@ -65,7 +56,6 @@ el7: - centos7test - rabbitmq - mongodb - - postgres ## Package build nodes # diff --git a/packages/st2/Makefile b/packages/st2/Makefile index 6e45cd86..70a8a84d 100644 --- a/packages/st2/Makefile +++ b/packages/st2/Makefile @@ -38,14 +38,10 @@ else PYTHON_ALT_BINARY := python endif -# Don't include Mistral runner on Bionic or EL8 -ifeq ($(DEB_DISTRO),bionic) - RUNNERS := $(shell ls -I mistral* ../contrib/runners) -else ifeq ($(EL_VERSION),8) +# Don't include Mistral runner +# TODO: Go back to all runners when mistral removed from st2 +# RUNNERS := $(shell ls ../contrib/runners) RUNNERS := $(shell ls -I mistral* ../contrib/runners) -else - RUNNERS := $(shell ls ../contrib/runners) -endif # Moved from top of file to handle when only py2 or py3 available ST2PKG_VERSION ?= $(shell $(PYTHON_BINARY) -c "from $(ST2_COMPONENT) import __version__; print(__version__),") @@ -123,14 +119,10 @@ populate_version: .stamp-populate_version touch $@ requirements: -# Don't include Mistral runner on Bionic -ifeq ($(DEB_DISTRO),bionic) - $(PYTHON_BINARY) ../scripts/fixate-requirements.py --skip=stackstorm-runner-mistral-v2,python-mistralclient -s ../st2*/in-requirements.txt ../contrib/runners/*/in-requirements.txt -f ../fixed-requirements.txt -else ifeq ($(EL_VERSION),8) +# Don't include Mistral runner for now +# TODO: Use all runners when mistral removed from st2 core +# $(PYTHON_BINARY) ../scripts/fixate-requirements.py -s ../st2*/in-requirements.txt ../contrib/runners/*/in-requirements.txt -f ../fixed-requirements.txt $(PYTHON_BINARY) ../scripts/fixate-requirements.py --skip=stackstorm-runner-mistral-v2,python-mistralclient -s ../st2*/in-requirements.txt ../contrib/runners/*/in-requirements.txt -f ../fixed-requirements.txt -else - $(PYTHON_BINARY) ../scripts/fixate-requirements.py -s ../st2*/in-requirements.txt ../contrib/runners/*/in-requirements.txt -f ../fixed-requirements.txt -endif cat requirements.txt changelog: populate_version diff --git a/packages/st2/component.makefile b/packages/st2/component.makefile index b5ae3dd6..a5089c11 100644 --- a/packages/st2/component.makefile +++ b/packages/st2/component.makefile @@ -63,14 +63,9 @@ populate_version: .stamp-populate_version requirements: .stamp-requirements .stamp-requirements: -# Don't include Mistral runner on Bionic -ifeq ($(DEB_DISTRO),bionic) - $(PYTHON_BINARY) ../scripts/fixate-requirements.py --skip=stackstorm-runner-mistral-v2,python-mistralclient -s in-requirements.txt -f ../fixed-requirements.txt -else ifeq ($(EL_VERSION),8) +# Don't include Mistral runner for now, replace with commented version when mistral removed from st2 +# $(PYTHON_BINARY) ../scripts/fixate-requirements.py -s in-requirements.txt -f ../fixed-requirements.txt $(PYTHON_BINARY) ../scripts/fixate-requirements.py --skip=stackstorm-runner-mistral-v2,python-mistralclient -s in-requirements.txt -f ../fixed-requirements.txt -else - $(PYTHON_BINARY) ../scripts/fixate-requirements.py -s in-requirements.txt -f ../fixed-requirements.txt -endif cat requirements.txt wheelhouse: .stamp-wheelhouse diff --git a/packages/st2/in-requirements.txt b/packages/st2/in-requirements.txt index d5fd571c..ac42c41c 100644 --- a/packages/st2/in-requirements.txt +++ b/packages/st2/in-requirements.txt @@ -13,7 +13,6 @@ stackstorm-runner-announcement stackstorm-runner-http stackstorm-runner-inquirer stackstorm-runner-local -stackstorm-runner-mistral-v2 stackstorm-runner-noop stackstorm-runner-orquesta stackstorm-runner-python diff --git a/packages/st2mistral/Makefile b/packages/st2mistral/Makefile deleted file mode 100644 index 01d0f0e2..00000000 --- a/packages/st2mistral/Makefile +++ /dev/null @@ -1,90 +0,0 @@ -# Mind that that some of the vars are passed as ENV! -WHEELDIR ?= /tmp/wheelhouse -COMPONENT := st2mistral -MISTRAL_RELEASE ?= 1 -MISTRAL_VERSION ?= $(shell python -c "from pbr import version; print version.VersionInfo('mistral').version_string(),") -# It's later than 0.11.1, so we have to use a later commit :( -PBR_GITURL := git+https://github.com/openstack-dev/pbr@d19459daa8616dd18fde016c2970ffc41ff4ccdd\#egg=pbr - -# We use special additional requirements in our mistral bundle! -define INJECT_DEPS -git+https://github.com/StackStorm/st2mistral.git@$(GITREV)#egg=st2mistral -$(PBR_GITURL) -endef -export INJECT_DEPS - -ifneq (,$(wildcard /usr/share/python/st2python/bin/python)) - PATH := /usr/share/python/st2python/bin:$(PATH) -endif - -ifneq (,$(wildcard /etc/debian_version)) - DEBIAN := 1 - DESTDIR ?= $(CURDIR)/debian/$(COMPONENT) -else - REDHAT := 1 -endif - -all: install -.PHONY: all install changelog pre_install post_install - -install: changelog wheelhouse pre_install - -post_install: - # leave empty if no steps are required - -pre_install: - install -D conf/policy.json $(DESTDIR)/etc/mistral/policy.json - install -D etc/logging.conf.sample $(DESTDIR)/etc/mistral/logging.conf - install -m644 conf/logrotate.conf $(DESTDIR)/etc/logrotate.d/mistral - install -D etc/wf_trace_logging.conf.sample $(DESTDIR)/etc/mistral/wf_trace_logging.conf - install -D -m644 conf/helpers-sysvinit $(DESTDIR)/opt/stackstorm/mistral/share/sysvinit/helpers - sed -i "s%/var/log/%/var/log/mistral/%" $(DESTDIR)/etc/mistral/*logging.conf - sed -i "/\[logger_root\]/,/\[.*\]\|\s*$$/ {s/level=DEBUG/level=INFO/}" $(DESTDIR)/etc/mistral/*logging.conf - -changelog: populate_version -ifeq ($(DEBIAN),1) - debchange -v $(MISTRAL_VERSION)-$(MISTRAL_RELEASE) -M "automated build version: $(MISTRAL_VERSION)" -endif - -populate_version: .stamp-populate_version -.stamp-populate_version: - sed -i "/^pbr.*/d" requirements.txt - sed -i "s/setup_requires=\[.*\]/setup_requires=\['pbr'\]/" setup.py - pip install $(PBR_GITURL) || \ - pip install $(PBR_GITURL) - touch $@ - -wheelhouse: .stamp-wheelhouse -.stamp-wheelhouse: | populate_version inject-deps bdist_wheel - # Install wheels into shared location - pip wheel --wheel-dir=$(WHEELDIR) --find-links=$(WHEELDIR) -r requirements.txt || \ - pip wheel --wheel-dir=$(WHEELDIR) --find-links=$(WHEELDIR) -r requirements.txt - touch $@ - -bdist_wheel: .stamp-bdist_wheel -.stamp-bdist_wheel: | populate_version - # python setup.py bdist_wheel -d $(WHEELDIR) - pip wheel --wheel-dir=$(WHEELDIR) --find-links=$(WHEELDIR) -r requirements.txt || \ - pip wheel --wheel-dir=$(WHEELDIR) --find-links=$(WHEELDIR) -r requirements.txt - touch $@ - -# We need to create bdist, before mangling requirements and running pip, -# otherwise proccess will fail. -inject-deps: .stamp-inject-deps -.stamp-inject-deps: | bdist_wheel - echo "$$INJECT_DEPS" >> requirements.txt - grep -q 'gunicorn' requirements.txt || echo "gunicorn" >> requirements.txt - grep -q 'oslo.cache' requirements.txt || echo "oslo.cache<1.32.0" >> requirements.txt - grep -q 'openstacksdk' requirements.txt || echo "openstacksdk<0.21.0" >> requirements.txt - grep -q 'psycopg2' requirements.txt || echo "psycopg2>=2.6.2,<2.7.0" >> requirements.txt - grep -q 'pika' requirements.txt || echo "pika<0.11,>=0.9" >> requirements.txt - grep -q 'python-memcached' requirements.txt || echo "python-memcached" >> requirements.txt - sed -i "s/^oslo.messaging.*/oslo.messaging==5.24.2/g" requirements.txt - sed -i "s/^Babel.*/Babel>=2.3.4,!=2.4.0 # BSD/g" requirements.txt - sed -i "s/^python-senlinclient.*/python-senlinclient<1.10.0 # Apache-2.0/g" requirements.txt - -ifeq (,$(findstring dev,$(MISTRAL_VERSION))) - sed -i "s/^python-mistralclient.*/git+https:\/\/github.com\/StackStorm\/python-mistralclient.git@st2-$(MISTRAL_VERSION)\#egg=python-mistralclient/g" requirements.txt -endif - - touch $@ diff --git a/packages/st2mistral/bin/mistral b/packages/st2mistral/bin/mistral deleted file mode 100755 index a6c21f7b..00000000 --- a/packages/st2mistral/bin/mistral +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# Wrapper script, used to override default mistral client environment variables -# https://github.com/StackStorm/python-mistralclient#running-mistral-client - -OS_MISTRAL_URL=${OS_MISTRAL_URL:-http://127.0.0.1:8989/v2} -export OS_MISTRAL_URL - -exec /opt/stackstorm/mistral/bin/mistral "$@" diff --git a/packages/st2mistral/conf/helpers-sysvinit b/packages/st2mistral/conf/helpers-sysvinit deleted file mode 100644 index 44f56224..00000000 --- a/packages/st2mistral/conf/helpers-sysvinit +++ /dev/null @@ -1,26 +0,0 @@ -# -*-Shell-script-*- - -# Check if mistral-api or mistral-server components are enabled (checks $COMPONENTS) -enabled_list() { - local service= quiet= components= list= retval=0 - [ "$1" = "-q" ] && quiet='quiet' && shift - service="$1" - - [ "$service" = api ] && components="api" - [ "$service" = server ] && components="engine executor notifier" - - # build up the component list - for comp in $components; do - echo $COMPONENTS | grep -q ",\?${comp},\?" && list="$list $comp" - done - list=$(echo $list | sed -e 's/^ //' -e 's/ /,/g') - - # Print out list if not empty - if [ -z "$list" ]; then - echo "mistral-${service} is disabled check \$COMPONENTS environment variable!" - retval=1 - else - [ -z "$quiet" ] && echo $list - fi - return $retval -} diff --git a/packages/st2mistral/conf/logrotate.conf b/packages/st2mistral/conf/logrotate.conf deleted file mode 100644 index 694cd7fb..00000000 --- a/packages/st2mistral/conf/logrotate.conf +++ /dev/null @@ -1,25 +0,0 @@ -## Mistral API -/var/log/mistral/mistral-api.log { - size 1M - rotate 5 - compress - notifempty - missingok - create 644 mistral mistral - postrotate - pkill -USR1 -f mistral.api.wsgi > /dev/null 2>&1 || true - endscript -} - -## Mistral Server -/var/log/mistral/mistral-server.log { - size 50M - rotate 10 - compress - notifempty - missingok - # Mistral doesn't handle USR1 signal right to re-open log files, - # Sending HUP will re-open the logs, but will stop the running workflows - copytruncate - delaycompress -} diff --git a/packages/st2mistral/conf/mistral.conf b/packages/st2mistral/conf/mistral.conf deleted file mode 100644 index bdccdd6d..00000000 --- a/packages/st2mistral/conf/mistral.conf +++ /dev/null @@ -1,846 +0,0 @@ -[DEFAULT] - -# -# From mistral.config -# - -# Enables debugger. Note that using this option changes how the -# eventlet library is used to support async IO. This could result in -# failures that do not occur under normal operation. Use at your own -# risk. (boolean value) -#use_debugger = false - -# Specifies which mistral server to start by the launch script. Valid -# options are all or any combination of api, engine, and executor. -# (list value) -#server = all - -# Logger name for pretty workflow trace output. (string value) -#workflow_trace_log_name = workflow_trace - -# -# From oslo.log -# - -# Print debugging output (set logging level to DEBUG instead of -# default INFO level). (boolean value) -#debug = false - -# If set to false, will disable INFO logging level, making WARNING the -# default. (boolean value) -# This option is deprecated for removal. -# Its value may be silently ignored in the future. -#verbose = true - -# The name of a logging configuration file. This file is appended to -# any existing logging configuration files. For details about logging -# configuration files, see the Python logging module documentation. -# (string value) -# Deprecated group/name - [DEFAULT]/log_config -#log_config_append = - -# DEPRECATED. A logging.Formatter log message format string which may -# use any of the available logging.LogRecord attributes. This option -# is deprecated. Please use logging_context_format_string and -# logging_default_format_string instead. (string value) -#log_format = - -# Format string for %%(asctime)s in log records. Default: %(default)s -# . (string value) -#log_date_format = %Y-%m-%d %H:%M:%S - -# (Optional) Name of log file to output to. If no default is set, -# logging will go to stdout. (string value) -# Deprecated group/name - [DEFAULT]/logfile -#log_file = - -# (Optional) The base directory used for relative --log-file paths. -# (string value) -# Deprecated group/name - [DEFAULT]/logdir -#log_dir = - -# Use syslog for logging. Existing syslog format is DEPRECATED and -# will be changed later to honor RFC5424. (boolean value) -#use_syslog = false - -# (Optional) Enables or disables syslog rfc5424 format for logging. If -# enabled, prefixes the MSG part of the syslog message with APP-NAME -# (RFC5424). The format without the APP-NAME is deprecated in Kilo, -# and will be removed in Mitaka, along with this option. (boolean -# value) -# This option is deprecated for removal. -# Its value may be silently ignored in the future. -#use_syslog_rfc_format = true - -# Syslog facility to receive log lines. (string value) -#syslog_log_facility = LOG_USER - -# Log output to standard error. (boolean value) -#use_stderr = true - -# Format string to use for log messages with context. (string value) -#logging_context_format_string = %(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s - -# Format string to use for log messages without context. (string -# value) -#logging_default_format_string = %(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s - -# Data to append to log format when level is DEBUG. (string value) -#logging_debug_format_suffix = %(funcName)s %(pathname)s:%(lineno)d - -# Prefix each line of exception output with this format. (string -# value) -#logging_exception_prefix = %(asctime)s.%(msecs)03d %(process)d ERROR %(name)s %(instance)s - -# List of logger=LEVEL pairs. (list value) -#default_log_levels = amqp=WARN,amqplib=WARN,boto=WARN,qpid=WARN,sqlalchemy=WARN,suds=INFO,oslo.messaging=INFO,iso8601=WARN,requests.packages.urllib3.connectionpool=WARN,urllib3.connectionpool=WARN,websocket=WARN,requests.packages.urllib3.util.retry=WARN,urllib3.util.retry=WARN,keystonemiddleware=WARN,routes.middleware=WARN,stevedore=WARN,taskflow=WARN - -# Enables or disables publication of error events. (boolean value) -#publish_errors = false - -# The format for an instance that is passed with the log message. -# (string value) -#instance_format = "[instance: %(uuid)s] " - -# The format for an instance UUID that is passed with the log message. -# (string value) -#instance_uuid_format = "[instance: %(uuid)s] " - -# Enables or disables fatal status of deprecations. (boolean value) -#fatal_deprecations = false - -# -# From oslo.messaging -# - -# Size of RPC connection pool. (integer value) -# Deprecated group/name - [DEFAULT]/rpc_conn_pool_size -#rpc_conn_pool_size = 30 - -# ZeroMQ bind address. Should be a wildcard (*), an ethernet -# interface, or IP. The "host" option should point or resolve to this -# address. (string value) -#rpc_zmq_bind_address = * - -# MatchMaker driver. (string value) -#rpc_zmq_matchmaker = local - -# ZeroMQ receiver listening port. (integer value) -#rpc_zmq_port = 9501 - -# Number of ZeroMQ contexts, defaults to 1. (integer value) -#rpc_zmq_contexts = 1 - -# Maximum number of ingress messages to locally buffer per topic. -# Default is unlimited. (integer value) -#rpc_zmq_topic_backlog = - -# Directory for holding IPC sockets. (string value) -#rpc_zmq_ipc_dir = /var/run/openstack - -# Name of this node. Must be a valid hostname, FQDN, or IP address. -# Must match "host" option, if running Nova. (string value) -#rpc_zmq_host = 127.0.0.1 - -# Seconds to wait before a cast expires (TTL). Only supported by -# impl_zmq. (integer value) -#rpc_cast_timeout = 30 - -# Heartbeat frequency. (integer value) -#matchmaker_heartbeat_freq = 300 - -# Heartbeat time-to-live. (integer value) -#matchmaker_heartbeat_ttl = 600 - -# Size of executor thread pool. (integer value) -# Deprecated group/name - [DEFAULT]/rpc_thread_pool_size -#executor_thread_pool_size = 64 - -# The Drivers(s) to handle sending notifications. Possible values are -# messaging, messagingv2, routing, log, test, noop (multi valued) -#notification_driver = - -# AMQP topic used for OpenStack notifications. (list value) -# Deprecated group/name - [rpc_notifier2]/topics -#notification_topics = notifications - -# Seconds to wait for a response from a call. (integer value) -#rpc_response_timeout = 60 - -# A URL representing the messaging driver to use and its full -# configuration. If not set, we fall back to the rpc_backend option -# and driver specific configuration. (string value) -#transport_url = -transport_url = rabbit://guest:guest@127.0.0.1:5672 - -# The messaging driver to use, defaults to rabbit. Other drivers -# include qpid and zmq. (string value) -#rpc_backend = rabbit - -# The default exchange under which topics are scoped. May be -# overridden by an exchange name specified in the transport_url -# option. (string value) -#control_exchange = openstack - - -[api] - -# -# From mistral.config -# - -# Mistral API server host (string value) -#host = 0.0.0.0 - -# Mistral API server port (integer value) -#port = 8989 - - -[coordination] - -# -# From mistral.config -# - -# The backend URL to be used for coordination (string value) -#backend_url = - -# Number of seconds between heartbeats for coordination. (floating -# point value) -#heartbeat_interval = 5.0 - - -[database] - -# -# From oslo.db -# - -# The file name to use with SQLite. (string value) -# Deprecated group/name - [DEFAULT]/sqlite_db -#sqlite_db = oslo.sqlite - -# If True, SQLite uses synchronous mode. (boolean value) -# Deprecated group/name - [DEFAULT]/sqlite_synchronous -#sqlite_synchronous = true - -# The back end to use for the database. (string value) -# Deprecated group/name - [DEFAULT]/db_backend -#backend = sqlalchemy - -# The SQLAlchemy connection string to use to connect to the database. -# (string value) -# Deprecated group/name - [DEFAULT]/sql_connection -# Deprecated group/name - [DATABASE]/sql_connection -# Deprecated group/name - [sql]/connection -#connection = -connection = postgresql+psycopg2://mistral:StackStorm@localhost/mistral - -# The SQLAlchemy connection string to use to connect to the slave -# database. (string value) -#slave_connection = - -# The SQL mode to be used for MySQL sessions. This option, including -# the default, overrides any server-set SQL mode. To use whatever SQL -# mode is set by the server configuration, set this to no value. -# Example: mysql_sql_mode= (string value) -#mysql_sql_mode = TRADITIONAL - -# Timeout before idle SQL connections are reaped. (integer value) -# Deprecated group/name - [DEFAULT]/sql_idle_timeout -# Deprecated group/name - [DATABASE]/sql_idle_timeout -# Deprecated group/name - [sql]/idle_timeout -#idle_timeout = 3600 - -# Minimum number of SQL connections to keep open in a pool. (integer -# value) -# Deprecated group/name - [DEFAULT]/sql_min_pool_size -# Deprecated group/name - [DATABASE]/sql_min_pool_size -#min_pool_size = 1 - -# Maximum number of SQL connections to keep open in a pool. (integer -# value) -# Deprecated group/name - [DEFAULT]/sql_max_pool_size -# Deprecated group/name - [DATABASE]/sql_max_pool_size -#max_pool_size = -max_pool_size = 50 - -# Maximum number of database connection retries during startup. Set to -# -1 to specify an infinite retry count. (integer value) -# Deprecated group/name - [DEFAULT]/sql_max_retries -# Deprecated group/name - [DATABASE]/sql_max_retries -#max_retries = 10 - -# Interval between retries of opening a SQL connection. (integer -# value) -# Deprecated group/name - [DEFAULT]/sql_retry_interval -# Deprecated group/name - [DATABASE]/reconnect_interval -#retry_interval = 10 - -# If set, use this value for max_overflow with SQLAlchemy. (integer -# value) -# Deprecated group/name - [DEFAULT]/sql_max_overflow -# Deprecated group/name - [DATABASE]/sqlalchemy_max_overflow -#max_overflow = - -# Verbosity of SQL debugging information: 0=None, 100=Everything. -# (integer value) -# Deprecated group/name - [DEFAULT]/sql_connection_debug -#connection_debug = 0 - -# Add Python stack traces to SQL as comment strings. (boolean value) -# Deprecated group/name - [DEFAULT]/sql_connection_trace -#connection_trace = false - -# If set, use this value for pool_timeout with SQLAlchemy. (integer -# value) -# Deprecated group/name - [DATABASE]/sqlalchemy_pool_timeout -#pool_timeout = - -# Enable the experimental use of database reconnect on connection -# lost. (boolean value) -#use_db_reconnect = false - -# Seconds between retries of a database transaction. (integer value) -#db_retry_interval = 1 - -# If True, increases the interval between retries of a database -# operation up to db_max_retry_interval. (boolean value) -#db_inc_retry_interval = true - -# If db_inc_retry_interval is set, the maximum seconds between retries -# of a database operation. (integer value) -#db_max_retry_interval = 10 - -# Maximum retries in case of connection error or deadlock error before -# error is raised. Set to -1 to specify an infinite retry count. -# (integer value) -#db_max_retries = 20 - - -[engine] - -# -# From mistral.config -# - -# Mistral engine plugin (string value) -#engine = default - -# Name of the engine node. This can be an opaque identifier. It is not -# necessarily a hostname, FQDN, or IP address. (string value) -#host = 0.0.0.0 - -# The message topic that the engine listens on. (string value) -#topic = mistral_engine - -# The version of the engine. (string value) -#version = 1.0 - -# The default maximum size in KB of large text fields of runtime -# execution objects. Use -1 for no limit. (integer value) -#execution_field_size_limit_kb = 1024 - - -[execution_expiration_policy] - -# -# From mistral.config -# - -# How often will the executions be evaluated (in minutes). For example -# for value 120 the interval will be 2 hours (every 2 hours). (integer -# value) -#evaluation_interval = - -# Evaluate from which time remove executions in minutes. For example -# when older_than = 60, remove all executions that finished a 60 -# minutes ago or more. Minimum value is 1. Note that only final state -# execution will remove ( SUCCESS / ERROR ). (integer value) -#older_than = - - -[executor] - -# -# From mistral.config -# - -# Name of the executor node. This can be an opaque identifier. It is -# not necessarily a hostname, FQDN, or IP address. (string value) -#host = 0.0.0.0 - -# The message topic that the executor listens on. (string value) -#topic = mistral_executor - -# The version of the executor. (string value) -#version = 1.0 - - -[keystone_authtoken] - -# -# From keystonemiddleware.auth_token -# - -# Complete public Identity API endpoint. (string value) -#auth_uri = - -# API version of the admin Identity API endpoint. (string value) -#auth_version = - -# Do not handle authorization requests within the middleware, but -# delegate the authorization decision to downstream WSGI components. -# (boolean value) -#delay_auth_decision = false - -# Request timeout value for communicating with Identity API server. -# (integer value) -#http_connect_timeout = - -# How many times are we trying to reconnect when communicating with -# Identity API Server. (integer value) -#http_request_max_retries = 3 - -# Env key for the swift cache. (string value) -#cache = - -# Required if identity server requires client certificate (string -# value) -#certfile = - -# Required if identity server requires client certificate (string -# value) -#keyfile = - -# A PEM encoded Certificate Authority to use when verifying HTTPs -# connections. Defaults to system CAs. (string value) -#cafile = - -# Verify HTTPS connections. (boolean value) -#insecure = false - -# Directory used to cache files related to PKI tokens. (string value) -#signing_dir = - -# Optionally specify a list of memcached server(s) to use for caching. -# If left undefined, tokens will instead be cached in-process. (list -# value) -# Deprecated group/name - [DEFAULT]/memcache_servers -#memcached_servers = - -# In order to prevent excessive effort spent validating tokens, the -# middleware caches previously-seen tokens for a configurable duration -# (in seconds). Set to -1 to disable caching completely. (integer -# value) -#token_cache_time = 300 - -# Determines the frequency at which the list of revoked tokens is -# retrieved from the Identity service (in seconds). A high number of -# revocation events combined with a low cache duration may -# significantly reduce performance. (integer value) -#revocation_cache_time = 10 - -# (Optional) If defined, indicate whether token data should be -# authenticated or authenticated and encrypted. Acceptable values are -# MAC or ENCRYPT. If MAC, token data is authenticated (with HMAC) in -# the cache. If ENCRYPT, token data is encrypted and authenticated in -# the cache. If the value is not one of these options or empty, -# auth_token will raise an exception on initialization. (string value) -#memcache_security_strategy = - -# (Optional, mandatory if memcache_security_strategy is defined) This -# string is used for key derivation. (string value) -#memcache_secret_key = - -# (Optional) Number of seconds memcached server is considered dead -# before it is tried again. (integer value) -#memcache_pool_dead_retry = 300 - -# (Optional) Maximum total number of open connections to every -# memcached server. (integer value) -#memcache_pool_maxsize = 10 - -# (Optional) Socket timeout in seconds for communicating with a -# memcached server. (integer value) -#memcache_pool_socket_timeout = 3 - -# (Optional) Number of seconds a connection to memcached is held -# unused in the pool before it is closed. (integer value) -#memcache_pool_unused_timeout = 60 - -# (Optional) Number of seconds that an operation will wait to get a -# memcached client connection from the pool. (integer value) -#memcache_pool_conn_get_timeout = 10 - -# (Optional) Use the advanced (eventlet safe) memcached client pool. -# The advanced pool will only work under python 2.x. (boolean value) -#memcache_use_advanced_pool = false - -# (Optional) Indicate whether to set the X-Service-Catalog header. If -# False, middleware will not ask for service catalog on token -# validation and will not set the X-Service-Catalog header. (boolean -# value) -#include_service_catalog = true - -# Used to control the use and type of token binding. Can be set to: -# "disabled" to not check token binding. "permissive" (default) to -# validate binding information if the bind type is of a form known to -# the server and ignore it if not. "strict" like "permissive" but if -# the bind type is unknown the token will be rejected. "required" any -# form of token binding is needed to be allowed. Finally the name of a -# binding method that must be present in tokens. (string value) -#enforce_token_bind = permissive - -# If true, the revocation list will be checked for cached tokens. This -# requires that PKI tokens are configured on the identity server. -# (boolean value) -#check_revocations_for_cached = false - -# Hash algorithms to use for hashing PKI tokens. This may be a single -# algorithm or multiple. The algorithms are those supported by Python -# standard hashlib.new(). The hashes will be tried in the order given, -# so put the preferred one first for performance. The result of the -# first hash will be stored in the cache. This will typically be set -# to multiple values only while migrating from a less secure algorithm -# to a more secure one. Once all the old tokens are expired this -# option should be set to a single value for better performance. (list -# value) -#hash_algorithms = md5 - -# Prefix to prepend at the beginning of the path. Deprecated, use -# identity_uri. (string value) -#auth_admin_prefix = - -# Host providing the admin Identity API endpoint. Deprecated, use -# identity_uri. (string value) -#auth_host = 127.0.0.1 - -# Port of the admin Identity API endpoint. Deprecated, use -# identity_uri. (integer value) -#auth_port = 35357 - -# Protocol of the admin Identity API endpoint (http or https). -# Deprecated, use identity_uri. (string value) -#auth_protocol = https - -# Complete admin Identity API endpoint. This should specify the -# unversioned root endpoint e.g. https://127.0.0.1:35357/ (string -# value) -#identity_uri = - -# This option is deprecated and may be removed in a future release. -# Single shared secret with the Keystone configuration used for -# bootstrapping a Keystone installation, or otherwise bypassing the -# normal authentication process. This option should not be used, use -# `admin_user` and `admin_password` instead. (string value) -#admin_token = - -# Service username. (string value) -#admin_user = - -# Service user password. (string value) -#admin_password = - -# Service tenant name. (string value) -#admin_tenant_name = admin - - -[matchmaker_redis] - -# -# From oslo.messaging -# - -# Host to locate redis. (string value) -#host = 127.0.0.1 - -# Use this port to connect to redis host. (integer value) -#port = 6379 - -# Password for Redis server (optional). (string value) -#password = - - -[matchmaker_ring] - -# -# From oslo.messaging -# - -# Matchmaker ring file (JSON). (string value) -# Deprecated group/name - [DEFAULT]/matchmaker_ringfile -#ringfile = /etc/oslo/matchmaker_ring.json - - -[oslo_messaging_amqp] - -# -# From oslo.messaging -# - -# address prefix used when sending to a specific server (string value) -# Deprecated group/name - [amqp1]/server_request_prefix -#server_request_prefix = exclusive - -# address prefix used when broadcasting to all servers (string value) -# Deprecated group/name - [amqp1]/broadcast_prefix -#broadcast_prefix = broadcast - -# address prefix when sending to any server in group (string value) -# Deprecated group/name - [amqp1]/group_request_prefix -#group_request_prefix = unicast - -# Name for the AMQP container (string value) -# Deprecated group/name - [amqp1]/container_name -#container_name = - -# Timeout for inactive connections (in seconds) (integer value) -# Deprecated group/name - [amqp1]/idle_timeout -#idle_timeout = 0 - -# Debug: dump AMQP frames to stdout (boolean value) -# Deprecated group/name - [amqp1]/trace -#trace = false - -# CA certificate PEM file to verify server certificate (string value) -# Deprecated group/name - [amqp1]/ssl_ca_file -#ssl_ca_file = - -# Identifying certificate PEM file to present to clients (string -# value) -# Deprecated group/name - [amqp1]/ssl_cert_file -#ssl_cert_file = - -# Private key PEM file used to sign cert_file certificate (string -# value) -# Deprecated group/name - [amqp1]/ssl_key_file -#ssl_key_file = - -# Password for decrypting ssl_key_file (if encrypted) (string value) -# Deprecated group/name - [amqp1]/ssl_key_password -#ssl_key_password = - -# Accept clients using either SSL or plain TCP (boolean value) -# Deprecated group/name - [amqp1]/allow_insecure_clients -#allow_insecure_clients = false - - -[oslo_messaging_qpid] - -# -# From oslo.messaging -# - -# Use durable queues in AMQP. (boolean value) -# Deprecated group/name - [DEFAULT]/amqp_durable_queues -# Deprecated group/name - [DEFAULT]/rabbit_durable_queues -#amqp_durable_queues = false - -# Auto-delete queues in AMQP. (boolean value) -# Deprecated group/name - [DEFAULT]/amqp_auto_delete -#amqp_auto_delete = false - -# Send a single AMQP reply to call message. The current behaviour -# since oslo-incubator is to send two AMQP replies - first one with -# the payload, a second one to ensure the other have finish to send -# the payload. We are going to remove it in the N release, but we must -# keep backward compatible at the same time. This option provides such -# compatibility - it defaults to False in Liberty and can be turned on -# for early adopters with a new installations or for testing. Please -# note, that this option will be removed in the Mitaka release. -# (boolean value) -#send_single_reply = false - -# Qpid broker hostname. (string value) -# Deprecated group/name - [DEFAULT]/qpid_hostname -#qpid_hostname = 127.0.0.1 - -# Qpid broker port. (integer value) -# Deprecated group/name - [DEFAULT]/qpid_port -#qpid_port = 5672 - -# Qpid HA cluster host:port pairs. (list value) -# Deprecated group/name - [DEFAULT]/qpid_hosts -#qpid_hosts = $qpid_hostname:$qpid_port - -# Username for Qpid connection. (string value) -# Deprecated group/name - [DEFAULT]/qpid_username -#qpid_username = - -# Password for Qpid connection. (string value) -# Deprecated group/name - [DEFAULT]/qpid_password -#qpid_password = - -# Space separated list of SASL mechanisms to use for auth. (string -# value) -# Deprecated group/name - [DEFAULT]/qpid_sasl_mechanisms -#qpid_sasl_mechanisms = - -# Seconds between connection keepalive heartbeats. (integer value) -# Deprecated group/name - [DEFAULT]/qpid_heartbeat -#qpid_heartbeat = 60 - -# Transport to use, either 'tcp' or 'ssl'. (string value) -# Deprecated group/name - [DEFAULT]/qpid_protocol -#qpid_protocol = tcp - -# Whether to disable the Nagle algorithm. (boolean value) -# Deprecated group/name - [DEFAULT]/qpid_tcp_nodelay -#qpid_tcp_nodelay = true - -# The number of prefetched messages held by receiver. (integer value) -# Deprecated group/name - [DEFAULT]/qpid_receiver_capacity -#qpid_receiver_capacity = 1 - -# The qpid topology version to use. Version 1 is what was originally -# used by impl_qpid. Version 2 includes some backwards-incompatible -# changes that allow broker federation to work. Users should update -# to version 2 when they are able to take everything down, as it -# requires a clean break. (integer value) -# Deprecated group/name - [DEFAULT]/qpid_topology_version -#qpid_topology_version = 1 - - -[oslo_messaging_rabbit] - -# -# From oslo.messaging -# - -# Use durable queues in AMQP. (boolean value) -# Deprecated group/name - [DEFAULT]/amqp_durable_queues -# Deprecated group/name - [DEFAULT]/rabbit_durable_queues -#amqp_durable_queues = false - -# Auto-delete queues in AMQP. (boolean value) -# Deprecated group/name - [DEFAULT]/amqp_auto_delete -#amqp_auto_delete = false - -# Send a single AMQP reply to call message. The current behaviour -# since oslo-incubator is to send two AMQP replies - first one with -# the payload, a second one to ensure the other have finish to send -# the payload. We are going to remove it in the N release, but we must -# keep backward compatible at the same time. This option provides such -# compatibility - it defaults to False in Liberty and can be turned on -# for early adopters with a new installations or for testing. Please -# note, that this option will be removed in the Mitaka release. -# (boolean value) -#send_single_reply = false - -# SSL version to use (valid only if SSL enabled). Valid values are -# TLSv1 and SSLv23. SSLv2, SSLv3, TLSv1_1, and TLSv1_2 may be -# available on some distributions. (string value) -# Deprecated group/name - [DEFAULT]/kombu_ssl_version -#kombu_ssl_version = - -# SSL key file (valid only if SSL enabled). (string value) -# Deprecated group/name - [DEFAULT]/kombu_ssl_keyfile -#kombu_ssl_keyfile = - -# SSL cert file (valid only if SSL enabled). (string value) -# Deprecated group/name - [DEFAULT]/kombu_ssl_certfile -#kombu_ssl_certfile = - -# SSL certification authority file (valid only if SSL enabled). -# (string value) -# Deprecated group/name - [DEFAULT]/kombu_ssl_ca_certs -#kombu_ssl_ca_certs = - -# How long to wait before reconnecting in response to an AMQP consumer -# cancel notification. (floating point value) -# Deprecated group/name - [DEFAULT]/kombu_reconnect_delay -#kombu_reconnect_delay = 1.0 - -# How long to wait before considering a reconnect attempt to have -# failed. This value should not be longer than rpc_response_timeout. -# (integer value) -#kombu_reconnect_timeout = 60 - -# The RabbitMQ broker address where a single node is used. (string -# value) -# Deprecated group/name - [DEFAULT]/rabbit_host -#rabbit_host = 127.0.0.1 - -# The RabbitMQ broker port where a single node is used. (integer -# value) -# Deprecated group/name - [DEFAULT]/rabbit_port -#rabbit_port = 5672 - -# RabbitMQ HA cluster host:port pairs. (list value) -# Deprecated group/name - [DEFAULT]/rabbit_hosts -#rabbit_hosts = $rabbit_host:$rabbit_port - -# Connect over SSL for RabbitMQ. (boolean value) -# Deprecated group/name - [DEFAULT]/rabbit_use_ssl -#rabbit_use_ssl = false - -# The RabbitMQ userid. (string value) -# Deprecated group/name - [DEFAULT]/rabbit_userid -#rabbit_userid = guest - -# The RabbitMQ password. (string value) -# Deprecated group/name - [DEFAULT]/rabbit_password -#rabbit_password = guest - -# The RabbitMQ login method. (string value) -# Deprecated group/name - [DEFAULT]/rabbit_login_method -#rabbit_login_method = AMQPLAIN - -# The RabbitMQ virtual host. (string value) -# Deprecated group/name - [DEFAULT]/rabbit_virtual_host -#rabbit_virtual_host = / - -# How frequently to retry connecting with RabbitMQ. (integer value) -#rabbit_retry_interval = 1 - -# How long to backoff for between retries when connecting to RabbitMQ. -# (integer value) -# Deprecated group/name - [DEFAULT]/rabbit_retry_backoff -#rabbit_retry_backoff = 2 - -# Maximum number of RabbitMQ connection retries. Default is 0 -# (infinite retry count). (integer value) -# Deprecated group/name - [DEFAULT]/rabbit_max_retries -#rabbit_max_retries = 0 - -# Use HA queues in RabbitMQ (x-ha-policy: all). If you change this -# option, you must wipe the RabbitMQ database. (boolean value) -# Deprecated group/name - [DEFAULT]/rabbit_ha_queues -#rabbit_ha_queues = false - -# Number of seconds after which the Rabbit broker is considered down -# if heartbeat's keep-alive fails (0 disable the heartbeat). -# EXPERIMENTAL (integer value) -#heartbeat_timeout_threshold = 60 - -# How often times during the heartbeat_timeout_threshold we check the -# heartbeat. (integer value) -#heartbeat_rate = 2 - -# Deprecated, use rpc_backend=kombu+memory or rpc_backend=fake -# (boolean value) -# Deprecated group/name - [DEFAULT]/fake_rabbit -#fake_rabbit = false - - -[pecan] - -# -# From mistral.config -# - -# Pecan root controller (string value) -#root = mistral.api.controllers.root.RootController - -# A list of modules where pecan will search for applications. (list -# value) -#modules = mistral.api - -# Enables the ability to display tracebacks in the browser and -# interactively debug during development. (boolean value) -#debug = false - -# Enables user authentication in pecan. (boolean value) -#auth_enable = true -auth_enable = false diff --git a/packages/st2mistral/conf/policy.json b/packages/st2mistral/conf/policy.json deleted file mode 100644 index c5df702a..00000000 --- a/packages/st2mistral/conf/policy.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "admin_only": "is_admin:True", - "admin_or_owner": "is_admin:True or project_id:%(project_id)s", - "default": "rule:admin_or_owner", - - "action_executions:delete": "rule:admin_or_owner", - "action_execution:create": "rule:admin_or_owner", - "action_executions:get": "rule:admin_or_owner", - "action_executions:list": "rule:admin_or_owner", - "action_executions:update": "rule:admin_or_owner", - - "actions:create": "rule:admin_or_owner", - "actions:delete": "rule:admin_or_owner", - "actions:get": "rule:admin_or_owner", - "actions:list": "rule:admin_or_owner", - "actions:update": "rule:admin_or_owner", - - "cron_triggers:create": "rule:admin_or_owner", - "cron_triggers:delete": "rule:admin_or_owner", - "cron_triggers:get": "rule:admin_or_owner", - "cron_triggers:list": "rule:admin_or_owner", - - "environments:create": "rule:admin_or_owner", - "environments:delete": "rule:admin_or_owner", - "environments:get": "rule:admin_or_owner", - "environments:list": "rule:admin_or_owner", - "environments:update": "rule:admin_or_owner", - - "executions:create": "rule:admin_or_owner", - "executions:delete": "rule:admin_or_owner", - "executions:get": "rule:admin_or_owner", - "executions:list": "rule:admin_or_owner", - "executions:update": "rule:admin_or_owner", - - "members:create": "rule:admin_or_owner", - "members:delete": "rule:admin_or_owner", - "members:get": "rule:admin_or_owner", - "members:list": "rule:admin_or_owner", - "members:update": "rule:admin_or_owner", - - "services:list": "rule:admin_or_owner", - - "tasks:get": "rule:admin_or_owner", - "tasks:list": "rule:admin_or_owner", - "tasks:update": "rule:admin_or_owner", - - "workbooks:create": "rule:admin_or_owner", - "workbooks:delete": "rule:admin_or_owner", - "workbooks:get": "rule:admin_or_owner", - "workbooks:list": "rule:admin_or_owner", - "workbooks:update": "rule:admin_or_owner", - - "workflows:create": "rule:admin_or_owner", - "workflows:delete": "rule:admin_or_owner", - "workflows:get": "rule:admin_or_owner", - "workflows:list": "rule:admin_or_owner", - "workflows:update": "rule:admin_or_owner" -} diff --git a/packages/st2mistral/conf/rhel-functions-sysvinit b/packages/st2mistral/conf/rhel-functions-sysvinit deleted file mode 100644 index 687535aa..00000000 --- a/packages/st2mistral/conf/rhel-functions-sysvinit +++ /dev/null @@ -1,241 +0,0 @@ -# -*-Shell-script-*- - -# Redhat daemon function with process group change ability -# preserving supplementary groups. -# -daemon() { - # Test syntax. - local gotbase= force= nicelevel corelimit - local pid base= user= nice= bg= pid_file= - local cgroup= - local group= group_opts= suppgroup_opts= - local background= daemoncmd= - nicelevel=0 - while [ "$1" != "${1##[-+]}" ]; do - case $1 in - '') echo $"$0: Usage: daemon [+/-nicelevel] {program}" - return 1;; - --check) - base=$2 - gotbase="yes" - shift 2 - ;; - --check=?*) - base=${1#--check=} - gotbase="yes" - shift - ;; - --user) - user=$2 - shift 2 - ;; - --user=?*) - user=${1#--user=} - shift - ;; - --group) - group=$2 - shift 2 - ;; - --group=?*) - group=${1#--group=} - shift - ;; - --pidfile) - pid_file=$2 - shift 2 - ;; - --pidfile=?*) - pid_file=${1#--pidfile=} - shift - ;; - --force) - force="force" - shift - ;; - --background) - background="yes" - shift - ;; - [-+][0-9]*) - nice="nice -n $1" - shift - ;; - *) echo $"$0: Usage: daemon [+/-nicelevel] {program}" - return 1;; - esac - done - - # Save basename. - [ -z "$gotbase" ] && base=${1##*/} - - # See if it's already running. Look *only* at the pid file. - __pids_var_run "$base" "$pid_file" - - [ -n "$pid" -a -z "$force" ] && return - - # make sure it doesn't core dump anywhere unless requested - corelimit="ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0}" - - # if they set NICELEVEL in /etc/sysconfig/foo, honor it - [ -n "${NICELEVEL:-}" ] && nice="nice -n $NICELEVEL" - - # if they set CGROUP_DAEMON in /etc/sysconfig/foo, honor it - if [ -n "${CGROUP_DAEMON}" ]; then - if [ ! -x /bin/cgexec ]; then - echo -n "Cgroups not installed"; warning - echo - else - cgroup="/bin/cgexec"; - for i in $CGROUP_DAEMON; do - cgroup="$cgroup -g $i"; - done - fi - fi - - # Echo daemon - [ "${BOOTUP:-}" = "verbose" -a -z "${LSB:-}" ] && echo -n " $base" - - # Group and supplementary group list options (-G grp1 -G grp2). - # If group is not overrided runuser will pick up supplementary groups, - # so no need to set them specifically. - if [ ! -z "$group" ]; then - group_opts="-g $group" - suppgroup_opts=$(id -nG $user | sed 's/^\| / -G /g') - fi - - # Wrap daemon command call with nohup, if background options is given. - [ -z "$background" ] && daemoncmd="$*" || - daemoncmd="nohup /dev/null 2>&1 $* &" - - # And start it up. - : ${user:=root} - $cgroup $nice runuser $group_opts $suppgroup_opts $user \ - -s /bin/bash -c "$corelimit >/dev/null 2>&1 ; $daemoncmd" - - # Write completion message only when starting a real daemon. - if [ -z "$background" ]; then - [ "$?" -eq 0 ] && success $"$base startup" || failure $"$base startup" - fi -} - - -# Write pid of a starting daemon into the pidfile. -# By default wait for the pid up to 3 seconds. -pgrep_waitforpid() { - local pid= pid_file= base= trailer= - local pgrep_opts="-n" timeout="3.0" - - while [ "$1" != "${1##--}" ]; do - case $1 in - '') echo $"$0: Usage: pgrep_waitforpid {program}" - return 1;; - --masterpid) - pgrep_opts="-o" - shift - ;; - --pidfile) - pid_file=$2 - shift 2 - ;; - --pidfile=?*) - pid_file=${1#--pidfile=} - shift - ;; - --scriptname) - base=$2 - shift 2 - ;; - --scriptname=?*) - base=${1#--scriptname=} - shift - ;; - --timeout) - timeout=$2 - shift 2 - ;; - --timeout=?*) - timeout=${1#--timeout=} - shift - ;; - - *) echo $"$0: Usage: pgrep_waitforpid {program}" - return 1;; - esac - done - - # Locate pid of a started daemon (oldest pid in case if masterpid is given). - [ -z "$scriptname"] || trailer=".*${scriptname}" - - # Check for pid in a cycle until found or timed-out. - # - for s in $(seq 0.0 0.1 $timeout); do - pid=$(pgrep $pgrep_opts -f "$1${trailer}") - if [ ! -z "$pid" ]; then - # In case of false-positve during forking, double check that pid exists. - sleep 0.1; checkpid $pid && break || continue - else - sleep 0.1 - fi - done - - # Define pid_file path. - [ -z "$base" ] && base=${1##*/} - pid_file=${pid_file:-/var/run/$base.pid} - - if checkpid $pid; then - echo $pid > $pid_file - success $"$base startup" - else - failure $"$base startup" - fi -} - -# Waits for a process startup and when it writes the pidfile. -waitforpid() { - local pid= pid_file= base= timeout="3.0" - - while [ "$1" != "${1##--}" ]; do - case $1 in - '') echo $"$0: Usage: waitforpid [options]" - return 1;; - --pidfile) - pid_file=$2 - shift 2 - ;; - --pidfile=?*) - pid_file=${1#--pidfile=} - shift - ;; - --timeout) - timeout=$2 - shift 2 - ;; - --timeout=?*) - timeout=${1#--timeout=} - shift - ;; - - *) echo $"$0: Usage: waitforpid [options]" - return 1;; - esac - done - - # Define pid_file path. - [ -z "$base" ] && base=${1##*/} - pid_file=${pid_file:-/var/run/$base.pid} - - # Check for pid in a cycle until found or timed-out. - # - for s in $(seq 0.0 0.1 $timeout); do - if [ -f "$pid_file" ]; then - # In case process dies or anything, we keep iterating - pid=$(cat $pid_file) - sleep 0.1; checkpid $pid && break || continue - else - sleep 0.1 - fi - done - - checkpid $pid && success $"$base startup" || failure $"$base startup" -} diff --git a/packages/st2mistral/debian/README b/packages/st2mistral/debian/README deleted file mode 100644 index 5d5bcf47..00000000 --- a/packages/st2mistral/debian/README +++ /dev/null @@ -1,6 +0,0 @@ -The Debian Package st2mistral ----------------------------- - -Comments regarding the Package - - -- StackStorm Engineering Mon, 14 Sep 2015 16:42:52 +0000 diff --git a/packages/st2mistral/debian/README.Debian b/packages/st2mistral/debian/README.Debian deleted file mode 100644 index f01a2f41..00000000 --- a/packages/st2mistral/debian/README.Debian +++ /dev/null @@ -1,6 +0,0 @@ -st2mistral for Debian ---------------------- - - - - -- StackStorm Engineering Mon, 14 Sep 2015 16:42:52 +0000 diff --git a/packages/st2mistral/debian/README.source b/packages/st2mistral/debian/README.source deleted file mode 100644 index 301da38b..00000000 --- a/packages/st2mistral/debian/README.source +++ /dev/null @@ -1,10 +0,0 @@ -st2mistral for Debian ---------------------- - - - - - - -- StackStorm Engineering <> Mon, 14 Sep 2015 16:42:52 +0000 - diff --git a/packages/st2mistral/debian/changelog b/packages/st2mistral/debian/changelog deleted file mode 100644 index 6c73909c..00000000 --- a/packages/st2mistral/debian/changelog +++ /dev/null @@ -1,5 +0,0 @@ -st2mistral (0.1.0) unstable; urgency=low - - * Initial Release. - - -- StackStorm Engineering Mon, 14 Sep 2015 16:42:52 +0000 diff --git a/packages/st2mistral/debian/compat b/packages/st2mistral/debian/compat deleted file mode 100644 index ec635144..00000000 --- a/packages/st2mistral/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/packages/st2mistral/debian/conffiles b/packages/st2mistral/debian/conffiles deleted file mode 100644 index 9c3d1427..00000000 --- a/packages/st2mistral/debian/conffiles +++ /dev/null @@ -1 +0,0 @@ -/etc/logrotate.d/mistral diff --git a/packages/st2mistral/debian/control b/packages/st2mistral/debian/control deleted file mode 100644 index 4275982b..00000000 --- a/packages/st2mistral/debian/control +++ /dev/null @@ -1,17 +0,0 @@ -Source: st2mistral -Section: Python -Priority: optional -Maintainer: StackStorm Engineering -Build-Depends: debhelper (>= 9), python, dh-virtualenv (>= 0.8) -Standards-Version: 3.9.5 -Homepage: https://stackstorm.com/ -Vcs-Git: git://github.com/stackstorm/mistral.git -Vcs-Browser: https://github.com/stackstorm/mistral - -Package: st2mistral -Architecture: any -Pre-Depends: dpkg (>= 1.16.16), python2.7, adduser -Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, procps -Description: st2 Mistral workflow service. - Task orchestration and workflow engine with powerful strategies like parallelism, loops, retries, - nested tasks, execution order capabilities. Rules defined in YAML, extended with YAQL expressions. diff --git a/packages/st2mistral/debian/copyright b/packages/st2mistral/debian/copyright deleted file mode 100644 index e4ee0412..00000000 --- a/packages/st2mistral/debian/copyright +++ /dev/null @@ -1,33 +0,0 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: st2mistral -Source: - -Files: * -Copyright: - -License: Apache-2.0 - -Files: debian/* -Copyright: 2015 StackStorm Engineering <> -License: Apache-2.0 - -License: Apache-2.0 - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - . - http://www.apache.org/licenses/LICENSE-2.0 - . - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - . - On Debian systems, the complete text of the Apache version 2.0 license - can be found in "/usr/share/common-licenses/Apache-2.0". - -# Please also look if there are files or directories which have a -# different copyright/license attached and list them here. -# Please avoid to pick license terms that are more restrictive than the -# packaged work, as it may make Debian's contributions unacceptable upstream. diff --git a/packages/st2mistral/debian/docs b/packages/st2mistral/debian/docs deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/st2mistral/debian/install b/packages/st2mistral/debian/install deleted file mode 100644 index 00fa030a..00000000 --- a/packages/st2mistral/debian/install +++ /dev/null @@ -1,3 +0,0 @@ -conf/mistral.conf /etc/mistral -bin/mistral /usr/bin -conf/policy.json /etc/mistral diff --git a/packages/st2mistral/debian/mistral-api.init b/packages/st2mistral/debian/mistral-api.init deleted file mode 100644 index e54b79e2..00000000 --- a/packages/st2mistral/debian/mistral-api.init +++ /dev/null @@ -1,185 +0,0 @@ -#!/bin/sh -### BEGIN INIT INFO -# Provides: mistral-api -# Required-Start: $local_fs $network $remote_fs $syslog -# Required-Stop: $local_fs $network $remote_fs $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Workflow as a Service mistral api -# Description: Debain sysvinit for mistral. -# -### END INIT INFO - -# Author: StackStorm Engineering - -# Do NOT "set -e" - -# PATH should only include /usr/* if it runs after the mountnfs.sh script -PATH=/sbin:/usr/sbin:/bin:/usr/bin -DESC="mistral" -NAME=mistral-api -DAEMON=/opt/stackstorm/mistral/bin/gunicorn -COMPONENTS="api,engine,executor,notifier" -RUN_DIR="/var/run/mistral" -PIDFILE="${RUN_DIR}/$NAME.pid" -SCRIPTNAME=/etc/init.d/$NAME -RUNAS_USER="mistral" -RUNAS_GROUP="mistral" -API_ARGS="--log-file /var/log/mistral/mistral-api.log -b 127.0.0.1:8989 -w 2 mistral.api.wsgi --graceful-timeout 10 --pid ${PIDFILE}" -UMASK=022 - - -# Exit if the package is not installed -[ -x "$DAEMON" ] || exit 0 - -# Read configuration variable file if it is present -set -o allexport -[ -r /etc/default/mistral ] && . /etc/default/mistral -set +o allexport -DAEMON_ARGS="${API_ARGS}" - -# Load the VERBOSE setting and other rcS variables -. /lib/init/vars.sh - -# Define LSB log_* functions. -# Depend on lsb-base (>= 3.2-14) to ensure that this file is present -# and status_of_proc is working. -. /lib/lsb/init-functions - -# Source our helpers -. /opt/stackstorm/mistral/share/sysvinit/helpers - - -# -# Check if service is running (docker fail-safe) -# returns: 0 - not running, 1 - running -# -lsb_running() -{ - local retval=1 pid="$(cat $PIDFILE 2>/dev/null)" - [ ! -z $pid ] && [ -d /proc/$pid ] && \ - cat /proc/$pid/cmdline | grep -q $DAEMON && retval=0 - return $retval -} - -# -# Function that starts the daemon/service -# -do_start() -{ - # Return - # 0 if daemon has been started - # 1 if daemon was already running - # 2 if daemon could not be started - lsb_running && return 1 - - # Check if ${RUN_DIR} exists, if not create. Otherwise the service will not start. - [ -d ${RUN_DIR} ] || install -m 755 -o ${RUNAS_USER} -g root -d ${RUN_DIR} - - start-stop-daemon --start --quiet --chuid $RUNAS_USER:$RUNAS_GROUP --umask $UMASK --background --pidfile $PIDFILE \ - --exec $DAEMON -- $DAEMON_ARGS \ - || return 2 -} - -# -# Function that stops the daemon/service -# -do_stop() -{ - # Return - # 0 if daemon has been stopped - # 1 if daemon was already stopped - # 2 if daemon could not be stopped - # other if a failure occurred - start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE - RETVAL="$?" - [ "$RETVAL" = 2 ] && return 2 - # Wait for children to finish too if this is a daemon that forks - # and if the daemon is only ever run from this initscript. - # If the above conditions are not satisfied then add some other code - # that waits for the process to drop all resources that could be - # needed by services started subsequently. A last resort is to - # sleep for some time. - start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON - [ "$?" = 2 ] && return 2 - # Many daemons don't delete their pidfiles when they exit. - rm -f $PIDFILE - return "$RETVAL" -} - -# -# Function that sends a SIGHUP to the daemon/service -# -do_reload() { - # - # If the daemon can reload its configuration without - # restarting (for example, when it is sent a SIGHUP), - # then implement that here. - # - start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE - return 0 -} - - -# NB! Exit if mistral-api is disabled -enabled_list -q api || exit 0 - -case "$1" in - start) - [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" - do_start - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - stop) - [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" - do_stop - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - status) - status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? - ;; - #reload|force-reload) - # - # If do_reload() is not implemented then leave this commented out - # and leave 'force-reload' as an alias for 'restart'. - # - #log_daemon_msg "Reloading $DESC" "$NAME" - #do_reload - #log_end_msg $? - #;; - restart|force-reload) - # - # If the "reload" option is implemented then remove the - # 'force-reload' alias - # - log_daemon_msg "Restarting $DESC" "$NAME" - do_stop - case "$?" in - 0|1) - do_start - case "$?" in - 0) log_end_msg 0 ;; - 1) log_end_msg 1 ;; # Old process is still running - *) log_end_msg 1 ;; # Failed to start - esac - ;; - *) - # Failed to stop - log_end_msg 1 - ;; - esac - ;; - *) - #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 - echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 - exit 3 - ;; -esac - -: diff --git a/packages/st2mistral/debian/mistral-server.init b/packages/st2mistral/debian/mistral-server.init deleted file mode 100644 index ac80b5c1..00000000 --- a/packages/st2mistral/debian/mistral-server.init +++ /dev/null @@ -1,184 +0,0 @@ -#!/bin/sh -### BEGIN INIT INFO -# Provides: mistral-server -# Required-Start: $local_fs $network $remote_fs $syslog -# Required-Stop: $local_fs $network $remote_fs $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Workflow as a Service mistral for engine/executor -# Description: Debain sysvinit for mistral. -# -### END INIT INFO - -# Author: StackStorm Engineering - -# Do NOT "set -e" - -# PATH should only include /usr/* if it runs after the mountnfs.sh script -PATH=/sbin:/usr/sbin:/bin:/usr/bin -DESC="mistral" -NAME=mistral-server -DAEMON=/opt/stackstorm/mistral/bin/$NAME -COMPONENTS="api,engine,executor,notifier" -SERVER_ARGS="--config-file /etc/mistral/mistral.conf --log-file /var/log/mistral/mistral-server.log" -RUN_DIR="/var/run/mistral" -PIDFILE="${RUN_DIR}/$NAME.pid" -SCRIPTNAME=/etc/init.d/$NAME -RUNAS_USER="mistral" -RUNAS_GROUP="mistral" -UMASK=022 - -# Exit if the package is not installed -[ -x "$DAEMON" ] || exit 0 - -# Read configuration variable file if it is present -set -o allexport -[ -r /etc/default/mistral ] && . /etc/default/mistral -set +o allexport - -# Load the VERBOSE setting and other rcS variables -. /lib/init/vars.sh - -# Define LSB log_* functions. -# Depend on lsb-base (>= 3.2-14) to ensure that this file is present -# and status_of_proc is working. -. /lib/lsb/init-functions - -# Source our helpers -. /opt/stackstorm/mistral/share/sysvinit/helpers - - -# -# Check if service is running (docker fail-safe) -# returns: 0 - not running, 1 - running -# -lsb_running() -{ - local retval=1 pid="$(cat $PIDFILE 2>/dev/null)" - [ ! -z $pid ] && [ -d /proc/$pid ] && \ - cat /proc/$pid/cmdline | grep -q $DAEMON && retval=0 - return $retval -} - -# -# Function that starts the daemon/service -# -do_start() -{ - # Return - # 0 if daemon has been started - # 1 if daemon was already running - # 2 if daemon could not be started - lsb_running && return 1 - - # Check if ${RUN_DIR} exists, if not create. Otherwise the service will not start. - [ -d ${RUN_DIR} ] || install -m 755 -o ${RUNAS_USER} -g root -d ${RUN_DIR} - - start-stop-daemon --start --quiet --chuid $RUNAS_USER:$RUNAS_GROUP --umask $UMASK --background --make-pidfile --pidfile $PIDFILE \ - --exec $DAEMON -- $DAEMON_ARGS \ - || return 2 -} - -# -# Function that stops the daemon/service -# -do_stop() -{ - # Return - # 0 if daemon has been stopped - # 1 if daemon was already stopped - # 2 if daemon could not be stopped - # other if a failure occurred - start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE - RETVAL="$?" - [ "$RETVAL" = 2 ] && return 2 - # Wait for children to finish too if this is a daemon that forks - # and if the daemon is only ever run from this initscript. - # If the above conditions are not satisfied then add some other code - # that waits for the process to drop all resources that could be - # needed by services started subsequently. A last resort is to - # sleep for some time. - start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON - [ "$?" = 2 ] && return 2 - # Many daemons don't delete their pidfiles when they exit. - rm -f $PIDFILE - return "$RETVAL" -} - -# -# Function that sends a SIGHUP to the daemon/service -# -do_reload() { - # - # If the daemon can reload its configuration without - # restarting (for example, when it is sent a SIGHUP), - # then implement that here. - # - start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE - return 0 -} - - -# Exit if server components are disabled, otherwise inject them into args. -enabled_list -q server || exit 0 -DAEMON_ARGS="--server $(enabled_list server) ${SERVER_ARGS}" - -case "$1" in - start) - [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" - do_start - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - stop) - [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" - do_stop - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - status) - status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? - ;; - #reload|force-reload) - # - # If do_reload() is not implemented then leave this commented out - # and leave 'force-reload' as an alias for 'restart'. - # - #log_daemon_msg "Reloading $DESC" "$NAME" - #do_reload - #log_end_msg $? - #;; - restart|force-reload) - # - # If the "reload" option is implemented then remove the - # 'force-reload' alias - # - log_daemon_msg "Restarting $DESC" "$NAME" - do_stop - case "$?" in - 0|1) - do_start - case "$?" in - 0) log_end_msg 0 ;; - 1) log_end_msg 1 ;; # Old process is still running - *) log_end_msg 1 ;; # Failed to start - esac - ;; - *) - # Failed to stop - log_end_msg 1 - ;; - esac - ;; - *) - #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 - echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 - exit 3 - ;; -esac - -: diff --git a/packages/st2mistral/debian/mistral.init b/packages/st2mistral/debian/mistral.init deleted file mode 100644 index f13f87eb..00000000 --- a/packages/st2mistral/debian/mistral.init +++ /dev/null @@ -1,131 +0,0 @@ -#!/bin/sh -### BEGIN INIT INFO -# Provides: mistral -# Required-Start: $local_fs $network $remote_fs $syslog -# Required-Stop: $local_fs $network $remote_fs $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Workflow as a Service mistral -# Description: Debain sysvinit for mistral. -# -### END INIT INFO - -# Author: StackStorm Engineering - -# Do NOT "set -e" - -# PATH should only include /usr/* if it runs after the mountnfs.sh script -PATH=/sbin:/usr/sbin:/bin:/usr/bin -DESC="mistral" -NAME=mistral -SCRIPTNAME=/etc/init.d/$NAME - -# Read configuration variable file if it is present -set -o allexport -[ -r /etc/default/$NAME ] && . /etc/default/$NAME -set +o allexport - -# Load the VERBOSE setting and other rcS variables -. /lib/init/vars.sh - -# Define LSB log_* functions. -# Depend on lsb-base (>= 3.2-14) to ensure that this file is present -# and status_of_proc is working. -. /lib/lsb/init-functions - - -mistral_wrapper() { - local action="$1" rs= retval=0 - /etc/init.d/mistral-api $action - rs=$?; [ $rs -gt $retval ] && retval=$rs - /etc/init.d/mistral-server $action - rs=$?; [ $rs -gt $retval ] && retval=$rs - return $retval -} - -# -# Function that starts the daemon/service -# -do_start() -{ - mistral_wrapper start -} - -# -# Function that stops the daemon/service -# -do_stop() -{ - mistral_wrapper stop -} - -# -# Function that sends a SIGHUP to the daemon/service -# -do_reload() { - mistral_wrapper reload -} - -do_status() { - mistral_wrapper status -} - -case "$1" in - start) - [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" - do_start - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - stop) - [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" - do_stop - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - status) - do_status && exit 0 || exit $? - ;; - #reload|force-reload) - # - # If do_reload() is not implemented then leave this commented out - # and leave 'force-reload' as an alias for 'restart'. - # - #log_daemon_msg "Reloading $DESC" "$NAME" - #do_reload - #log_end_msg $? - #;; - restart|force-reload) - # - # If the "reload" option is implemented then remove the - # 'force-reload' alias - # - log_daemon_msg "Restarting $DESC" "$NAME" - do_stop - case "$?" in - 0|1) - do_start - case "$?" in - 0) log_end_msg 0 ;; - 1) log_end_msg 1 ;; # Old process is still running - *) log_end_msg 1 ;; # Failed to start - esac - ;; - *) - # Failed to stop - log_end_msg 1 - ;; - esac - ;; - *) - #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 - echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 - exit 3 - ;; -esac - -: diff --git a/packages/st2mistral/debian/postinst b/packages/st2mistral/debian/postinst deleted file mode 100644 index c9b45f71..00000000 --- a/packages/st2mistral/debian/postinst +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh -# postinst script for st2mistral -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-remove' -# * `abort-deconfigure' `in-favour' -# `removing' -# -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - -MISTRAL_USER=mistral -UPGRADESTAMP="/tmp/.stamp-stackstorm-st2mistral-deb-package" -upgrading=0 - -## Permissions of files which should be set on install -SET_PERMS=$(cat <&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/packages/st2mistral/debian/preinst b/packages/st2mistral/debian/preinst deleted file mode 100644 index c2b6cc43..00000000 --- a/packages/st2mistral/debian/preinst +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh -# preinst script for st2mistral -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `install' -# * `install' -# * `upgrade' -# * `abort-upgrade' -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - -MISTRAL_USER=mistral -UPGRADESTAMP="/tmp/.stamp-stackstorm-st2-deb-package" - -## Create stackstorm users and groups -create_users() { - # create st2 user (services user) - (id $MISTRAL_USER 1>/dev/null 2>&1) || - adduser --group --disabled-password --no-create-home --system $MISTRAL_USER -} - -case "$1" in - install) - create_users - ;; - upgrade) - create_users - touch $UPGRADESTAMP - ;; - abort-upgrade) - ;; - *) - echo "preinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/packages/st2mistral/debian/rules b/packages/st2mistral/debian/rules deleted file mode 100755 index 8c348f4f..00000000 --- a/packages/st2mistral/debian/rules +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/make -f -# DH_VERBOSE = 1 - -# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/* -#DPKG_EXPORT_BUILDFLAGS = 1 -#include /usr/share/dpkg/default.mk - -# Virtualenv and pip should be updated (better not to use the distro defaults). -# Updated ones can be found under /use/local. -PATH = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -WHEELDIR ?= /tmp/wheelhouse -DH_VIRTUALENV_INSTALL_ROOT := /opt/stackstorm -export DH_VIRTUALENV_INSTALL_ROOT - -%: - dh $@ --with python-virtualenv - - -override_dh_installdirs: - dh_installdirs - # Restore dh_auto_install behaviour, because it was removed by dh_virtualenv - # dh_auto_install same with: - $(MAKE) install - -override_dh_installinit: - # So far don't start services - dh_installinit --no-start --name=mistral - dh_installinit --no-start --name=mistral-api - dh_installinit --no-start --name=mistral-server - -override_dh_installdeb: - $(MAKE) post_install - dh_installdeb - -override_dh_virtualenv: - # NB! Use '--no-download' arg for 'virtualenv' is required, - # otherwise it downloads latest PIP version instead of bundled/pinned one. - dh_virtualenv --extra-virtualenv-arg='--no-download' \ - --extra-pip-arg '--find-links=$(WHEELDIR)' \ - --extra-pip-arg '--no-index' --install-suffix mistral --no-test diff --git a/packages/st2mistral/debian/source/format b/packages/st2mistral/debian/source/format deleted file mode 100644 index 89ae9db8..00000000 --- a/packages/st2mistral/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (native) diff --git a/packages/st2mistral/debian/st2mistral.dirs b/packages/st2mistral/debian/st2mistral.dirs deleted file mode 100644 index 3598d4ff..00000000 --- a/packages/st2mistral/debian/st2mistral.dirs +++ /dev/null @@ -1,4 +0,0 @@ -/etc/mistral -/var/log/mistral -/var/run/mistral -/etc/logrotate.d diff --git a/packages/st2mistral/rpm/mistral-api.init b/packages/st2mistral/rpm/mistral-api.init deleted file mode 100644 index d484160a..00000000 --- a/packages/st2mistral/rpm/mistral-api.init +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/sh -# -### BEGIN INIT INFO -# Provides: mistral-api -# Required-Start: $local_fs $network $named $remote_fs $syslog -# Required-Stop: $local_fs $network $named $remote_fs $syslog -# Short-Description: mistral service -# Description: Mistral workflow service api -### END INIT INFO - -# mistral This shell script takes care of starting and stopping -# mistral daemon. -# chkconfig: - 85 15 -# description: Mistral workflow service api -# processname: mistral - -# Source function library. -. /etc/rc.d/init.d/functions - -# Source networking configuration. -. /etc/sysconfig/network - -# Source our sysv functions -. /opt/stackstorm/mistral/share/sysvinit/helpers -. /opt/stackstorm/mistral/share/sysvinit/functions - - -DESC="mistral" -NAME=mistral-api -DAEMON=/opt/stackstorm/mistral/bin/gunicorn -COMPONENTS="api,engine,executor,notifier" -PIDFILE=/var/run/mistral/$NAME.pid -API_ARGS="--log-file /var/log/mistral/mistral-api.log -b 127.0.0.1:8989 -w 2 mistral.api.wsgi --graceful-timeout 10 --pid ${PIDFILE}" -RUNAS_USER="mistral" - -lockfile=/var/lock/subsys/$NAME - -# Exit if the package is not installed -[ -x "$DAEMON" ] || exit 5 - -# Read configuration variable file if it is present -set -o allexport -[ -r /etc/sysconfig/mistral ] && . /etc/sysconfig/mistral -set +o allexport -DAEMON_ARGS="${API_ARGS}" - -# NB! Exit if mistral-api is disabled -enabled_list -q api || exit 0 - - -start() { - echo -n $"Starting $NAME: " - daemon --background --check=${NAME} --user=${RUNAS_USER} \ - $DAEMON $DAEMON_ARGS - waitforpid --pidfile=${PIDFILE} - retval=$? - echo - [ $retval -eq 0 ] && touch $lockfile || return $retval -} - -stop() { - echo -n $"Stopping $NAME: " - killproc -p $PIDFILE $DAEMON - retval=$? - echo - [ $retval -eq 0 ] && rm -f $lockfile || return $retval -} - -restart() { - stop - start -} - -reload() { - restart -} - -force_reload() { - restart -} - -rh_status() { - # run checks to determine if the service is running or use generic status - status -p $PIDFILE $NAME -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - - -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - exit 2 -esac -exit $? diff --git a/packages/st2mistral/rpm/mistral-api.service b/packages/st2mistral/rpm/mistral-api.service deleted file mode 100644 index 054d7c12..00000000 --- a/packages/st2mistral/rpm/mistral-api.service +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=Mistral workflow service api -After=network.target - -[Service] -Type=simple -User=mistral -Group=mistral -Environment="COMPONENTS=api,engine,executor,notifier" -Environment="API_ARGS=--log-file /var/log/mistral/mistral-api.log -b 127.0.0.1:8989 -w 2 mistral.api.wsgi --graceful-timeout 10" -EnvironmentFile=-/etc/sysconfig/mistral -ExecStart=/bin/sh -c ". /opt/stackstorm/mistral/share/sysvinit/helpers; enabled_list -q api || exit 0; exec /opt/stackstorm/mistral/bin/gunicorn $API_ARGS" -PrivateTmp=true - -[Install] -WantedBy=multi-user.target diff --git a/packages/st2mistral/rpm/mistral-server.init b/packages/st2mistral/rpm/mistral-server.init deleted file mode 100644 index e3b6eb4d..00000000 --- a/packages/st2mistral/rpm/mistral-server.init +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/sh -# -### BEGIN INIT INFO -# Provides: mistral-server -# Required-Start: $local_fs $network $named $remote_fs $syslog -# Required-Stop: $local_fs $network $named $remote_fs $syslog -# Short-Description: mistral service -# Description: Mistral workflow service (engine/executor) -### END INIT INFO - -# mistral This shell script takes care of starting and stopping -# mistral daemon. -# chkconfig: - 85 15 -# description: Mistral workflow service (engine/executor) -# processname: mistral - -# Source function library. -. /etc/rc.d/init.d/functions - -# Source networking configuration. -. /etc/sysconfig/network - -# Source our sysv functions -. /opt/stackstorm/mistral/share/sysvinit/helpers -. /opt/stackstorm/mistral/share/sysvinit/functions - -DESC="mistral" -NAME=mistral-server -DAEMON=/opt/stackstorm/mistral/bin/mistral-server -COMPONENTS="api,engine,executor,notifier" -SERVER_ARGS="--config-file /etc/mistral/mistral.conf --log-file /var/log/mistral/mistral-server.log" -PIDFILE=/var/run/mistral/$NAME.pid -RUNAS_USER="mistral" - -lockfile=/var/lock/subsys/$NAME - -# Exit if the package is not installed -[ -x "$DAEMON" ] || exit 5 - -# Read configuration variable file if it is present -set -o allexport -[ -r /etc/sysconfig/mistral ] && . /etc/sysconfig/mistral -set +o allexport - - -# NB! Exit if mistral-server is disabled -enabled_list -q server || exit 0 -DAEMON_ARGS="--server $(enabled_list server) ${SERVER_ARGS}" - - -start() { - echo -n $"Starting $NAME: " - daemon --background --check=${NAME} --user=${RUNAS_USER} \ - $DAEMON $DAEMON_ARGS - pgrep_waitforpid --scriptname=${NAME} --pidfile=${PIDFILE} ${DAEMON} - retval=$? - echo - [ $retval -eq 0 ] && touch $lockfile || return $retval -} - -stop() { - echo -n $"Stopping $NAME: " - killproc -p $PIDFILE $DAEMON - retval=$? - echo - [ $retval -eq 0 ] && rm -f $lockfile || return $retval -} - -restart() { - stop - start -} - -reload() { - restart -} - -force_reload() { - restart -} - -rh_status() { - # run checks to determine if the service is running or use generic status - status -p $PIDFILE $NAME -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - - -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - exit 2 -esac -exit $? diff --git a/packages/st2mistral/rpm/mistral-server.service b/packages/st2mistral/rpm/mistral-server.service deleted file mode 100644 index d086a981..00000000 --- a/packages/st2mistral/rpm/mistral-server.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=Mistral workflow service (engine/executor) -After=network.target - -[Service] -Type=simple -User=mistral -Group=mistral -Environment="SERVER_ARGS=--config-file /etc/mistral/mistral.conf --log-file /var/log/mistral/mistral-server.log" -Environment="COMPONENTS=api,engine,executor,notifier" -EnvironmentFile=-/etc/sysconfig/mistral -ExecStart=/bin/sh -c ". /opt/stackstorm/mistral/share/sysvinit/helpers; enabled_list -q server || exit 0; exec /opt/stackstorm/mistral/bin/mistral-server --server $(enabled_list server) $SERVER_ARGS" - -[Install] -WantedBy=multi-user.target diff --git a/packages/st2mistral/rpm/mistral.init b/packages/st2mistral/rpm/mistral.init deleted file mode 100644 index e07e1edf..00000000 --- a/packages/st2mistral/rpm/mistral.init +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/sh -# -### BEGIN INIT INFO -# Provides: mistral -# Required-Start: $local_fs $network $named $remote_fs $syslog -# Required-Stop: $local_fs $network $named $remote_fs $syslog -# Short-Description: mistral service -# Description: Mistral wrapper service -### END INIT INFO - -# mistral This shell script takes care of starting and stopping -# mistral daemon. -# chkconfig: - 85 15 -# description: Mistral wrapper service -# processname: mistral - - -PATH=/sbin:/usr/sbin:/bin:/usr/bin -DESC="mistral" -NAME=mistral - -# Read configuration variable file if it is present -set -o allexport -[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME -set +o allexport - - -# Mistral wrapper passes execution to mistral-api and mistral-server -mistral_wrapper() { - local action="$1" rs= retval=0 - /etc/init.d/mistral-api $action - rs=$?; [ $rs -gt $retval ] && retval=$rs - /etc/init.d/mistral-server $action - rs=$?; [ $rs -gt $retval ] && retval=$rs - return $retval -} - -start() { - mistral_wrapper start -} - -stop() { - mistral_wrapper stop -} - -restart() { - stop - start -} - -reload() { - restart -} - -force_reload() { - restart -} - -rh_status() { - mistral_wrapper status -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - - -case "$1" in - start) - $1 - ;; - stop) - $1 - ;; - restart) - $1 - ;; - reload) - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - exit 2 -esac -exit $? diff --git a/packages/st2mistral/rpm/mistral.service b/packages/st2mistral/rpm/mistral.service deleted file mode 100644 index e1e4f20a..00000000 --- a/packages/st2mistral/rpm/mistral.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Mistral workflow service invocation wrapper -After=network.target - -[Service] -Type=oneshot -EnvironmentFile=-/etc/sysconfig/mistral -ExecStartPost=/usr/bin/systemctl start mistral-api mistral-server -ExecStop=/usr/bin/systemctl stop mistral-api mistral-server -ExecStart=/bin/sh -c true -RemainAfterExit=true - -[Install] -WantedBy=multi-user.target diff --git a/packages/st2mistral/rpm/st2mistral.spec b/packages/st2mistral/rpm/st2mistral.spec deleted file mode 100644 index 13fa7558..00000000 --- a/packages/st2mistral/rpm/st2mistral.spec +++ /dev/null @@ -1,78 +0,0 @@ -%define package st2mistral -%define venv_name mistral -%define svc_user mistral -%define version %(echo -n "${MISTRAL_VERSION:-0.1}") -%define release %(echo -n "${MISTRAL_RELEASE:-1}") - -%define _sourcedir ./ -%define _builddir %{SOURCE0} -%include rpmspec/helpers.spec -%include rpmspec/package_venv.spec - -Name: %{package} -Version: %{version} -Release: %{release} -Group: System/Management -License: Apache 2.0 -Url: https://github.com/StackStorm/mistral -Source0: . -%if 0%{?use_st2python} -Requires: st2python, bash, procps -%else -Requires: bash, procps -%endif -Provides: openstack-mistral -Summary: st2 Mistral workflow service - - -%description - Task orchestration and workflow engine with powerful strategies like parallelism, loops, retries, - nested tasks, execution order capabilities. Rules defined in YAML, extended with YAQL expressions. - -%define _builddir %{SOURCE0} - -%install - %default_install - %pip_install_venv - %service_install mistral mistral-api mistral-server - make post_install DESTDIR=%{?buildroot} - %{!?use_systemd:install -D -m644 conf/rhel-functions-sysvinit %{buildroot}/opt/stackstorm/mistral/share/sysvinit/functions} - - %cleanup_python_abspath - -%prep - rm -rf %{buildroot} - mkdir -p %{buildroot} - -%clean - rm -rf %{buildroot} - -%pre - adduser --no-create-home --system --user-group %{svc_user} 2>/dev/null - exit 0 - -%post - %service_post mistral mistral-api mistral-server - -%preun - %service_preun mistral mistral-api mistral-server - -%postun - %service_postun mistral mistral-api mistral-server - -%files - %{_bindir}/mistral - /opt/stackstorm/mistral - %config(noreplace) %{_sysconfdir}/mistral/* - %config(noreplace) %{_sysconfdir}/logrotate.d/mistral - %attr(755, %{svc_user}, root) %{_localstatedir}/log/mistral - %attr(755, %{svc_user}, root) %{_localstatedir}/run/mistral -%if 0%{?use_systemd} - %{_unitdir}/mistral.service - %{_unitdir}/mistral-api.service - %{_unitdir}/mistral-server.service -%else - %{_sysconfdir}/rc.d/init.d/mistral - %{_sysconfdir}/rc.d/init.d/mistral-api - %{_sysconfdir}/rc.d/init.d/mistral-server -%endif diff --git a/rake/build/environment.rb b/rake/build/environment.rb index f87b5251..17c3a7ab 100644 --- a/rake/build/environment.rb +++ b/rake/build/environment.rb @@ -14,7 +14,7 @@ st2tests) # Default list of packages to build -BUILDLIST = 'st2 st2mistral' +BUILDLIST = 'st2' ## Helper procs convert_to_ipaddr = ->(v) {(v !~ Resolv::AddressRegex) ? Resolv.getaddress(v) : v} @@ -61,7 +61,6 @@ # Default hostnames of dependat services (the value can take an address also) envpass :rabbitmqhost, 'rabbitmq', proc: convert_to_ipaddr envpass :mongodbhost, 'mongodb', proc: convert_to_ipaddr - envpass :postgreshost, 'postgres', proc: convert_to_ipaddr # upload_sources - a list of directories which should be propogated # to remote nodes. @@ -78,12 +77,3 @@ envpass :st2pkg_release, 1 envpass :st2_circle_url end - -pipeopts 'st2mistral' do - envpass :checkout, 1, from: 'ST2MISTRAL_CHECKOUT', proc: convert_to_int - envpass :giturl, 'https://github.com/StackStorm/mistral', from: 'ST2MISTRAL_GITURL' - envpass :gitrev, 'master', from: 'ST2MISTRAL_GITREV' - envpass :gitdir, make_tmpname('mistral-'), from: 'ST2MISTRAL_GITDIR' - envpass :mistral_version, '3.3dev' - envpass :mistral_release, 1 -end diff --git a/rake/build/package_st2mistral.rake b/rake/build/package_st2mistral.rake deleted file mode 100644 index d7df1e64..00000000 --- a/rake/build/package_st2mistral.rake +++ /dev/null @@ -1,51 +0,0 @@ -namespace :package do - - ## Create wheels for components and write them to the wheelhouse directory. - # - task :prebuild_st2mistral do - pipeline 'st2mistral' do - run hostname: opts[:buildnode] do |opts| - command show_uuid: false - with opts.env do - within opts.gitdir do - make :bdist_wheel, label: 'bdist: st2mistral' - make :wheelhouse, label: 'wheelhouse: st2mistral' - end - end - end - end - end - - ## Prepare st2 bundle package to be built - # - task :post_checkout_st2mistral do - pipeline 'st2mistral' do - run hostname: opts[:buildnode] do |opts| - command show_uuid: false, label: "checkout: update st2mistral" - with opts.env do - # Update gitdir with rpmspecs and st2mistral updates. - within opts.basedir do - execute :cp, '-r rpmspec/ packages/st2mistral/* $GITDIR' - end - end - end - end - end - - ## Build st2mistral bundle package - # - task :st2mistral do - pipeline 'st2mistral' do - run hostname: opts[:buildnode] do |opts| - command label: 'package: st2mistral', show_uuid: false - with opts.env do - within opts.gitdir do - make :changelog - execute :bash, '$BASEDIR/scripts/build_os_package.sh st2mistral' - end - end - end - end - end - -end diff --git a/rake/build/setup.rake b/rake/build/setup.rake index 6ced48a6..6841444e 100644 --- a/rake/build/setup.rake +++ b/rake/build/setup.rake @@ -24,9 +24,6 @@ namespace :setup do if opts.packages.include? 'st2' execute :bash, "$BASEDIR/scripts/generate_st2_config.sh" end - if opts.packages.include? 'st2mistral' - execute :bash, "$BASEDIR/scripts/generate_mistral_config.sh" - end end end end diff --git a/rake/spec/default/50-installed-cli-versions_spec.rb b/rake/spec/default/50-installed-cli-versions_spec.rb index 33206cfd..475edd1b 100644 --- a/rake/spec/default/50-installed-cli-versions_spec.rb +++ b/rake/spec/default/50-installed-cli-versions_spec.rb @@ -9,13 +9,4 @@ end end - if spec[:mistral_enabled] - describe command("mistral --version") do - its(:exit_status) { is_expected.to eq 0 } - # show version number in Rspec output - after(:all) do - puts " " + described_class.stderr - end - end - end end diff --git a/rake/spec/default/60-st2_all-services-ok_spec.rb b/rake/spec/default/60-st2_all-services-ok_spec.rb index 83c979fa..a594a253 100644 --- a/rake/spec/default/60-st2_all-services-ok_spec.rb +++ b/rake/spec/default/60-st2_all-services-ok_spec.rb @@ -15,40 +15,6 @@ it { is_expected.to be_reachable.with :port => 27017, :timeout => 1 } end - if spec[:mistral_enabled] - describe 'postgres' do - subject { host(spec[:postgreshost]) } - it { is_expected.to be_reachable.with :port => 5432, :timeout => 1 } - end - end -end - -describe 'run mistral DB migration' do - if spec[:mistral_enabled] - # Run mistral DB upgrade head - describe command(spec[:mistral_db_head_command]) do - its(:exit_status) { is_expected.to eq 0 } - after(:all) do - if described_class.exit_status > 0 - puts "\nMistral DB upgrade head has failed (:", '>>>>>', - described_class.stderr - puts - end - end - end - - # Run mistral DB populate - describe command(spec[:mistral_db_populate_command]) do - its(:exit_status) { is_expected.to eq 0 } - after(:all) do - if described_class.exit_status > 0 - puts "Mistral DB populate has failed!", '>>>>>', - described_class.stderr - puts - end - end - end - end end describe 'start st2 components and services' do @@ -97,12 +63,6 @@ it { should be_listening } end - if spec[:mistral_enabled] - describe 'mistral', prompt_on_failure: true do - subject { port(8989) } - it { should be_listening } - end - end end # all st2 services should work immediately after restart diff --git a/rake/spec/default/65-st2mistral_actions_spec.rb b/rake/spec/default/65-st2mistral_actions_spec.rb deleted file mode 100644 index 2ad2e829..00000000 --- a/rake/spec/default/65-st2mistral_actions_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'spec_helper' - -# Check that st2mistral can run internal actions successfully -describe 'st2mistral actions integrity checks' do - if spec[:mistral_enabled] - describe command(%(mistral run-action std.echo '{"output": "It works!"}')) do - its(:exit_status) { is_expected.to eq 0 } - its(:stdout) { should include '{"result": "It works!"}' } - end - end -end diff --git a/rake/spec/spec_helper.rb b/rake/spec/spec_helper.rb index 43e9a817..43ec53e6 100644 --- a/rake/spec/spec_helper.rb +++ b/rake/spec/spec_helper.rb @@ -28,10 +28,8 @@ class ST2Spec bin_prefix: '/usr/bin', conf_dir: '/etc/st2', log_dir: '/var/log/st2', - mistral_enabled: pipeopts.packages.include?('st2mistral'), package_list: pipeopts.packages, rabbitmqhost: pipeopts.rabbitmqhost, - postgreshost: pipeopts.postgreshost, mongodbhost: pipeopts.mongodbhost, loglines_to_show: 100, logdest_pattern: { @@ -41,19 +39,12 @@ class ST2Spec ' --register-fail-on-failure' \ ' --register-all' \ ' --config-dir /etc/st2', - mistral_db_head_command: '/opt/stackstorm/mistral/bin/mistral-db-manage' \ - ' --config-file /etc/mistral/mistral.conf upgrade head', - mistral_db_populate_command: '/opt/stackstorm/mistral/bin/mistral-db-manage' \ - ' --config-file /etc/mistral/mistral.conf populate', st2_services: ST2_SERVICES, package_opts: {}, package_has_services: { st2: ST2_SERVICES, - st2mistral: [ - ['mistral', binary_name: 'mistral-server'] - ] }, package_has_binaries: { @@ -61,7 +52,6 @@ class ST2Spec st2-trigger-refire st2 st2-self-check st2-track-result st2-validate-pack-config st2-check-license st2-generate-symmetric-crypto-key st2-submit-debug-info), - st2mistral: %w(mistral) }, package_has_directories: { @@ -71,17 +61,10 @@ class ST2Spec '/opt/stackstorm/packs', [ '/var/log/st2', example: Proc.new {|_| be_writable.by('owner')} ] ], - st2mistral: [ - '/etc/mistral', - '/etc/logrotate.d', - '/opt/stackstorm/mistral', - [ '/var/log/mistral', example: Proc.new {|_| be_writable.by('owner')} ] - ] }, package_has_files: { st2: %w(/etc/st2/st2.conf /etc/logrotate.d/st2), - st2mistral: %w(/etc/mistral/mistral.conf /etc/logrotate.d/mistral) }, package_has_users: { @@ -89,7 +72,6 @@ class ST2Spec 'st2', ['stanley', example: Proc.new {|_| have_home_directory '/home/stanley'} ] ], - st2mistral: %w(mistral) } } @@ -110,7 +92,6 @@ def [](key) def service_list @services_available ||= begin list = ST2_SERVICES - list << 'mistral' if spec[:mistral_enabled] list end end diff --git a/rake/spec/spec_package_iterables.rb b/rake/spec/spec_package_iterables.rb index 35dba1ef..47b3c1c4 100644 --- a/rake/spec/spec_package_iterables.rb +++ b/rake/spec/spec_package_iterables.rb @@ -6,7 +6,6 @@ def set_context_vars(name, opts) @opts = Hashie::Mash.new.merge(opts || {}) # we use different venv name for st2 package (bundle) @venv_name = (name.to_s == 'st2' ? 'st2' : name).to_s - @venv_name = (name.to_s == 'st2mistral' ? 'mistral' : name).to_s end # Collection iterating methods over spec lists diff --git a/scripts/generate_mistral_config.sh b/scripts/generate_mistral_config.sh deleted file mode 100644 index 5feeb7c7..00000000 --- a/scripts/generate_mistral_config.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -platform() { - [ -f /etc/debian_version ] && { echo 'deb'; return 0; } - echo 'rpm' -} - -RABBITMQHOST="${RABBITMQHOST:-rabbitmq}" -POSTGRESHOST="${POSTGRESHOST:-postgres}" - -MISTRAL_CONFSRC=/root/mistral-conf -MISTRAL_ETCDIR=/etc/mistral -MISTRAL_CONF=$MISTRAL_ETCDIR/mistral.conf - -MISTRAL=$(cat < $MISTRAL_CONF || : - -# Populate tables of the mistral database can be invoked ONLY -# AFTER creating the mistral databasue, so make sure: -# 0) you create database mistral identified for mistral:StackStorm -# 1) mistral should be started -# 2) mistral-db-manage populate should be invoked - -echo "Resulting $MISTRAL_CONF >>>" "$(cat $MISTRAL_CONF)" diff --git a/scripts/includes/common.sh b/scripts/includes/common.sh index 2884d92d..1dc30091 100644 --- a/scripts/includes/common.sh +++ b/scripts/includes/common.sh @@ -83,14 +83,14 @@ check_st2_host_dependencies() { # CHECK 1: Determine which, if any, of the required ports are used by an existing process. # Abort the installation early if the following ports are being used by an existing process. - # nginx (80, 443), mongodb (27017), rabbitmq (4369, 5672, 25672), postgresql (5432) and st2 (9100-9102). + # nginx (80, 443), mongodb (27017), rabbitmq (4369, 5672, 25672), and st2 (9100-9102). - declare -a ports=("80" "443" "4369" "5432" "5672" "9100" "9101" "9102" "25672" "27017") + declare -a ports=("80" "443" "4369" "5672" "9100" "9101" "9102" "25672" "27017") declare -a used=() for i in "${ports[@]}" do - rv=$(port_status $i | sed 's/.*-$\|.*systemd\|.*beam.smp.*\|.*epmd\|.*st2.*\|.*nginx.*\|.*python.*\|.*postgres\|.*postmaster.*\|.*mongod\|.*init//') + rv=$(port_status $i | sed 's/.*-$\|.*systemd\|.*beam.smp.*\|.*epmd\|.*st2.*\|.*nginx.*\|.*python.*\|.*postmaster.*\|.*mongod\|.*init//') if [ "$rv" != "Unbound" ] && [ "$rv" != "" ]; then used+=("$rv") fi @@ -121,9 +121,8 @@ check_st2_host_dependencies() { generate_random_passwords() { - # Generate random password used for MongoDB and PostgreSQL user authentication + # Generate random password used for MongoDB user authentication ST2_MONGODB_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 ; echo '') - ST2_POSTGRESQL_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 ; echo '') } diff --git a/scripts/includes/rhel.sh b/scripts/includes/rhel.sh index 413d1553..3d86a888 100644 --- a/scripts/includes/rhel.sh +++ b/scripts/includes/rhel.sh @@ -24,15 +24,6 @@ get_full_pkg_versions() { fi ST2_PKG=${ST2_VER} - local ST2MISTRAL_VER=$(repoquery ${YES_FLAG} --nvr --show-duplicates st2mistral | grep -F st2mistral-${VERSION} | sort --version-sort | tail -n 1) - # RHEL 8 and newer does not install Mistral - if [[ -z "$ST2MISTRAL_VER" && "$RHMAJVER" -lt "8" ]]; then - echo "Could not find requested version of st2mistral!!!" - sudo repoquery ${YES_FLAG} --nvr --show-duplicates st2mistral - exit 3 - fi - ST2MISTRAL_PKG=${ST2MISTRAL_VER} - local ST2WEB_VER=$(repoquery ${YES_FLAG} --nvr --show-duplicates st2web | grep -F st2web-${VERSION} | sort --version-sort | tail -n 1) if [ -z "$ST2WEB_VER" ]; then echo "Could not find requested version of st2web." @@ -52,7 +43,6 @@ get_full_pkg_versions() { echo "##########################################################" echo "#### Following versions of packages will be installed ####" echo "${ST2_PKG}" - echo "${ST2MISTRAL_PKG}" echo "${ST2WEB_PKG}" echo "${ST2CHATOPS_PKG}" echo "##########################################################" diff --git a/scripts/setup-vagrant.sh b/scripts/setup-vagrant.sh index 89c6d35f..b02cb012 100644 --- a/scripts/setup-vagrant.sh +++ b/scripts/setup-vagrant.sh @@ -48,13 +48,7 @@ fi if [[ "${ST2_GITREV}" != "" ]]; then ST2REV="-e ST2_GITREV=$ST2_GITREV" fi -if [[ "${ST2MISTRAL_GITURL}" != "" ]]; then - ST2MISTRALURL="-e ST2MISTRAL_GITURL=$ST2MISTRAL_GITURL" -fi -if [[ "${ST2MISTRAL_GITREV}" != "" ]]; then - ST2MISTRALREV="-e ST2MISTRAL_GITREV=$ST2MISTRAL_GITREV" -fi -sudo sh -c "(cd /vagrant && $DC_BIN run $ST2PACKAGES $ST2URL $ST2REV $ST2MISTRALURL $ST2MISTRALREV --rm $ST2_TARGET)" +sudo sh -c "(cd /vagrant && $DC_BIN run $ST2PACKAGES $ST2URL $ST2REV --rm $ST2_TARGET)" if [ "$ST2_INSTALL" = "yes" ]; then echo 'Install st2 packages' @@ -65,7 +59,6 @@ if [ "$ST2_INSTALL" = "yes" ]; then # Install the packages we just built if [[ $ST2_TARGET != 'el7' ]]; then sudo /usr/bin/gdebi -n /tmp/st2-packages/st2_*.deb - sudo /usr/bin/gdebi -n /tmp/st2-packages/st2mistral*.deb else sudo $INSTALL_CMD install -y /tmp/st2-packages/st2*.rpm fi @@ -110,10 +103,6 @@ EOF' sudo mkdir -p /etc/st2/keys sudo st2-generate-symmetric-crypto-key --key-path /etc/st2/keys/datastore_key.json - # Setup Mistral DB - /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head - git init && /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf populate && rm -rf .git - # Start ST2 services sudo st2ctl start sudo st2ctl reload diff --git a/scripts/st2_bootstrap.sh b/scripts/st2_bootstrap.sh index 437b5f65..d226a8a0 100644 --- a/scripts/st2_bootstrap.sh +++ b/scripts/st2_bootstrap.sh @@ -45,7 +45,7 @@ setup_args() { shift ;; # Used to install the packages from CircleCI build artifacts - # Examples: 'st2/5017', 'mistral/1012', 'st2-packages/3021', + # Examples: 'st2/5017', 'st2-packages/3021', # where first part is repository name, second is CircleCI build number. --dev=*) DEV_BUILD="${i#*=}" diff --git a/scripts/st2bootstrap-deb.template.sh b/scripts/st2bootstrap-deb.template.sh index e87747fa..f6271111 100644 --- a/scripts/st2bootstrap-deb.template.sh +++ b/scripts/st2bootstrap-deb.template.sh @@ -7,7 +7,6 @@ RELEASE='stable' REPO_TYPE='' REPO_PREFIX='' ST2_PKG_VERSION='' -ST2MISTRAL_PKG_VERSION='' ST2WEB_PKG_VERSION='' ST2CHATOPS_PKG_VERSION='' DEV_BUILD='' @@ -205,19 +204,6 @@ get_full_pkg_versions() { exit 3 fi - if [[ "$SUBTYPE" != 'bionic' ]]; then - # Bionic doesn't support Mistral - local ST2MISTRAL_VER=$(apt-cache show st2mistral | grep Version | awk '{print $2}' | grep ^${VERSION//./\\.} | sort --version-sort | tail -n 1) - - if [[ -z "$ST2MISTRAL_VER" ]]; then - echo "Could not find requested version of st2mistral!!!" - sudo apt-cache policy st2mistral - exit 3 - fi - else - local ST2MISTRAL_VER="none" - fi - local ST2WEB_VER=$(apt-cache show st2web | grep Version | awk '{print $2}' | grep ^${VERSION//./\\.} | sort --version-sort | tail -n 1) if [[ -z "$ST2WEB_VER" ]]; then echo "Could not find requested version of st2web." @@ -233,13 +219,11 @@ get_full_pkg_versions() { fi ST2_PKG_VERSION="=${ST2_VER}" - ST2MISTRAL_PKG_VERSION="=${ST2MISTRAL_VER}" ST2WEB_PKG_VERSION="=${ST2WEB_VER}" ST2CHATOPS_PKG_VERSION="=${ST2CHATOPS_VER}" echo "##########################################################" echo "#### Following versions of packages will be installed ####" echo "st2${ST2_PKG_VERSION}" - echo "st2mistral${ST2MISTRAL_PKG_VERSION}" echo "st2web${ST2WEB_PKG_VERSION}" echo "st2chatops${ST2CHATOPS_PKG_VERSION}" echo "##########################################################" @@ -250,8 +234,7 @@ install_st2() { # Following script adds a repo file, registers gpg key and runs apt-get update curl -sL https://packagecloud.io/install/repositories/StackStorm/${REPO_PREFIX}${RELEASE}/script.deb.sh | sudo bash - # 'mistral' repo builds single 'st2mistral' package and so we have to install 'st2' from repo - if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^mistral/.* ]]; then + if [[ "$DEV_BUILD" = '' ]]; then STEP="Get package versions" && get_full_pkg_versions && STEP="Install st2" sudo apt-get install -y st2${ST2_PKG_VERSION} else @@ -291,46 +274,6 @@ configure_st2_authentication() { sudo st2ctl restart-component st2stream } -install_st2mistral_dependencies() { - sudo apt-get install -y postgresql - - # Configure service only listens on localhost - sudo crudini --set /etc/postgresql/*/main/postgresql.conf '' listen_addresses "'127.0.0.1'" - - sudo service postgresql restart - cat << EHD | sudo -u postgres psql -CREATE ROLE mistral WITH CREATEDB LOGIN ENCRYPTED PASSWORD '${ST2_POSTGRESQL_PASSWORD}'; -CREATE DATABASE mistral OWNER mistral; -EHD -} - -install_st2mistral() { - # 'st2' repo builds single 'st2' package and so we have to install 'st2mistral' from repo - if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^st2/.* ]]; then - sudo apt-get install -y st2mistral${ST2MISTRAL_PKG_VERSION} - else - sudo apt-get install -y jq - - PACKAGE_URL=$(get_package_url "${DEV_BUILD}" "${SUBTYPE}" "st2mistral_.*.deb") - PACKAGE_FILENAME="$(basename ${PACKAGE_URL})" - curl -sSL -k -o ${PACKAGE_FILENAME} ${PACKAGE_URL} - sudo dpkg -i --force-depends ${PACKAGE_FILENAME} - sudo apt-get install -yf - rm ${PACKAGE_FILENAME} - fi - - # Configure database settings - sudo crudini --set /etc/mistral/mistral.conf database connection "postgresql+psycopg2://mistral:${ST2_POSTGRESQL_PASSWORD}@127.0.0.1/mistral" - - # Setup Mistral DB tables, etc. - /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head - - # Register mistral actions. - /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf populate | grep -v openstack | grep -v "ironicclient" - - # Start Mistral - sudo service mistral start -} install_st2web() { # Add key and repo for the latest stable nginx @@ -417,10 +360,6 @@ STEP="Configure st2 CLI config" && configure_st2_cli_config STEP="Generate symmetric crypto key for datastore" && generate_symmetric_crypto_key_for_datastore STEP="Verify st2" && verify_st2 -if [[ "${SUBTYPE}" != "bionic" ]]; then - STEP="Install mistral dependencies" && install_st2mistral_dependencies - STEP="Install mistral" && install_st2mistral -fi STEP="Install st2web" && install_st2web diff --git a/scripts/st2bootstrap-el7.template.sh b/scripts/st2bootstrap-el7.template.sh index 1062e37f..d007b329 100644 --- a/scripts/st2bootstrap-el7.template.sh +++ b/scripts/st2bootstrap-el7.template.sh @@ -11,7 +11,6 @@ DEV_BUILD='' USERNAME='' PASSWORD='' ST2_PKG='st2' -ST2MISTRAL_PKG='st2mistral' ST2WEB_PKG='st2web' ST2CHATOPS_PKG='st2chatops' @@ -203,8 +202,7 @@ EOF install_st2() { curl -sL https://packagecloud.io/install/repositories/StackStorm/${REPO_PREFIX}${RELEASE}/script.rpm.sh | sudo bash - # 'mistral' repo builds single 'st2mistral' package and so we have to install 'st2' from repo - if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^mistral/.* ]]; then + if [[ "$DEV_BUILD" = '' ]]; then STEP="Get package versions" && get_full_pkg_versions && STEP="Install st2" sudo yum -y install ${ST2_PKG} else @@ -241,53 +239,6 @@ configure_st2_authentication() { } -install_st2mistral_dependencies() { - sudo yum -y install postgresql-server postgresql-contrib postgresql-devel - - # Setup postgresql at a first time - sudo postgresql-setup initdb - - # Configure service only listens on localhost - sudo sh -c "echo \"listen_addresses = '127.0.0.1'\" >> /var/lib/pgsql/data/postgresql.conf" - - # Make localhost connections to use an MD5-encrypted password for authentication - sudo sed -i "s/\(host.*all.*all.*127.0.0.1\/32.*\)ident/\1md5/" /var/lib/pgsql/data/pg_hba.conf - sudo sed -i "s/\(host.*all.*all.*::1\/128.*\)ident/\1md5/" /var/lib/pgsql/data/pg_hba.conf - - # Start PostgreSQL service - sudo systemctl start postgresql - sudo systemctl enable postgresql - - cat << EHD | sudo -u postgres psql -CREATE ROLE mistral WITH CREATEDB LOGIN ENCRYPTED PASSWORD '${ST2_POSTGRESQL_PASSWORD}'; -CREATE DATABASE mistral OWNER mistral; -EHD -} - -install_st2mistral() { - # 'st2' repo builds single 'st2' package and so we have to install 'st2mistral' from repo - if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^st2/.* ]]; then - sudo yum -y install ${ST2MISTRAL_PKG} - else - sudo yum -y install jq - - PACKAGE_URL=$(get_package_url "${DEV_BUILD}" "el7" "st2mistral-.*.rpm") - sudo yum -y install ${PACKAGE_URL} - fi - - # Configure database settings - sudo crudini --set /etc/mistral/mistral.conf database connection "postgresql+psycopg2://mistral:${ST2_POSTGRESQL_PASSWORD}@127.0.0.1/mistral" - - # Setup Mistral DB tables, etc. - /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head - - # Register mistral actions. - /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf populate | grep -v openstack | grep -v "ironicclient" - - # start mistral - sudo systemctl start mistral -} - install_st2web() { # Add key and repo for the latest stable nginx sudo rpm --import http://nginx.org/keys/nginx_signing.key @@ -390,8 +341,6 @@ STEP="Configure st2 CLI config" && configure_st2_cli_config STEP="Generate symmetric crypto key for datastore" && generate_symmetric_crypto_key_for_datastore STEP="Verify st2" && verify_st2 -STEP="Install mistral dependencies" && install_st2mistral_dependencies -STEP="Install mistral" && install_st2mistral STEP="Install st2web" && install_st2web STEP="Install st2chatops" && install_st2chatops diff --git a/scripts/st2bootstrap-el8.template.sh b/scripts/st2bootstrap-el8.template.sh index 6e4d302a..fb47b104 100644 --- a/scripts/st2bootstrap-el8.template.sh +++ b/scripts/st2bootstrap-el8.template.sh @@ -221,8 +221,7 @@ EOF install_st2() { curl -sL https://packagecloud.io/install/repositories/StackStorm/${REPO_PREFIX}${RELEASE}/script.rpm.sh | sudo bash - # 'mistral' repo builds single 'st2mistral' package and so we have to install 'st2' from repo - if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^mistral/.* ]]; then + if [[ "$DEV_BUILD" = '' ]]; then STEP="Get package versions" && get_full_pkg_versions && STEP="Install st2" sudo yum -y install ${ST2_PKG} else From d0631368c51e0b7ed06d9ddaa1d0b09c4f295061 Mon Sep 17 00:00:00 2001 From: amanda Date: Fri, 31 Jul 2020 15:49:36 +0100 Subject: [PATCH 2/5] Commit bootstrap files after re-generation --- scripts/st2bootstrap-deb.sh | 72 +++---------------------------------- scripts/st2bootstrap-el7.sh | 72 +++---------------------------------- scripts/st2bootstrap-el8.sh | 22 +++--------- 3 files changed, 15 insertions(+), 151 deletions(-) diff --git a/scripts/st2bootstrap-deb.sh b/scripts/st2bootstrap-deb.sh index 766a0a4d..f8f10183 100644 --- a/scripts/st2bootstrap-deb.sh +++ b/scripts/st2bootstrap-deb.sh @@ -15,7 +15,6 @@ RELEASE='stable' REPO_TYPE='' REPO_PREFIX='' ST2_PKG_VERSION='' -ST2MISTRAL_PKG_VERSION='' ST2WEB_PKG_VERSION='' ST2CHATOPS_PKG_VERSION='' DEV_BUILD='' @@ -201,14 +200,14 @@ check_st2_host_dependencies() { # CHECK 1: Determine which, if any, of the required ports are used by an existing process. # Abort the installation early if the following ports are being used by an existing process. - # nginx (80, 443), mongodb (27017), rabbitmq (4369, 5672, 25672), postgresql (5432) and st2 (9100-9102). + # nginx (80, 443), mongodb (27017), rabbitmq (4369, 5672, 25672), and st2 (9100-9102). - declare -a ports=("80" "443" "4369" "5432" "5672" "9100" "9101" "9102" "25672" "27017") + declare -a ports=("80" "443" "4369" "5672" "9100" "9101" "9102" "25672" "27017") declare -a used=() for i in "${ports[@]}" do - rv=$(port_status $i | sed 's/.*-$\|.*systemd\|.*beam.smp.*\|.*epmd\|.*st2.*\|.*nginx.*\|.*python.*\|.*postgres\|.*postmaster.*\|.*mongod\|.*init//') + rv=$(port_status $i | sed 's/.*-$\|.*systemd\|.*beam.smp.*\|.*epmd\|.*st2.*\|.*nginx.*\|.*python.*\|.*postmaster.*\|.*mongod\|.*init//') if [ "$rv" != "Unbound" ] && [ "$rv" != "" ]; then used+=("$rv") fi @@ -239,9 +238,8 @@ check_st2_host_dependencies() { generate_random_passwords() { - # Generate random password used for MongoDB and PostgreSQL user authentication + # Generate random password used for MongoDB user authentication ST2_MONGODB_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 ; echo '') - ST2_POSTGRESQL_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 ; echo '') } @@ -519,19 +517,6 @@ get_full_pkg_versions() { exit 3 fi - if [[ "$SUBTYPE" != 'bionic' ]]; then - # Bionic doesn't support Mistral - local ST2MISTRAL_VER=$(apt-cache show st2mistral | grep Version | awk '{print $2}' | grep ^${VERSION//./\\.} | sort --version-sort | tail -n 1) - - if [[ -z "$ST2MISTRAL_VER" ]]; then - echo "Could not find requested version of st2mistral!!!" - sudo apt-cache policy st2mistral - exit 3 - fi - else - local ST2MISTRAL_VER="none" - fi - local ST2WEB_VER=$(apt-cache show st2web | grep Version | awk '{print $2}' | grep ^${VERSION//./\\.} | sort --version-sort | tail -n 1) if [[ -z "$ST2WEB_VER" ]]; then echo "Could not find requested version of st2web." @@ -547,13 +532,11 @@ get_full_pkg_versions() { fi ST2_PKG_VERSION="=${ST2_VER}" - ST2MISTRAL_PKG_VERSION="=${ST2MISTRAL_VER}" ST2WEB_PKG_VERSION="=${ST2WEB_VER}" ST2CHATOPS_PKG_VERSION="=${ST2CHATOPS_VER}" echo "##########################################################" echo "#### Following versions of packages will be installed ####" echo "st2${ST2_PKG_VERSION}" - echo "st2mistral${ST2MISTRAL_PKG_VERSION}" echo "st2web${ST2WEB_PKG_VERSION}" echo "st2chatops${ST2CHATOPS_PKG_VERSION}" echo "##########################################################" @@ -564,8 +547,7 @@ install_st2() { # Following script adds a repo file, registers gpg key and runs apt-get update curl -sL https://packagecloud.io/install/repositories/StackStorm/${REPO_PREFIX}${RELEASE}/script.deb.sh | sudo bash - # 'mistral' repo builds single 'st2mistral' package and so we have to install 'st2' from repo - if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^mistral/.* ]]; then + if [[ "$DEV_BUILD" = '' ]]; then STEP="Get package versions" && get_full_pkg_versions && STEP="Install st2" sudo apt-get install -y st2${ST2_PKG_VERSION} else @@ -605,46 +587,6 @@ configure_st2_authentication() { sudo st2ctl restart-component st2stream } -install_st2mistral_dependencies() { - sudo apt-get install -y postgresql - - # Configure service only listens on localhost - sudo crudini --set /etc/postgresql/*/main/postgresql.conf '' listen_addresses "'127.0.0.1'" - - sudo service postgresql restart - cat << EHD | sudo -u postgres psql -CREATE ROLE mistral WITH CREATEDB LOGIN ENCRYPTED PASSWORD '${ST2_POSTGRESQL_PASSWORD}'; -CREATE DATABASE mistral OWNER mistral; -EHD -} - -install_st2mistral() { - # 'st2' repo builds single 'st2' package and so we have to install 'st2mistral' from repo - if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^st2/.* ]]; then - sudo apt-get install -y st2mistral${ST2MISTRAL_PKG_VERSION} - else - sudo apt-get install -y jq - - PACKAGE_URL=$(get_package_url "${DEV_BUILD}" "${SUBTYPE}" "st2mistral_.*.deb") - PACKAGE_FILENAME="$(basename ${PACKAGE_URL})" - curl -sSL -k -o ${PACKAGE_FILENAME} ${PACKAGE_URL} - sudo dpkg -i --force-depends ${PACKAGE_FILENAME} - sudo apt-get install -yf - rm ${PACKAGE_FILENAME} - fi - - # Configure database settings - sudo crudini --set /etc/mistral/mistral.conf database connection "postgresql+psycopg2://mistral:${ST2_POSTGRESQL_PASSWORD}@127.0.0.1/mistral" - - # Setup Mistral DB tables, etc. - /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head - - # Register mistral actions. - /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf populate | grep -v openstack | grep -v "ironicclient" - - # Start Mistral - sudo service mistral start -} install_st2web() { # Add key and repo for the latest stable nginx @@ -731,10 +673,6 @@ STEP="Configure st2 CLI config" && configure_st2_cli_config STEP="Generate symmetric crypto key for datastore" && generate_symmetric_crypto_key_for_datastore STEP="Verify st2" && verify_st2 -if [[ "${SUBTYPE}" != "bionic" ]]; then - STEP="Install mistral dependencies" && install_st2mistral_dependencies - STEP="Install mistral" && install_st2mistral -fi STEP="Install st2web" && install_st2web diff --git a/scripts/st2bootstrap-el7.sh b/scripts/st2bootstrap-el7.sh index 909f3ef0..3bc610f0 100644 --- a/scripts/st2bootstrap-el7.sh +++ b/scripts/st2bootstrap-el7.sh @@ -19,7 +19,6 @@ DEV_BUILD='' USERNAME='' PASSWORD='' ST2_PKG='st2' -ST2MISTRAL_PKG='st2mistral' ST2WEB_PKG='st2web' ST2CHATOPS_PKG='st2chatops' @@ -195,14 +194,14 @@ check_st2_host_dependencies() { # CHECK 1: Determine which, if any, of the required ports are used by an existing process. # Abort the installation early if the following ports are being used by an existing process. - # nginx (80, 443), mongodb (27017), rabbitmq (4369, 5672, 25672), postgresql (5432) and st2 (9100-9102). + # nginx (80, 443), mongodb (27017), rabbitmq (4369, 5672, 25672), and st2 (9100-9102). - declare -a ports=("80" "443" "4369" "5432" "5672" "9100" "9101" "9102" "25672" "27017") + declare -a ports=("80" "443" "4369" "5672" "9100" "9101" "9102" "25672" "27017") declare -a used=() for i in "${ports[@]}" do - rv=$(port_status $i | sed 's/.*-$\|.*systemd\|.*beam.smp.*\|.*epmd\|.*st2.*\|.*nginx.*\|.*python.*\|.*postgres\|.*postmaster.*\|.*mongod\|.*init//') + rv=$(port_status $i | sed 's/.*-$\|.*systemd\|.*beam.smp.*\|.*epmd\|.*st2.*\|.*nginx.*\|.*python.*\|.*postmaster.*\|.*mongod\|.*init//') if [ "$rv" != "Unbound" ] && [ "$rv" != "" ]; then used+=("$rv") fi @@ -233,9 +232,8 @@ check_st2_host_dependencies() { generate_random_passwords() { - # Generate random password used for MongoDB and PostgreSQL user authentication + # Generate random password used for MongoDB user authentication ST2_MONGODB_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 ; echo '') - ST2_POSTGRESQL_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 ; echo '') } @@ -443,15 +441,6 @@ get_full_pkg_versions() { fi ST2_PKG=${ST2_VER} - local ST2MISTRAL_VER=$(repoquery ${YES_FLAG} --nvr --show-duplicates st2mistral | grep -F st2mistral-${VERSION} | sort --version-sort | tail -n 1) - # RHEL 8 and newer does not install Mistral - if [[ -z "$ST2MISTRAL_VER" && "$RHMAJVER" -lt "8" ]]; then - echo "Could not find requested version of st2mistral!!!" - sudo repoquery ${YES_FLAG} --nvr --show-duplicates st2mistral - exit 3 - fi - ST2MISTRAL_PKG=${ST2MISTRAL_VER} - local ST2WEB_VER=$(repoquery ${YES_FLAG} --nvr --show-duplicates st2web | grep -F st2web-${VERSION} | sort --version-sort | tail -n 1) if [ -z "$ST2WEB_VER" ]; then echo "Could not find requested version of st2web." @@ -471,7 +460,6 @@ get_full_pkg_versions() { echo "##########################################################" echo "#### Following versions of packages will be installed ####" echo "${ST2_PKG}" - echo "${ST2MISTRAL_PKG}" echo "${ST2WEB_PKG}" echo "${ST2CHATOPS_PKG}" echo "##########################################################" @@ -577,8 +565,7 @@ EOF install_st2() { curl -sL https://packagecloud.io/install/repositories/StackStorm/${REPO_PREFIX}${RELEASE}/script.rpm.sh | sudo bash - # 'mistral' repo builds single 'st2mistral' package and so we have to install 'st2' from repo - if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^mistral/.* ]]; then + if [[ "$DEV_BUILD" = '' ]]; then STEP="Get package versions" && get_full_pkg_versions && STEP="Install st2" sudo yum -y install ${ST2_PKG} else @@ -615,53 +602,6 @@ configure_st2_authentication() { } -install_st2mistral_dependencies() { - sudo yum -y install postgresql-server postgresql-contrib postgresql-devel - - # Setup postgresql at a first time - sudo postgresql-setup initdb - - # Configure service only listens on localhost - sudo sh -c "echo \"listen_addresses = '127.0.0.1'\" >> /var/lib/pgsql/data/postgresql.conf" - - # Make localhost connections to use an MD5-encrypted password for authentication - sudo sed -i "s/\(host.*all.*all.*127.0.0.1\/32.*\)ident/\1md5/" /var/lib/pgsql/data/pg_hba.conf - sudo sed -i "s/\(host.*all.*all.*::1\/128.*\)ident/\1md5/" /var/lib/pgsql/data/pg_hba.conf - - # Start PostgreSQL service - sudo systemctl start postgresql - sudo systemctl enable postgresql - - cat << EHD | sudo -u postgres psql -CREATE ROLE mistral WITH CREATEDB LOGIN ENCRYPTED PASSWORD '${ST2_POSTGRESQL_PASSWORD}'; -CREATE DATABASE mistral OWNER mistral; -EHD -} - -install_st2mistral() { - # 'st2' repo builds single 'st2' package and so we have to install 'st2mistral' from repo - if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^st2/.* ]]; then - sudo yum -y install ${ST2MISTRAL_PKG} - else - sudo yum -y install jq - - PACKAGE_URL=$(get_package_url "${DEV_BUILD}" "el7" "st2mistral-.*.rpm") - sudo yum -y install ${PACKAGE_URL} - fi - - # Configure database settings - sudo crudini --set /etc/mistral/mistral.conf database connection "postgresql+psycopg2://mistral:${ST2_POSTGRESQL_PASSWORD}@127.0.0.1/mistral" - - # Setup Mistral DB tables, etc. - /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head - - # Register mistral actions. - /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf populate | grep -v openstack | grep -v "ironicclient" - - # start mistral - sudo systemctl start mistral -} - install_st2web() { # Add key and repo for the latest stable nginx sudo rpm --import http://nginx.org/keys/nginx_signing.key @@ -764,8 +704,6 @@ STEP="Configure st2 CLI config" && configure_st2_cli_config STEP="Generate symmetric crypto key for datastore" && generate_symmetric_crypto_key_for_datastore STEP="Verify st2" && verify_st2 -STEP="Install mistral dependencies" && install_st2mistral_dependencies -STEP="Install mistral" && install_st2mistral STEP="Install st2web" && install_st2web STEP="Install st2chatops" && install_st2chatops diff --git a/scripts/st2bootstrap-el8.sh b/scripts/st2bootstrap-el8.sh index 13501d1a..1f13d72b 100644 --- a/scripts/st2bootstrap-el8.sh +++ b/scripts/st2bootstrap-el8.sh @@ -198,14 +198,14 @@ check_st2_host_dependencies() { # CHECK 1: Determine which, if any, of the required ports are used by an existing process. # Abort the installation early if the following ports are being used by an existing process. - # nginx (80, 443), mongodb (27017), rabbitmq (4369, 5672, 25672), postgresql (5432) and st2 (9100-9102). + # nginx (80, 443), mongodb (27017), rabbitmq (4369, 5672, 25672), and st2 (9100-9102). - declare -a ports=("80" "443" "4369" "5432" "5672" "9100" "9101" "9102" "25672" "27017") + declare -a ports=("80" "443" "4369" "5672" "9100" "9101" "9102" "25672" "27017") declare -a used=() for i in "${ports[@]}" do - rv=$(port_status $i | sed 's/.*-$\|.*systemd\|.*beam.smp.*\|.*epmd\|.*st2.*\|.*nginx.*\|.*python.*\|.*postgres\|.*postmaster.*\|.*mongod\|.*init//') + rv=$(port_status $i | sed 's/.*-$\|.*systemd\|.*beam.smp.*\|.*epmd\|.*st2.*\|.*nginx.*\|.*python.*\|.*postmaster.*\|.*mongod\|.*init//') if [ "$rv" != "Unbound" ] && [ "$rv" != "" ]; then used+=("$rv") fi @@ -236,9 +236,8 @@ check_st2_host_dependencies() { generate_random_passwords() { - # Generate random password used for MongoDB and PostgreSQL user authentication + # Generate random password used for MongoDB user authentication ST2_MONGODB_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 ; echo '') - ST2_POSTGRESQL_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 ; echo '') } @@ -446,15 +445,6 @@ get_full_pkg_versions() { fi ST2_PKG=${ST2_VER} - local ST2MISTRAL_VER=$(repoquery ${YES_FLAG} --nvr --show-duplicates st2mistral | grep -F st2mistral-${VERSION} | sort --version-sort | tail -n 1) - # RHEL 8 and newer does not install Mistral - if [[ -z "$ST2MISTRAL_VER" && "$RHMAJVER" -lt "8" ]]; then - echo "Could not find requested version of st2mistral!!!" - sudo repoquery ${YES_FLAG} --nvr --show-duplicates st2mistral - exit 3 - fi - ST2MISTRAL_PKG=${ST2MISTRAL_VER} - local ST2WEB_VER=$(repoquery ${YES_FLAG} --nvr --show-duplicates st2web | grep -F st2web-${VERSION} | sort --version-sort | tail -n 1) if [ -z "$ST2WEB_VER" ]; then echo "Could not find requested version of st2web." @@ -474,7 +464,6 @@ get_full_pkg_versions() { echo "##########################################################" echo "#### Following versions of packages will be installed ####" echo "${ST2_PKG}" - echo "${ST2MISTRAL_PKG}" echo "${ST2WEB_PKG}" echo "${ST2CHATOPS_PKG}" echo "##########################################################" @@ -595,8 +584,7 @@ EOF install_st2() { curl -sL https://packagecloud.io/install/repositories/StackStorm/${REPO_PREFIX}${RELEASE}/script.rpm.sh | sudo bash - # 'mistral' repo builds single 'st2mistral' package and so we have to install 'st2' from repo - if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^mistral/.* ]]; then + if [[ "$DEV_BUILD" = '' ]]; then STEP="Get package versions" && get_full_pkg_versions && STEP="Install st2" sudo yum -y install ${ST2_PKG} else From e32f42db374c592b5de1ea429e2d593d07c976b2 Mon Sep 17 00:00:00 2001 From: amanda Date: Fri, 31 Jul 2020 17:25:46 +0100 Subject: [PATCH 3/5] Remove scripted installer changes from this PR --- scripts/generate_mistral_config.sh | 37 ++++++++++++++ scripts/includes/common.sh | 9 ++-- scripts/includes/rhel.sh | 10 ++++ scripts/st2_bootstrap.sh | 4 +- scripts/st2bootstrap-deb.sh | 72 ++++++++++++++++++++++++++-- scripts/st2bootstrap-deb.template.sh | 63 +++++++++++++++++++++++- scripts/st2bootstrap-el7.sh | 72 ++++++++++++++++++++++++++-- scripts/st2bootstrap-el7.template.sh | 53 +++++++++++++++++++- scripts/st2bootstrap-el8.sh | 22 +++++++-- scripts/st2bootstrap-el8.template.sh | 3 +- 10 files changed, 321 insertions(+), 24 deletions(-) create mode 100644 scripts/generate_mistral_config.sh diff --git a/scripts/generate_mistral_config.sh b/scripts/generate_mistral_config.sh new file mode 100644 index 00000000..5feeb7c7 --- /dev/null +++ b/scripts/generate_mistral_config.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +platform() { + [ -f /etc/debian_version ] && { echo 'deb'; return 0; } + echo 'rpm' +} + +RABBITMQHOST="${RABBITMQHOST:-rabbitmq}" +POSTGRESHOST="${POSTGRESHOST:-postgres}" + +MISTRAL_CONFSRC=/root/mistral-conf +MISTRAL_ETCDIR=/etc/mistral +MISTRAL_CONF=$MISTRAL_ETCDIR/mistral.conf + +MISTRAL=$(cat < $MISTRAL_CONF || : + +# Populate tables of the mistral database can be invoked ONLY +# AFTER creating the mistral databasue, so make sure: +# 0) you create database mistral identified for mistral:StackStorm +# 1) mistral should be started +# 2) mistral-db-manage populate should be invoked + +echo "Resulting $MISTRAL_CONF >>>" "$(cat $MISTRAL_CONF)" diff --git a/scripts/includes/common.sh b/scripts/includes/common.sh index 1dc30091..2884d92d 100644 --- a/scripts/includes/common.sh +++ b/scripts/includes/common.sh @@ -83,14 +83,14 @@ check_st2_host_dependencies() { # CHECK 1: Determine which, if any, of the required ports are used by an existing process. # Abort the installation early if the following ports are being used by an existing process. - # nginx (80, 443), mongodb (27017), rabbitmq (4369, 5672, 25672), and st2 (9100-9102). + # nginx (80, 443), mongodb (27017), rabbitmq (4369, 5672, 25672), postgresql (5432) and st2 (9100-9102). - declare -a ports=("80" "443" "4369" "5672" "9100" "9101" "9102" "25672" "27017") + declare -a ports=("80" "443" "4369" "5432" "5672" "9100" "9101" "9102" "25672" "27017") declare -a used=() for i in "${ports[@]}" do - rv=$(port_status $i | sed 's/.*-$\|.*systemd\|.*beam.smp.*\|.*epmd\|.*st2.*\|.*nginx.*\|.*python.*\|.*postmaster.*\|.*mongod\|.*init//') + rv=$(port_status $i | sed 's/.*-$\|.*systemd\|.*beam.smp.*\|.*epmd\|.*st2.*\|.*nginx.*\|.*python.*\|.*postgres\|.*postmaster.*\|.*mongod\|.*init//') if [ "$rv" != "Unbound" ] && [ "$rv" != "" ]; then used+=("$rv") fi @@ -121,8 +121,9 @@ check_st2_host_dependencies() { generate_random_passwords() { - # Generate random password used for MongoDB user authentication + # Generate random password used for MongoDB and PostgreSQL user authentication ST2_MONGODB_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 ; echo '') + ST2_POSTGRESQL_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 ; echo '') } diff --git a/scripts/includes/rhel.sh b/scripts/includes/rhel.sh index 3d86a888..413d1553 100644 --- a/scripts/includes/rhel.sh +++ b/scripts/includes/rhel.sh @@ -24,6 +24,15 @@ get_full_pkg_versions() { fi ST2_PKG=${ST2_VER} + local ST2MISTRAL_VER=$(repoquery ${YES_FLAG} --nvr --show-duplicates st2mistral | grep -F st2mistral-${VERSION} | sort --version-sort | tail -n 1) + # RHEL 8 and newer does not install Mistral + if [[ -z "$ST2MISTRAL_VER" && "$RHMAJVER" -lt "8" ]]; then + echo "Could not find requested version of st2mistral!!!" + sudo repoquery ${YES_FLAG} --nvr --show-duplicates st2mistral + exit 3 + fi + ST2MISTRAL_PKG=${ST2MISTRAL_VER} + local ST2WEB_VER=$(repoquery ${YES_FLAG} --nvr --show-duplicates st2web | grep -F st2web-${VERSION} | sort --version-sort | tail -n 1) if [ -z "$ST2WEB_VER" ]; then echo "Could not find requested version of st2web." @@ -43,6 +52,7 @@ get_full_pkg_versions() { echo "##########################################################" echo "#### Following versions of packages will be installed ####" echo "${ST2_PKG}" + echo "${ST2MISTRAL_PKG}" echo "${ST2WEB_PKG}" echo "${ST2CHATOPS_PKG}" echo "##########################################################" diff --git a/scripts/st2_bootstrap.sh b/scripts/st2_bootstrap.sh index d226a8a0..eb378652 100644 --- a/scripts/st2_bootstrap.sh +++ b/scripts/st2_bootstrap.sh @@ -45,7 +45,7 @@ setup_args() { shift ;; # Used to install the packages from CircleCI build artifacts - # Examples: 'st2/5017', 'st2-packages/3021', + # Examples: 'st2/5017', 'mistral/1012', 'st2-packages/3021', # where first part is repository name, second is CircleCI build number. --dev=*) DEV_BUILD="${i#*=}" @@ -152,7 +152,7 @@ if [[ -n "$RHTEST" ]]; then echo "*** Detected Distro is ${RHTEST} ***" RHMAJVER=`cat /etc/redhat-release | sed 's/[^0-9.]*\([0-9.]\).*/\1/'` echo "*** Detected distro version ${RHMAJVER} ***" - if [[ "$RHMAJVER" != '6' && "$RHMAJVER" != '7' && "$RHMAJVER" != '8' ]]; then + if [[ "$RHMAJVER" != '7' && "$RHMAJVER" != '8' ]]; then echo "Unsupported distro version $RHMAJVER! Aborting!" exit 2 fi diff --git a/scripts/st2bootstrap-deb.sh b/scripts/st2bootstrap-deb.sh index f8f10183..766a0a4d 100644 --- a/scripts/st2bootstrap-deb.sh +++ b/scripts/st2bootstrap-deb.sh @@ -15,6 +15,7 @@ RELEASE='stable' REPO_TYPE='' REPO_PREFIX='' ST2_PKG_VERSION='' +ST2MISTRAL_PKG_VERSION='' ST2WEB_PKG_VERSION='' ST2CHATOPS_PKG_VERSION='' DEV_BUILD='' @@ -200,14 +201,14 @@ check_st2_host_dependencies() { # CHECK 1: Determine which, if any, of the required ports are used by an existing process. # Abort the installation early if the following ports are being used by an existing process. - # nginx (80, 443), mongodb (27017), rabbitmq (4369, 5672, 25672), and st2 (9100-9102). + # nginx (80, 443), mongodb (27017), rabbitmq (4369, 5672, 25672), postgresql (5432) and st2 (9100-9102). - declare -a ports=("80" "443" "4369" "5672" "9100" "9101" "9102" "25672" "27017") + declare -a ports=("80" "443" "4369" "5432" "5672" "9100" "9101" "9102" "25672" "27017") declare -a used=() for i in "${ports[@]}" do - rv=$(port_status $i | sed 's/.*-$\|.*systemd\|.*beam.smp.*\|.*epmd\|.*st2.*\|.*nginx.*\|.*python.*\|.*postmaster.*\|.*mongod\|.*init//') + rv=$(port_status $i | sed 's/.*-$\|.*systemd\|.*beam.smp.*\|.*epmd\|.*st2.*\|.*nginx.*\|.*python.*\|.*postgres\|.*postmaster.*\|.*mongod\|.*init//') if [ "$rv" != "Unbound" ] && [ "$rv" != "" ]; then used+=("$rv") fi @@ -238,8 +239,9 @@ check_st2_host_dependencies() { generate_random_passwords() { - # Generate random password used for MongoDB user authentication + # Generate random password used for MongoDB and PostgreSQL user authentication ST2_MONGODB_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 ; echo '') + ST2_POSTGRESQL_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 ; echo '') } @@ -517,6 +519,19 @@ get_full_pkg_versions() { exit 3 fi + if [[ "$SUBTYPE" != 'bionic' ]]; then + # Bionic doesn't support Mistral + local ST2MISTRAL_VER=$(apt-cache show st2mistral | grep Version | awk '{print $2}' | grep ^${VERSION//./\\.} | sort --version-sort | tail -n 1) + + if [[ -z "$ST2MISTRAL_VER" ]]; then + echo "Could not find requested version of st2mistral!!!" + sudo apt-cache policy st2mistral + exit 3 + fi + else + local ST2MISTRAL_VER="none" + fi + local ST2WEB_VER=$(apt-cache show st2web | grep Version | awk '{print $2}' | grep ^${VERSION//./\\.} | sort --version-sort | tail -n 1) if [[ -z "$ST2WEB_VER" ]]; then echo "Could not find requested version of st2web." @@ -532,11 +547,13 @@ get_full_pkg_versions() { fi ST2_PKG_VERSION="=${ST2_VER}" + ST2MISTRAL_PKG_VERSION="=${ST2MISTRAL_VER}" ST2WEB_PKG_VERSION="=${ST2WEB_VER}" ST2CHATOPS_PKG_VERSION="=${ST2CHATOPS_VER}" echo "##########################################################" echo "#### Following versions of packages will be installed ####" echo "st2${ST2_PKG_VERSION}" + echo "st2mistral${ST2MISTRAL_PKG_VERSION}" echo "st2web${ST2WEB_PKG_VERSION}" echo "st2chatops${ST2CHATOPS_PKG_VERSION}" echo "##########################################################" @@ -547,7 +564,8 @@ install_st2() { # Following script adds a repo file, registers gpg key and runs apt-get update curl -sL https://packagecloud.io/install/repositories/StackStorm/${REPO_PREFIX}${RELEASE}/script.deb.sh | sudo bash - if [[ "$DEV_BUILD" = '' ]]; then + # 'mistral' repo builds single 'st2mistral' package and so we have to install 'st2' from repo + if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^mistral/.* ]]; then STEP="Get package versions" && get_full_pkg_versions && STEP="Install st2" sudo apt-get install -y st2${ST2_PKG_VERSION} else @@ -587,6 +605,46 @@ configure_st2_authentication() { sudo st2ctl restart-component st2stream } +install_st2mistral_dependencies() { + sudo apt-get install -y postgresql + + # Configure service only listens on localhost + sudo crudini --set /etc/postgresql/*/main/postgresql.conf '' listen_addresses "'127.0.0.1'" + + sudo service postgresql restart + cat << EHD | sudo -u postgres psql +CREATE ROLE mistral WITH CREATEDB LOGIN ENCRYPTED PASSWORD '${ST2_POSTGRESQL_PASSWORD}'; +CREATE DATABASE mistral OWNER mistral; +EHD +} + +install_st2mistral() { + # 'st2' repo builds single 'st2' package and so we have to install 'st2mistral' from repo + if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^st2/.* ]]; then + sudo apt-get install -y st2mistral${ST2MISTRAL_PKG_VERSION} + else + sudo apt-get install -y jq + + PACKAGE_URL=$(get_package_url "${DEV_BUILD}" "${SUBTYPE}" "st2mistral_.*.deb") + PACKAGE_FILENAME="$(basename ${PACKAGE_URL})" + curl -sSL -k -o ${PACKAGE_FILENAME} ${PACKAGE_URL} + sudo dpkg -i --force-depends ${PACKAGE_FILENAME} + sudo apt-get install -yf + rm ${PACKAGE_FILENAME} + fi + + # Configure database settings + sudo crudini --set /etc/mistral/mistral.conf database connection "postgresql+psycopg2://mistral:${ST2_POSTGRESQL_PASSWORD}@127.0.0.1/mistral" + + # Setup Mistral DB tables, etc. + /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head + + # Register mistral actions. + /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf populate | grep -v openstack | grep -v "ironicclient" + + # Start Mistral + sudo service mistral start +} install_st2web() { # Add key and repo for the latest stable nginx @@ -673,6 +731,10 @@ STEP="Configure st2 CLI config" && configure_st2_cli_config STEP="Generate symmetric crypto key for datastore" && generate_symmetric_crypto_key_for_datastore STEP="Verify st2" && verify_st2 +if [[ "${SUBTYPE}" != "bionic" ]]; then + STEP="Install mistral dependencies" && install_st2mistral_dependencies + STEP="Install mistral" && install_st2mistral +fi STEP="Install st2web" && install_st2web diff --git a/scripts/st2bootstrap-deb.template.sh b/scripts/st2bootstrap-deb.template.sh index f6271111..e87747fa 100644 --- a/scripts/st2bootstrap-deb.template.sh +++ b/scripts/st2bootstrap-deb.template.sh @@ -7,6 +7,7 @@ RELEASE='stable' REPO_TYPE='' REPO_PREFIX='' ST2_PKG_VERSION='' +ST2MISTRAL_PKG_VERSION='' ST2WEB_PKG_VERSION='' ST2CHATOPS_PKG_VERSION='' DEV_BUILD='' @@ -204,6 +205,19 @@ get_full_pkg_versions() { exit 3 fi + if [[ "$SUBTYPE" != 'bionic' ]]; then + # Bionic doesn't support Mistral + local ST2MISTRAL_VER=$(apt-cache show st2mistral | grep Version | awk '{print $2}' | grep ^${VERSION//./\\.} | sort --version-sort | tail -n 1) + + if [[ -z "$ST2MISTRAL_VER" ]]; then + echo "Could not find requested version of st2mistral!!!" + sudo apt-cache policy st2mistral + exit 3 + fi + else + local ST2MISTRAL_VER="none" + fi + local ST2WEB_VER=$(apt-cache show st2web | grep Version | awk '{print $2}' | grep ^${VERSION//./\\.} | sort --version-sort | tail -n 1) if [[ -z "$ST2WEB_VER" ]]; then echo "Could not find requested version of st2web." @@ -219,11 +233,13 @@ get_full_pkg_versions() { fi ST2_PKG_VERSION="=${ST2_VER}" + ST2MISTRAL_PKG_VERSION="=${ST2MISTRAL_VER}" ST2WEB_PKG_VERSION="=${ST2WEB_VER}" ST2CHATOPS_PKG_VERSION="=${ST2CHATOPS_VER}" echo "##########################################################" echo "#### Following versions of packages will be installed ####" echo "st2${ST2_PKG_VERSION}" + echo "st2mistral${ST2MISTRAL_PKG_VERSION}" echo "st2web${ST2WEB_PKG_VERSION}" echo "st2chatops${ST2CHATOPS_PKG_VERSION}" echo "##########################################################" @@ -234,7 +250,8 @@ install_st2() { # Following script adds a repo file, registers gpg key and runs apt-get update curl -sL https://packagecloud.io/install/repositories/StackStorm/${REPO_PREFIX}${RELEASE}/script.deb.sh | sudo bash - if [[ "$DEV_BUILD" = '' ]]; then + # 'mistral' repo builds single 'st2mistral' package and so we have to install 'st2' from repo + if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^mistral/.* ]]; then STEP="Get package versions" && get_full_pkg_versions && STEP="Install st2" sudo apt-get install -y st2${ST2_PKG_VERSION} else @@ -274,6 +291,46 @@ configure_st2_authentication() { sudo st2ctl restart-component st2stream } +install_st2mistral_dependencies() { + sudo apt-get install -y postgresql + + # Configure service only listens on localhost + sudo crudini --set /etc/postgresql/*/main/postgresql.conf '' listen_addresses "'127.0.0.1'" + + sudo service postgresql restart + cat << EHD | sudo -u postgres psql +CREATE ROLE mistral WITH CREATEDB LOGIN ENCRYPTED PASSWORD '${ST2_POSTGRESQL_PASSWORD}'; +CREATE DATABASE mistral OWNER mistral; +EHD +} + +install_st2mistral() { + # 'st2' repo builds single 'st2' package and so we have to install 'st2mistral' from repo + if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^st2/.* ]]; then + sudo apt-get install -y st2mistral${ST2MISTRAL_PKG_VERSION} + else + sudo apt-get install -y jq + + PACKAGE_URL=$(get_package_url "${DEV_BUILD}" "${SUBTYPE}" "st2mistral_.*.deb") + PACKAGE_FILENAME="$(basename ${PACKAGE_URL})" + curl -sSL -k -o ${PACKAGE_FILENAME} ${PACKAGE_URL} + sudo dpkg -i --force-depends ${PACKAGE_FILENAME} + sudo apt-get install -yf + rm ${PACKAGE_FILENAME} + fi + + # Configure database settings + sudo crudini --set /etc/mistral/mistral.conf database connection "postgresql+psycopg2://mistral:${ST2_POSTGRESQL_PASSWORD}@127.0.0.1/mistral" + + # Setup Mistral DB tables, etc. + /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head + + # Register mistral actions. + /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf populate | grep -v openstack | grep -v "ironicclient" + + # Start Mistral + sudo service mistral start +} install_st2web() { # Add key and repo for the latest stable nginx @@ -360,6 +417,10 @@ STEP="Configure st2 CLI config" && configure_st2_cli_config STEP="Generate symmetric crypto key for datastore" && generate_symmetric_crypto_key_for_datastore STEP="Verify st2" && verify_st2 +if [[ "${SUBTYPE}" != "bionic" ]]; then + STEP="Install mistral dependencies" && install_st2mistral_dependencies + STEP="Install mistral" && install_st2mistral +fi STEP="Install st2web" && install_st2web diff --git a/scripts/st2bootstrap-el7.sh b/scripts/st2bootstrap-el7.sh index 3bc610f0..909f3ef0 100644 --- a/scripts/st2bootstrap-el7.sh +++ b/scripts/st2bootstrap-el7.sh @@ -19,6 +19,7 @@ DEV_BUILD='' USERNAME='' PASSWORD='' ST2_PKG='st2' +ST2MISTRAL_PKG='st2mistral' ST2WEB_PKG='st2web' ST2CHATOPS_PKG='st2chatops' @@ -194,14 +195,14 @@ check_st2_host_dependencies() { # CHECK 1: Determine which, if any, of the required ports are used by an existing process. # Abort the installation early if the following ports are being used by an existing process. - # nginx (80, 443), mongodb (27017), rabbitmq (4369, 5672, 25672), and st2 (9100-9102). + # nginx (80, 443), mongodb (27017), rabbitmq (4369, 5672, 25672), postgresql (5432) and st2 (9100-9102). - declare -a ports=("80" "443" "4369" "5672" "9100" "9101" "9102" "25672" "27017") + declare -a ports=("80" "443" "4369" "5432" "5672" "9100" "9101" "9102" "25672" "27017") declare -a used=() for i in "${ports[@]}" do - rv=$(port_status $i | sed 's/.*-$\|.*systemd\|.*beam.smp.*\|.*epmd\|.*st2.*\|.*nginx.*\|.*python.*\|.*postmaster.*\|.*mongod\|.*init//') + rv=$(port_status $i | sed 's/.*-$\|.*systemd\|.*beam.smp.*\|.*epmd\|.*st2.*\|.*nginx.*\|.*python.*\|.*postgres\|.*postmaster.*\|.*mongod\|.*init//') if [ "$rv" != "Unbound" ] && [ "$rv" != "" ]; then used+=("$rv") fi @@ -232,8 +233,9 @@ check_st2_host_dependencies() { generate_random_passwords() { - # Generate random password used for MongoDB user authentication + # Generate random password used for MongoDB and PostgreSQL user authentication ST2_MONGODB_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 ; echo '') + ST2_POSTGRESQL_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 ; echo '') } @@ -441,6 +443,15 @@ get_full_pkg_versions() { fi ST2_PKG=${ST2_VER} + local ST2MISTRAL_VER=$(repoquery ${YES_FLAG} --nvr --show-duplicates st2mistral | grep -F st2mistral-${VERSION} | sort --version-sort | tail -n 1) + # RHEL 8 and newer does not install Mistral + if [[ -z "$ST2MISTRAL_VER" && "$RHMAJVER" -lt "8" ]]; then + echo "Could not find requested version of st2mistral!!!" + sudo repoquery ${YES_FLAG} --nvr --show-duplicates st2mistral + exit 3 + fi + ST2MISTRAL_PKG=${ST2MISTRAL_VER} + local ST2WEB_VER=$(repoquery ${YES_FLAG} --nvr --show-duplicates st2web | grep -F st2web-${VERSION} | sort --version-sort | tail -n 1) if [ -z "$ST2WEB_VER" ]; then echo "Could not find requested version of st2web." @@ -460,6 +471,7 @@ get_full_pkg_versions() { echo "##########################################################" echo "#### Following versions of packages will be installed ####" echo "${ST2_PKG}" + echo "${ST2MISTRAL_PKG}" echo "${ST2WEB_PKG}" echo "${ST2CHATOPS_PKG}" echo "##########################################################" @@ -565,7 +577,8 @@ EOF install_st2() { curl -sL https://packagecloud.io/install/repositories/StackStorm/${REPO_PREFIX}${RELEASE}/script.rpm.sh | sudo bash - if [[ "$DEV_BUILD" = '' ]]; then + # 'mistral' repo builds single 'st2mistral' package and so we have to install 'st2' from repo + if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^mistral/.* ]]; then STEP="Get package versions" && get_full_pkg_versions && STEP="Install st2" sudo yum -y install ${ST2_PKG} else @@ -602,6 +615,53 @@ configure_st2_authentication() { } +install_st2mistral_dependencies() { + sudo yum -y install postgresql-server postgresql-contrib postgresql-devel + + # Setup postgresql at a first time + sudo postgresql-setup initdb + + # Configure service only listens on localhost + sudo sh -c "echo \"listen_addresses = '127.0.0.1'\" >> /var/lib/pgsql/data/postgresql.conf" + + # Make localhost connections to use an MD5-encrypted password for authentication + sudo sed -i "s/\(host.*all.*all.*127.0.0.1\/32.*\)ident/\1md5/" /var/lib/pgsql/data/pg_hba.conf + sudo sed -i "s/\(host.*all.*all.*::1\/128.*\)ident/\1md5/" /var/lib/pgsql/data/pg_hba.conf + + # Start PostgreSQL service + sudo systemctl start postgresql + sudo systemctl enable postgresql + + cat << EHD | sudo -u postgres psql +CREATE ROLE mistral WITH CREATEDB LOGIN ENCRYPTED PASSWORD '${ST2_POSTGRESQL_PASSWORD}'; +CREATE DATABASE mistral OWNER mistral; +EHD +} + +install_st2mistral() { + # 'st2' repo builds single 'st2' package and so we have to install 'st2mistral' from repo + if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^st2/.* ]]; then + sudo yum -y install ${ST2MISTRAL_PKG} + else + sudo yum -y install jq + + PACKAGE_URL=$(get_package_url "${DEV_BUILD}" "el7" "st2mistral-.*.rpm") + sudo yum -y install ${PACKAGE_URL} + fi + + # Configure database settings + sudo crudini --set /etc/mistral/mistral.conf database connection "postgresql+psycopg2://mistral:${ST2_POSTGRESQL_PASSWORD}@127.0.0.1/mistral" + + # Setup Mistral DB tables, etc. + /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head + + # Register mistral actions. + /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf populate | grep -v openstack | grep -v "ironicclient" + + # start mistral + sudo systemctl start mistral +} + install_st2web() { # Add key and repo for the latest stable nginx sudo rpm --import http://nginx.org/keys/nginx_signing.key @@ -704,6 +764,8 @@ STEP="Configure st2 CLI config" && configure_st2_cli_config STEP="Generate symmetric crypto key for datastore" && generate_symmetric_crypto_key_for_datastore STEP="Verify st2" && verify_st2 +STEP="Install mistral dependencies" && install_st2mistral_dependencies +STEP="Install mistral" && install_st2mistral STEP="Install st2web" && install_st2web STEP="Install st2chatops" && install_st2chatops diff --git a/scripts/st2bootstrap-el7.template.sh b/scripts/st2bootstrap-el7.template.sh index d007b329..1062e37f 100644 --- a/scripts/st2bootstrap-el7.template.sh +++ b/scripts/st2bootstrap-el7.template.sh @@ -11,6 +11,7 @@ DEV_BUILD='' USERNAME='' PASSWORD='' ST2_PKG='st2' +ST2MISTRAL_PKG='st2mistral' ST2WEB_PKG='st2web' ST2CHATOPS_PKG='st2chatops' @@ -202,7 +203,8 @@ EOF install_st2() { curl -sL https://packagecloud.io/install/repositories/StackStorm/${REPO_PREFIX}${RELEASE}/script.rpm.sh | sudo bash - if [[ "$DEV_BUILD" = '' ]]; then + # 'mistral' repo builds single 'st2mistral' package and so we have to install 'st2' from repo + if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^mistral/.* ]]; then STEP="Get package versions" && get_full_pkg_versions && STEP="Install st2" sudo yum -y install ${ST2_PKG} else @@ -239,6 +241,53 @@ configure_st2_authentication() { } +install_st2mistral_dependencies() { + sudo yum -y install postgresql-server postgresql-contrib postgresql-devel + + # Setup postgresql at a first time + sudo postgresql-setup initdb + + # Configure service only listens on localhost + sudo sh -c "echo \"listen_addresses = '127.0.0.1'\" >> /var/lib/pgsql/data/postgresql.conf" + + # Make localhost connections to use an MD5-encrypted password for authentication + sudo sed -i "s/\(host.*all.*all.*127.0.0.1\/32.*\)ident/\1md5/" /var/lib/pgsql/data/pg_hba.conf + sudo sed -i "s/\(host.*all.*all.*::1\/128.*\)ident/\1md5/" /var/lib/pgsql/data/pg_hba.conf + + # Start PostgreSQL service + sudo systemctl start postgresql + sudo systemctl enable postgresql + + cat << EHD | sudo -u postgres psql +CREATE ROLE mistral WITH CREATEDB LOGIN ENCRYPTED PASSWORD '${ST2_POSTGRESQL_PASSWORD}'; +CREATE DATABASE mistral OWNER mistral; +EHD +} + +install_st2mistral() { + # 'st2' repo builds single 'st2' package and so we have to install 'st2mistral' from repo + if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^st2/.* ]]; then + sudo yum -y install ${ST2MISTRAL_PKG} + else + sudo yum -y install jq + + PACKAGE_URL=$(get_package_url "${DEV_BUILD}" "el7" "st2mistral-.*.rpm") + sudo yum -y install ${PACKAGE_URL} + fi + + # Configure database settings + sudo crudini --set /etc/mistral/mistral.conf database connection "postgresql+psycopg2://mistral:${ST2_POSTGRESQL_PASSWORD}@127.0.0.1/mistral" + + # Setup Mistral DB tables, etc. + /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf upgrade head + + # Register mistral actions. + /opt/stackstorm/mistral/bin/mistral-db-manage --config-file /etc/mistral/mistral.conf populate | grep -v openstack | grep -v "ironicclient" + + # start mistral + sudo systemctl start mistral +} + install_st2web() { # Add key and repo for the latest stable nginx sudo rpm --import http://nginx.org/keys/nginx_signing.key @@ -341,6 +390,8 @@ STEP="Configure st2 CLI config" && configure_st2_cli_config STEP="Generate symmetric crypto key for datastore" && generate_symmetric_crypto_key_for_datastore STEP="Verify st2" && verify_st2 +STEP="Install mistral dependencies" && install_st2mistral_dependencies +STEP="Install mistral" && install_st2mistral STEP="Install st2web" && install_st2web STEP="Install st2chatops" && install_st2chatops diff --git a/scripts/st2bootstrap-el8.sh b/scripts/st2bootstrap-el8.sh index 1f13d72b..13501d1a 100644 --- a/scripts/st2bootstrap-el8.sh +++ b/scripts/st2bootstrap-el8.sh @@ -198,14 +198,14 @@ check_st2_host_dependencies() { # CHECK 1: Determine which, if any, of the required ports are used by an existing process. # Abort the installation early if the following ports are being used by an existing process. - # nginx (80, 443), mongodb (27017), rabbitmq (4369, 5672, 25672), and st2 (9100-9102). + # nginx (80, 443), mongodb (27017), rabbitmq (4369, 5672, 25672), postgresql (5432) and st2 (9100-9102). - declare -a ports=("80" "443" "4369" "5672" "9100" "9101" "9102" "25672" "27017") + declare -a ports=("80" "443" "4369" "5432" "5672" "9100" "9101" "9102" "25672" "27017") declare -a used=() for i in "${ports[@]}" do - rv=$(port_status $i | sed 's/.*-$\|.*systemd\|.*beam.smp.*\|.*epmd\|.*st2.*\|.*nginx.*\|.*python.*\|.*postmaster.*\|.*mongod\|.*init//') + rv=$(port_status $i | sed 's/.*-$\|.*systemd\|.*beam.smp.*\|.*epmd\|.*st2.*\|.*nginx.*\|.*python.*\|.*postgres\|.*postmaster.*\|.*mongod\|.*init//') if [ "$rv" != "Unbound" ] && [ "$rv" != "" ]; then used+=("$rv") fi @@ -236,8 +236,9 @@ check_st2_host_dependencies() { generate_random_passwords() { - # Generate random password used for MongoDB user authentication + # Generate random password used for MongoDB and PostgreSQL user authentication ST2_MONGODB_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 ; echo '') + ST2_POSTGRESQL_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 24 ; echo '') } @@ -445,6 +446,15 @@ get_full_pkg_versions() { fi ST2_PKG=${ST2_VER} + local ST2MISTRAL_VER=$(repoquery ${YES_FLAG} --nvr --show-duplicates st2mistral | grep -F st2mistral-${VERSION} | sort --version-sort | tail -n 1) + # RHEL 8 and newer does not install Mistral + if [[ -z "$ST2MISTRAL_VER" && "$RHMAJVER" -lt "8" ]]; then + echo "Could not find requested version of st2mistral!!!" + sudo repoquery ${YES_FLAG} --nvr --show-duplicates st2mistral + exit 3 + fi + ST2MISTRAL_PKG=${ST2MISTRAL_VER} + local ST2WEB_VER=$(repoquery ${YES_FLAG} --nvr --show-duplicates st2web | grep -F st2web-${VERSION} | sort --version-sort | tail -n 1) if [ -z "$ST2WEB_VER" ]; then echo "Could not find requested version of st2web." @@ -464,6 +474,7 @@ get_full_pkg_versions() { echo "##########################################################" echo "#### Following versions of packages will be installed ####" echo "${ST2_PKG}" + echo "${ST2MISTRAL_PKG}" echo "${ST2WEB_PKG}" echo "${ST2CHATOPS_PKG}" echo "##########################################################" @@ -584,7 +595,8 @@ EOF install_st2() { curl -sL https://packagecloud.io/install/repositories/StackStorm/${REPO_PREFIX}${RELEASE}/script.rpm.sh | sudo bash - if [[ "$DEV_BUILD" = '' ]]; then + # 'mistral' repo builds single 'st2mistral' package and so we have to install 'st2' from repo + if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^mistral/.* ]]; then STEP="Get package versions" && get_full_pkg_versions && STEP="Install st2" sudo yum -y install ${ST2_PKG} else diff --git a/scripts/st2bootstrap-el8.template.sh b/scripts/st2bootstrap-el8.template.sh index fb47b104..6e4d302a 100644 --- a/scripts/st2bootstrap-el8.template.sh +++ b/scripts/st2bootstrap-el8.template.sh @@ -221,7 +221,8 @@ EOF install_st2() { curl -sL https://packagecloud.io/install/repositories/StackStorm/${REPO_PREFIX}${RELEASE}/script.rpm.sh | sudo bash - if [[ "$DEV_BUILD" = '' ]]; then + # 'mistral' repo builds single 'st2mistral' package and so we have to install 'st2' from repo + if [[ "$DEV_BUILD" = '' ]] || [[ "$DEV_BUILD" =~ ^mistral/.* ]]; then STEP="Get package versions" && get_full_pkg_versions && STEP="Install st2" sudo yum -y install ${ST2_PKG} else From de226ad78cc9a168d8aa0eccd939c2ea3b4e6e40 Mon Sep 17 00:00:00 2001 From: amanda Date: Fri, 31 Jul 2020 17:30:06 +0100 Subject: [PATCH 4/5] Put back EL6 change --- scripts/st2_bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/st2_bootstrap.sh b/scripts/st2_bootstrap.sh index eb378652..437b5f65 100644 --- a/scripts/st2_bootstrap.sh +++ b/scripts/st2_bootstrap.sh @@ -152,7 +152,7 @@ if [[ -n "$RHTEST" ]]; then echo "*** Detected Distro is ${RHTEST} ***" RHMAJVER=`cat /etc/redhat-release | sed 's/[^0-9.]*\([0-9.]\).*/\1/'` echo "*** Detected distro version ${RHMAJVER} ***" - if [[ "$RHMAJVER" != '7' && "$RHMAJVER" != '8' ]]; then + if [[ "$RHMAJVER" != '6' && "$RHMAJVER" != '7' && "$RHMAJVER" != '8' ]]; then echo "Unsupported distro version $RHMAJVER! Aborting!" exit 2 fi From 92548a55a23694eee6816e42c7ba582b785a4cf8 Mon Sep 17 00:00:00 2001 From: armab Date: Mon, 10 Aug 2020 14:19:58 +0100 Subject: [PATCH 5/5] Remove mistral and postgresql mentions from the Issue template --- .github/ISSUE_TEMPLATE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 8ab11894..8f0c265b 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -4,10 +4,10 @@ relevant information. * [ ] Operating system: `uname -a`, `./etc/lsb_release` or `cat /etc/redhat-release` * [ ] StackStorm version: `st2 --version` - * [ ] Actual package versions of all packages (st2, st2web, st2chatops, st2mistral, nginx, mongo, rabbitmq-server, postrgresql; Enterprise: st2flow, st2-auth-ldap) + * [ ] Actual package versions of all packages (st2, st2web, st2chatops, nginx, mongo, rabbitmq-server) DEB: apt-cache policy ${PACKAGE_NAME} will give you the version of package. RPM: yum info ${PACKAGE_NAME} will you give the version of package. - Note the exact name of mongo, nginx, rabbitmq and postgres changes based on OS. + Note the exact name of mongo, nginx, rabbitmq changes based on OS. * [ ] Contents of /etc/st2/st2.conf * [ ] Output of st2ctl status * [ ] Optional - Details about target box. E.g. vagrant box link or AWS AMI link.