Skip to content

Commit

Permalink
Merge pull request #4415 from StackStorm/try-fix/logging-new-services
Browse files Browse the repository at this point in the history
Improve st2.conf migration for the new services
  • Loading branch information
armab authored Oct 30, 2018
2 parents ee1a6a3 + 4adedd4 commit eac2527
Show file tree
Hide file tree
Showing 17 changed files with 28 additions and 155 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ Changed
* Update various internal dependencies to latest stable versions (greenlet, pymongo, pytz,
stevedore, tooz). #4410

* Improve ``st2.conf`` migration for the new services by using prod-friendly logging settings by default #4415

Fixed
~~~~~

Expand Down
26 changes: 13 additions & 13 deletions conf/st2.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ virtualenv_binary = /usr/bin/virtualenv
# Python 3 binary which will be used by Python actions for packs which use Python 3 virtual environment
python3_binary = /usr/bin/python3
# location of the logging.conf file
logging = conf/logging.conf
logging = /etc/st2/logging.actionrunner.conf
# True to store and stream action output (stdout and stderr) in real-time.
stream_output = True
# List of virtualenv options to be passsed to "virtualenv" command that creates pack virtualenv.
Expand All @@ -31,7 +31,7 @@ python_binary = /usr/bin/python
# List of origins allowed for api, auth and stream
allow_origin = http://127.0.0.1:3000 # comma separated list allowed here.
# location of the logging.conf file
logging = conf/logging.conf
logging = /etc/st2/logging.api.conf
# Maximum limit (page size) argument which can be specified by the user in a query string.
max_page_size = 100
# True to mask secrets in the API responses
Expand All @@ -50,7 +50,7 @@ port = 9101
# Enable authentication middleware.
enable = True
# Path to the logging config.
logging = conf/logging.conf
logging = /etc/st2/logging.auth.conf
# Base URL to the API endpoint excluding the version
api_url = None
# Service token ttl in seconds.
Expand Down Expand Up @@ -138,7 +138,7 @@ port = 27017

[exporter]
# location of the logging.exporter.conf file
logging = conf/logging.exporter.conf
logging = /etc/st2/logging.exporter.conf
# Directory to dump data to.
dump_dir = /opt/stackstorm/exports/

Expand All @@ -148,7 +148,7 @@ action_executions_ttl = None
# Trigger instances older than this value (days) will be automatically deleted.
trigger_instances_ttl = None
# Location of the logging configuration file.
logging = conf/logging.garbagecollector.conf
logging = /etc/st2/logging.garbagecollector.conf
# How long to wait / sleep (in seconds) between collection of different object types.
sleep_delay = 2
# Set to True to perform garbage collection on Inquiries (based on the TTL value per Inquiry)
Expand Down Expand Up @@ -226,7 +226,7 @@ retry_exp_max_msec = 300000

[notifier]
# Location of the logging configuration file.
logging = conf/logging.notifier.conf
logging = /etc/st2/logging.notifier.conf

[packs]
# Enable/Disable support for pack common libs. Setting this config to ``True`` would allow you to place common library code for sensors and actions in lib/ folder in packs and use them in python sensors and actions. See https://docs.stackstorm.com/reference/sharing_code_sensors_actions.html for details.
Expand All @@ -238,15 +238,15 @@ query_interval = 5
# Sleep delay in between queries when query queue is empty.
empty_q_sleep_time = 1
# Location of the logging configuration file.
logging = conf/logging.resultstracker.conf
logging = /etc/st2/logging.resultstracker.conf
# Sleep delay for query when there is no more worker in pool.
no_workers_sleep_time = 1
# Number of threads to use to query external workflow systems.
thread_pool_size = 10

[rulesengine]
# Location of the logging configuration file.
logging = conf/logging.rulesengine.conf
logging = /etc/st2/logging.rulesengine.conf

[scheduler]
# The frequency for rescheduling action executions.
Expand All @@ -268,7 +268,7 @@ partition_provider = {'name': 'default'}
# Run in a single sensor mode where parent process exits when a sensor crashes / dies. This is useful in environments where partitioning, sensor process life cycle and failover is handled by a 3rd party service such as kubernetes.
single_sensor_mode = False
# location of the logging.conf file
logging = conf/logging.sensorcontainer.conf
logging = /etc/st2/logging.sensorcontainer.conf
# name of the sensor node.
sensor_node_name = sensornode1

Expand All @@ -292,7 +292,7 @@ heartbeat = 25
# StackStorm stream API server host
host = 127.0.0.1
# location of the logging.conf file
logging = conf/logging.conf
logging = /etc/st2/logging.stream.conf
# StackStorm API stream, server port
port = 9102

Expand Down Expand Up @@ -330,21 +330,21 @@ enable = True
# Timezone pertaining to the location where st2 is run.
local_timezone = America/Los_Angeles
# Location of the logging configuration file.
logging = conf/logging.timersengine.conf
logging = /etc/st2/logging.timersengine.conf

