Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
18aabe8
st2api includes systemd unit
dennybaa Aug 20, 2015
fdafacd
st2actions with all system services
dennybaa Aug 25, 2015
025daaf
finalizing rpm packages specs
dennybaa Aug 25, 2015
166b587
removed linking of package services to /usr/bin
dennybaa Aug 25, 2015
0ebb38d
reactor services fixed in rpm package
dennybaa Aug 25, 2015
de4ddfa
added systemd services for rpm st2bundle
dennybaa Sep 8, 2015
e10a556
moving sources to st2 directory
dennybaa Sep 10, 2015
6b6738f
moving all packages into packages/
dennybaa Oct 30, 2015
2421938
Add files for the new st2garbagecollector service which is, for now, …
Kami Dec 22, 2015
48b5756
Also copy garbage collector init files to st2bundle directory.
Kami Dec 22, 2015
44f03f6
Fix the binary paths for garbage collector
Jan 14, 2016
1d1cc85
Add gunicorn and uwsgi to init files
enykeev Jan 22, 2016
a06e044
Start st2auth as gunicorn
enykeev Jan 25, 2016
460f734
removing apparently "FAR FUTURE PREOPTIMIZATION"
dennybaa Jan 20, 2016
4c8a885
fixing hardcoded arguments for st2auth, st2api services
dennybaa Jan 27, 2016
5a85eba
st2bundle renamed to st2
dennybaa Jan 30, 2016
e98906a
other code rewrites /usr/share/python to /opt/stackstorm
dennybaa Jan 30, 2016
302523d
Fix gunicorn graceful timeout
Feb 12, 2016
690c061
Add config files and other stuff for st2stream service.
Kami Feb 29, 2016
b7d9c30
Update st2api and st2auth to use sync gunicorn workers with 1 process…
Kami Feb 29, 2016
4c23959
For now use 1 worker, this should be plenty.
Kami Feb 29, 2016
6311e69
Use 2 worker processes for st2api.
Kami Feb 29, 2016
25dca39
running actionrunner as root:st2packs with umask 002 to provide group…
dennybaa Mar 2, 2016
086e852
set number of workers for st2api == 1
dennybaa Mar 4, 2016
6c878fa
Switch back to eventlet based gunicorn worker for st2api and st2auth.
Kami Apr 20, 2016
4f95843
Add service files to deb
Jul 13, 2016
9b7bd60
Fix default env directory
Jul 25, 2016
09d7352
Revert "Fixes for recent build container changes"
enykeev Jul 26, 2016
e064086
Use correct environment path for debian family systems
Aug 3, 2016
c52aed3
Update unit files for new REST services
Feb 17, 2017
0e25bf1
Add systemd socket files for Xenial
Mar 6, 2017
97a789d
Add systemd socket files for EL7
Mar 13, 2017
797a84a
Share private /tmp folder between actionrunner instances
Apr 25, 2017
ae60541
Add init files for all OSes for st2timersengine [ci skip]
Jun 18, 2018
5e66153
Typo in service file name
Jun 19, 2018
4563463
Add st2workflowengine service
m4dcoder Jun 21, 2018
0931407
Install and use special gunicorn logging config file for all gunicorn…
Kami Jun 27, 2018
bd07ef3
Adding scheduler
bigmstone Oct 9, 2018
c782c21
Make sure we log gunicorn st2api,st2auth,st2stream errors to a log fi…
Kami Apr 8, 2019
c1593ac
We can log gunicorn error logs to the existing API service log file.
Kami Apr 8, 2019
0aab4a4
Move static socket unit definitions to generators
nzlosh Jun 13, 2021
f4eb6a8
Fix typo
nzlosh Jun 13, 2021
4b42191
Fixed logging and formatting in systemd socket generators.
nzlosh Aug 22, 2021
da3f69a
Rewrite generator using python3
nzlosh Sep 22, 2021
2a85be4
Set executable for generators
nzlosh Sep 22, 2021
600fa10
rpm: Rely on %default_install to install *-generator from debian files
cognifloyd Oct 3, 2021
014b934
Add SourcPath= to generated .socket files
cognifloyd Oct 6, 2021
d7ecc8a
Relax ini parsing to allow duplicate entries.
nzlosh Oct 10, 2021
7a16dcb
Reorganize systemd files cherry-picked from st2-packages.git
cognifloyd Apr 13, 2023
e92e1cc
add changelog entry
cognifloyd Feb 16, 2025
01a1161
Merge branch 'master' into packaging-systemd
cognifloyd Feb 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ Added
* Add python 3.10 and 3.11 to the GitHub Actions test matrix.
Contributed by @nzlosh, @guzzijones12, and @cognifloyd

* Copy systemd files from st2-packages.git for future packaging via pants. #6303
Cherry-picked by @cognifloyd

3.8.1 - December 13, 2023
-------------------------
Fixed
Expand Down
56 changes: 56 additions & 0 deletions packaging/common/systemd/st2api-generator
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env python3
import configparser
import logging
import time
import sys

ST2SVC = "st2api"
DEFAULT_IP = "127.0.0.1"
DEFAULT_PORT = "9101"
ST2CFG = "/etc/st2/st2.conf"

# Systemd passes 3 paths to a generator, normal_dir, early_dir, late_dir.
default_paths = ["/tmp", "/tmp", "/tmp"]
for i, p in enumerate(sys.argv[1:]):
default_paths[i] = p
EARLY_DIR, NORMAL_DIR, LATE_DIR = default_paths

LOG_TO_DISK = True
LOG_KW = {
"level": logging.DEBUG,
"format": "%(asctime)s - %(levelname)s - %(message)s",
}
if LOG_TO_DISK:
LOG_KW["filename"] = f"{NORMAL_DIR}/{ST2SVC}_generator.log"

logging.basicConfig(**LOG_KW)
LOG = logging.getLogger()

LOG.debug(
f"Systemd directories: Early='{EARLY_DIR}' Normal='{NORMAL_DIR}' Late='{LATE_DIR}'"
)

config = configparser.ConfigParser(strict=False)
config.read(ST2CFG)

section = ST2SVC[3:]
bind_address = config[section].get("host", DEFAULT_IP)
bind_port = config[section].get("port", DEFAULT_PORT)

contents = f"""[Unit]
# Generated by {sys.argv[0]} at {time.asctime(time.localtime())}
Description=StackStorm {ST2SVC} Socket.
PartOf={ST2SVC}.service
SourcePath={ST2CFG}

[Socket]
ListenStream={bind_address}:{bind_port}

[Install]
WantedBy=sockets.target
"""

with open(f"{NORMAL_DIR}/{ST2SVC}.socket", "w") as f:
f.write(contents)

LOG.info(f"{ST2SVC} generated.")
56 changes: 56 additions & 0 deletions packaging/common/systemd/st2auth-generator
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env python3
import configparser
import logging
import time
import sys

ST2SVC="st2auth"
DEFAULT_IP="127.0.0.1"
DEFAULT_PORT="9100"
ST2CFG = "/etc/st2/st2.conf"

# Systemd passes 3 paths to a generator, normal_dir, early_dir, late_dir.
default_paths = ["/tmp", "/tmp", "/tmp"]
for i, p in enumerate(sys.argv[1:]):
default_paths[i] = p
EARLY_DIR, NORMAL_DIR, LATE_DIR = default_paths

LOG_TO_DISK = True
LOG_KW = {
"level": logging.DEBUG,
"format": "%(asctime)s - %(levelname)s - %(message)s",
}
if LOG_TO_DISK:
LOG_KW["filename"] = f"{NORMAL_DIR}/{ST2SVC}_generator.log"

logging.basicConfig(**LOG_KW)
LOG = logging.getLogger()

LOG.debug(
f"Systemd directories: Early='{EARLY_DIR}' Normal='{NORMAL_DIR}' Late='{LATE_DIR}'"
)

config = configparser.ConfigParser(strict=False)
config.read(ST2CFG)

section = ST2SVC[3:]
bind_address = config[section].get("host", DEFAULT_IP)
bind_port = config[section].get("port", DEFAULT_PORT)

contents = f"""[Unit]
# Generated by {sys.argv[0]} at {time.asctime(time.localtime())}
Description=StackStorm {ST2SVC} Socket.
PartOf={ST2SVC}.service
SourcePath={ST2CFG}

[Socket]
ListenStream={bind_address}:{bind_port}

[Install]
WantedBy=sockets.target
"""

with open(f"{NORMAL_DIR}/{ST2SVC}.socket", "w") as f:
f.write(contents)