[timersengine]
# Specify to enable timer service.
enable = True
# Timezone pertaining to the location where st2 is run.
local_timezone = America/Los_Angeles
# Location of the logging configuration file.
logging = conf/logging.timersengine.conf
logging = /etc/st2/logging.timersengine.conf

[webui]
# Base https URL to access st2 Web UI. This is used to construct history URLs that are sent out when chatops is used to kick off executions.
webui_base_url = https://localhost

[workflow_engine]
# Location of the logging configuration file.
logging = conf/logging.workflowengine.conf
logging = /etc/st2/logging.workflowengine.conf

84 changes: 0 additions & 84 deletions conf/st2.prod.conf

This file was deleted.

2 changes: 1 addition & 1 deletion st2actions/st2actions/notifier/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def _register_common_opts():
def _register_notifier_opts():
notifier_opts = [
cfg.StrOpt(
'logging', default='conf/logging.notifier.conf',
'logging', default='/etc/st2/logging.notifier.conf',
help='Location of the logging configuration file.')
]

Expand Down
2 changes: 1 addition & 1 deletion st2actions/st2actions/resultstracker/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def _register_common_opts():
def _register_results_tracker_opts():
resultstracker_opts = [
cfg.StrOpt(
'logging', default='conf/logging.resultstracker.conf',
'logging', default='/etc/st2/logging.resultstracker.conf',
help='Location of the logging configuration file.')
]

Expand Down
2 changes: 1 addition & 1 deletion st2actions/st2actions/scheduler/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def _register_service_opts():
scheduler_opts = [
cfg.StrOpt(
'logging',
default='conf/logging.scheduler.conf',
default='/etc/st2/logging.scheduler.conf',
help='Location of the logging configuration file.'
)
]
Expand Down
2 changes: 1 addition & 1 deletion st2actions/st2actions/workflows/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def _register_service_opts():
wf_engine_opts = [
cfg.StrOpt(
'logging',
default='conf/logging.workflowengine.conf',
default='/etc/st2/logging.workflowengine.conf',
help='Location of the logging configuration file.'
)
]
Expand Down
2 changes: 1 addition & 1 deletion st2api/st2api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def _register_app_opts():
logging_opts = [
cfg.BoolOpt('debug', default=False),
cfg.StrOpt(
'logging', default='conf/logging.conf',
'logging', default='/etc/st2/logging.api.conf',
help='location of the logging.conf file'),
cfg.IntOpt(
'max_page_size', default=100,
Expand Down
2 changes: 1 addition & 1 deletion st2auth/st2auth/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _register_app_opts():
'key', default='/etc/apache2/ssl/mycert.key',
help='Path to the SSL private key file. Only used when "use_ssl" is specified.'),
cfg.StrOpt(
'logging', default='conf/logging.conf',
'logging', default='/etc/st2/logging.auth.conf',
help='Path to the logging config.'),
cfg.BoolOpt(
'debug', default=False,
Expand Down
45 changes: 0 additions & 45 deletions st2common/Makefile
Original file line number Diff line number Diff line change
@@ -1,48 +1,3 @@
# <<<< TO DEPRICATE
SHELL := /bin/bash
RPM_ROOT=~/rpmbuild
RPM_SOURCES_DIR := $(RPM_ROOT)/SOURCES/
RPM_SPECS_DIR := $(RPM_ROOT)/SPECS/
VER=0.4.0

COMPONENTS := st2common

.PHONY: rpm
rpm:
pushd ~ && rpmdev-setuptree && popd
mkdir -p st2 && cp -f ../conf/st2.prod.conf st2/st2.conf
mkdir -p logrotate.d && cp -f ../conf/logrotate.conf logrotate.d/st2.conf
mkdir -p rbac/roles && cp -f ../st2tests/st2tests/fixtures/rbac/roles/role_sample.yaml rbac/roles/sample.yaml
mkdir -p rbac/assignments && cp -f ../st2tests/st2tests/fixtures/rbac/assignments/user_sample.yaml rbac/assignments/sample.yaml
sed -i '/\[actionrunner\]/a python_binary = /usr/bin/python2.7' st2/st2.conf
tar --transform=s~^~$(COMPONENTS)-$(VER)/~ --exclude=correlation -czf $(RPM_SOURCES_DIR)/$(COMPONENTS).tar.gz bin st2 logrotate.d rbac $(COMPONENTS) ../contrib ../tools/ ../requirements.txt
cp packaging/rpm/$(COMPONENTS).spec $(RPM_SPECS_DIR)/
cd $(RPM_SPECS_DIR) && rpmbuild --clean --rmsource -ba $(COMPONENTS).spec

.PHONY: rhel-rpm
rhel-rpm:
pushd ~ && rpmdev-setuptree && popd
mkdir -p st2 && cp -f ../conf/st2.prod.conf st2/st2.conf
mkdir -p logrotate.d && cp -f ../conf/logrotate.conf logrotate.d/st2.conf
mkdir -p rbac/roles && cp -f ../st2tests/st2tests/fixtures/rbac/roles/role_sample.yaml rbac/roles/sample.yaml
mkdir -p rbac/assignments && cp -f ../st2tests/st2tests/fixtures/rbac/assignments/user_sample.yaml rbac/assignments/sample.yaml
sed -i '/\[actionrunner\]/a python_binary = /usr/bin/python2.7' st2/st2.conf
tar --transform=s~^~$(COMPONENTS)-$(VER)/~ --exclude=correlation -czf $(RPM_SOURCES_DIR)/$(COMPONENTS).tar.gz bin st2 logrotate.d rbac $(COMPONENTS) ../contrib ../tools/ ../requirements.txt
cp packaging/rpm/$(COMPONENTS)-rhel6.spec $(RPM_SPECS_DIR)/
cd $(RPM_SPECS_DIR) && rpmbuild --clean --rmsource -ba $(COMPONENTS)-rhel6.spec

.PHONY: deb
deb:
mkdir -p ~/debbuild
mkdir -p st2 && cp -f ../conf/st2.prod.conf st2/st2.conf
mkdir -p logrotate.d && cp -f ../conf/logrotate.conf logrotate.d/st2.conf
mkdir -p rbac/roles && cp -f ../st2tests/st2tests/fixtures/rbac/roles/role_sample.yaml rbac/roles/sample.yaml
mkdir -p rbac/assignments && cp -f ../st2tests/st2tests/fixtures/rbac/assignments/user_sample.yaml rbac/assignments/sample.yaml
tar --transform=s~^~$(COMPONENTS)-$(VER)/~ --exclude=correlation -czf ~/$(COMPONENTS).tar.gz bin st2 logrotate.d rbac $(COMPONENTS) ../contrib ../tools/ ../requirements.txt packaging/debian
pushd ~ && tar -xzf $(COMPONENTS).tar.gz && cd $(COMPONENTS)-$(VER) && cp -Rf packaging/debian ./ && dpkg-buildpackage -us -uc -b && popd
cp -f ~/$(COMPONENT)*.deb ~/debbuild/
# >>>>

WHEELDIR ?= /tmp/wheelhouse
ST2_COMPONENT := $(notdir $(CURDIR))
ST2PKG_RELEASE ?= 1
Expand Down
2 changes: 1 addition & 1 deletion st2common/st2common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def register_opts(ignore_errors=False):
action_runner_opts = [
# Common runner options
cfg.StrOpt(
'logging', default='conf/logging.conf',
'logging', default='/etc/st2/logging.actionrunner.conf',
help='location of the logging.conf file'),

# Python runner options
Expand Down
2 changes: 1 addition & 1 deletion st2exporter/st2exporter/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _register_app_opts():

logging_opts = [
cfg.StrOpt(
'logging', default='conf/logging.exporter.conf',
'logging', default='/etc/st2/logging.exporter.conf',
help='location of the logging.exporter.conf file')
]

Expand Down
2 changes: 1 addition & 1 deletion st2reactor/st2reactor/garbage_collector/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _register_common_opts():
def _register_garbage_collector_opts():
logging_opts = [
cfg.StrOpt(
'logging', default='conf/logging.garbagecollector.conf',
'logging', default='/etc/st2/logging.garbagecollector.conf',
help='Location of the logging configuration file.')
]

Expand Down
2 changes: 1 addition & 1 deletion st2reactor/st2reactor/rules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def _register_common_opts():
def _register_rules_engine_opts():
logging_opts = [
cfg.StrOpt(
'logging', default='conf/logging.rulesengine.conf',
'logging', default='/etc/st2/logging.rulesengine.conf',
help='Location of the logging configuration file.')
]

Expand Down
2 changes: 1 addition & 1 deletion st2reactor/st2reactor/sensor/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _register_common_opts(ignore_errors=False):
def _register_sensor_container_opts(ignore_errors=False):
logging_opts = [
cfg.StrOpt(
'logging', default='conf/logging.sensorcontainer.conf',
'logging', default='/etc/st2/logging.sensorcontainer.conf',
help='location of the logging.conf file')
]

Expand Down
2 changes: 1 addition & 1 deletion st2reactor/st2reactor/timer/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def _register_timers_engine_opts():
# under ``timer`` section as well as ``timersengine``.
logging_opts = [
cfg.StrOpt(
'logging', default='conf/logging.timersengine.conf',
'logging', default='/etc/st2/logging.timersengine.conf',
help='Location of the logging configuration file.')
]

Expand Down
2 changes: 1 addition & 1 deletion st2stream/st2stream/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _register_app_opts():
'debug', default=False,
help='Specify to enable debug mode.'),
cfg.StrOpt(
'logging', default='conf/logging.conf',
'logging', default='/etc/st2/logging.stream.conf',
help='location of the logging.conf file')
]

Expand Down

0 comments on commit eac2527

Please sign in to comment.