LOG.info(f"{ST2SVC} generated.")
56 changes: 56 additions & 0 deletions packaging/common/systemd/st2stream-generator
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env python3
import configparser
import logging
import time
import sys

ST2SVC="st2stream"
DEFAULT_IP="127.0.0.1"
DEFAULT_PORT="9102"
ST2CFG = "/etc/st2/st2.conf"

# Systemd passes 3 paths to a generator, normal_dir, early_dir, late_dir.
default_paths = ["/tmp", "/tmp", "/tmp"]
for i, p in enumerate(sys.argv[1:]):
default_paths[i] = p
EARLY_DIR, NORMAL_DIR, LATE_DIR = default_paths

LOG_TO_DISK = True
LOG_KW = {
"level": logging.DEBUG,
"format": "%(asctime)s - %(levelname)s - %(message)s",
}
if LOG_TO_DISK:
LOG_KW["filename"] = f"{NORMAL_DIR}/{ST2SVC}_generator.log"

logging.basicConfig(**LOG_KW)
LOG = logging.getLogger()

LOG.debug(
f"Systemd directories: Early='{EARLY_DIR}' Normal='{NORMAL_DIR}' Late='{LATE_DIR}'"
)

config = configparser.ConfigParser(strict=False)
config.read(ST2CFG)

section = ST2SVC[3:]
bind_address = config[section].get("host", DEFAULT_IP)
bind_port = config[section].get("port", DEFAULT_PORT)

contents = f"""[Unit]
# Generated by {sys.argv[0]} at {time.asctime(time.localtime())}
Description=StackStorm {ST2SVC} Socket.
PartOf={ST2SVC}.service
SourcePath={ST2CFG}

[Socket]
ListenStream={bind_address}:{bind_port}

[Install]
WantedBy=sockets.target
"""

with open(f"{NORMAL_DIR}/{ST2SVC}.socket", "w") as f:
f.write(contents)

LOG.info(f"{ST2SVC} generated.")
14 changes: 14 additions & 0 deletions packaging/deb/systemd/st2actionrunner.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=StackStorm service st2actionrunner
After=network.target

[Service]
Type=oneshot
EnvironmentFile=-/etc/default/st2actionrunner
ExecStart=/bin/bash /opt/stackstorm/st2/bin/runners.sh start
ExecStop=/bin/bash /opt/stackstorm/st2/bin/runners.sh stop
PrivateTmp=true
RemainAfterExit=true

[Install]
WantedBy=multi-user.target
21 changes: 21 additions & 0 deletions packaging/deb/systemd/st2actionrunner@.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[Unit]
Description=StackStorm service st2actionrunner
After=network.target
JoinsNamespaceOf=st2actionrunner.service

[Service]
Type=simple
User=root
Group=st2packs
UMask=002
Environment="DAEMON_ARGS=--config-file /etc/st2/st2.conf"
Environment="WORKERID=%i"
EnvironmentFile=-/etc/default/st2actionrunner
ExecStart=/opt/stackstorm/st2/bin/st2actionrunner $DAEMON_ARGS
TimeoutSec=60
PrivateTmp=true
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
19 changes: 19 additions & 0 deletions packaging/deb/systemd/st2api.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[Unit]
Description=StackStorm service st2api
After=network.target st2api.socket
Requires=st2api.socket

[Service]
Type=simple
User=st2
Group=st2
Environment="DAEMON_ARGS=-k eventlet -b 127.0.0.1:9101 --workers 1 --threads 1 --graceful-timeout 10 --timeout 30 --log-config /etc/st2/logging.api.gunicorn.conf --error-logfile /var/log/st2/st2api.log"
EnvironmentFile=-/etc/default/st2api
ExecStart=/opt/stackstorm/st2/bin/gunicorn st2api.wsgi:application $DAEMON_ARGS
TimeoutSec=60
PrivateTmp=true
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
19 changes: 19 additions & 0 deletions packaging/deb/systemd/st2auth.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[Unit]
Description=StackStorm service st2auth
After=network.target st2auth.socket
Requires=st2auth.socket

[Service]
Type=simple
User=st2
Group=st2
Environment="DAEMON_ARGS=-k eventlet -b 127.0.0.1:9100 --workers 1 --threads 1 --graceful-timeout 10 --timeout 30 --log-config /etc/st2/logging.auth.gunicorn.conf --error-logfile /var/log/st2/st2auth.log"
EnvironmentFile=-/etc/default/st2auth
ExecStart=/opt/stackstorm/st2/bin/gunicorn st2auth.wsgi:application $DAEMON_ARGS
TimeoutSec=60
PrivateTmp=true
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
18 changes: 18 additions & 0 deletions packaging/deb/systemd/st2garbagecollector.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[Unit]
Description=StackStorm service st2garbagecollector
After=network.target

[Service]
Type=simple
User=st2
Group=st2
Environment="DAEMON_ARGS=--config-file /etc/st2/st2.conf"
EnvironmentFile=-/etc/default/st2garbagecollector
ExecStart=/opt/stackstorm/st2/bin/st2garbagecollector $DAEMON_ARGS
TimeoutSec=60
PrivateTmp=true
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
18 changes: 18 additions & 0 deletions packaging/deb/systemd/st2notifier.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[Unit]
Description=StackStorm service st2notifier
After=network.target

[Service]
Type=simple
User=st2
Group=st2
Environment="DAEMON_ARGS=--config-file /etc/st2/st2.conf"
EnvironmentFile=-/etc/default/st2notifier
ExecStart=/opt/stackstorm/st2/bin/st2notifier $DAEMON_ARGS
TimeoutSec=60
PrivateTmp=true
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
18 changes: 18 additions & 0 deletions packaging/deb/systemd/st2rulesengine.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[Unit]
Description=StackStorm service st2rulesengine
After=network.target

[Service]
Type=simple
User=st2
Group=st2
Environment="DAEMON_ARGS=--config-file /etc/st2/st2.conf"
EnvironmentFile=-/etc/default/st2rulesengine
ExecStart=/opt/stackstorm/st2/bin/st2rulesengine $DAEMON_ARGS
TimeoutSec=60
PrivateTmp=true
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
18 changes: 18 additions & 0 deletions packaging/deb/systemd/st2scheduler.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[Unit]
Description=StackStorm service st2scheduler
After=network.target

[Service]
Type=simple
User=st2
Group=st2
Environment="DAEMON_ARGS=--config-file /etc/st2/st2.conf"
EnvironmentFile=-/etc/default/st2scheduler
ExecStart=/opt/stackstorm/st2/bin/st2scheduler $DAEMON_ARGS
TimeoutSec=60
PrivateTmp=true
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
18 changes: 18 additions & 0 deletions packaging/deb/systemd/st2sensorcontainer.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[Unit]
Description=StackStorm service st2sensorcontainer
After=network.target

[Service]
Type=simple
User=st2
Group=st2
Environment="DAEMON_ARGS=--config-file /etc/st2/st2.conf"
EnvironmentFile=-/etc/default/st2sensorcontainer
ExecStart=/opt/stackstorm/st2/bin/st2sensorcontainer $DAEMON_ARGS
TimeoutSec=60
PrivateTmp=true
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
19 changes: 19 additions & 0 deletions packaging/deb/systemd/st2stream.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[Unit]
Description=StackStorm service st2stream
After=network.target st2stream.socket
Requires=st2stream.socket

[Service]
Type=simple
User=st2
Group=st2
Environment="DAEMON_ARGS=-k eventlet -b 127.0.0.1:9102 --workers 1 --threads 10 --graceful-timeout 10 --timeout 30 --log-config /etc/st2/logging.stream.gunicorn.conf --error-logfile /var/log/st2/st2stream.log"
EnvironmentFile=-/etc/default/st2stream
ExecStart=/opt/stackstorm/st2/bin/gunicorn st2stream.wsgi:application $DAEMON_ARGS
TimeoutSec=60
PrivateTmp=true
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
18 changes: 18 additions & 0 deletions packaging/deb/systemd/st2timersengine.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[Unit]
Description=StackStorm service st2timersengine
After=network.target

[Service]
Type=simple
User=st2
Group=st2
Environment="DAEMON_ARGS=--config-file /etc/st2/st2.conf"
EnvironmentFile=-/etc/default/st2timersengine
ExecStart=/opt/stackstorm/st2/bin/st2timersengine $DAEMON_ARGS
TimeoutSec=60
PrivateTmp=true
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
Loading
Loading