Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ Changed
- redis v8.6
Contributed by @nzlosh

* Added systemd generators for st2auth, st2api, st2stream service unit files.
Contributed by @nzlosh #762

Removed
~~~~~~~

* Removed focal and rocky8
Contributed by @nzlosh
Contributed by @nzlosh + @skiedude #761


v3.9
Expand Down
3 changes: 0 additions & 3 deletions packages/st2/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ override_dh_gencontrol:
override_dh_installinit:
dh_systemd_enable --name=st2actionrunner st2actionrunner.service
install -Dp -m644 debian/st2actionrunner@.service debian/st2/lib/systemd/system/st2actionrunner@.service
dh_systemd_enable --name=st2api st2api.service
dh_systemd_enable --name=st2stream st2stream.service
dh_systemd_enable --name=st2auth st2auth.service
dh_systemd_enable --name=st2notifier st2notifier.service
dh_systemd_enable --name=st2rulesengine st2rulesengine.service
dh_systemd_enable --name=st2sensorcontainer st2sensorcontainer.service
Expand Down
37 changes: 33 additions & 4 deletions packages/st2/debian/st2api-generator
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import logging
import time
import sys

ISO8601 = "%Y-%m-%dT%H:%M:%S%z"
EXEC_TIME = time.localtime()

ST2SVC = "st2api"
DEFAULT_IP = "127.0.0.1"
DEFAULT_PORT = "9101"
Expand Down Expand Up @@ -37,8 +40,33 @@ 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())}
# Default to gevent if the configuration is unset as this will be the correct option from v3.10+.
concurrency_library = config["system"].get("concurrency_library", "gevent")

service_contents = f"""[Unit]
# Generated by {sys.argv[0]} at {time.strftime(ISO8601, EXEC_TIME)}
Description=StackStorm service st2api
After=network.target st2api.socket
Requires=st2api.socket

[Service]
Type=simple
User=st2
Group=st2
Environment="DAEMON_ARGS=-k {concurrency_library} -b {bind_address}:{bind_port} --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
"""

socket_contents = f"""[Unit]
# Generated by {sys.argv[0]} at {time.strftime(ISO8601, EXEC_TIME)}
Description=StackStorm {ST2SVC} Socket.
PartOf={ST2SVC}.service
SourcePath={ST2CFG}
Expand All @@ -50,7 +78,8 @@ ListenStream={bind_address}:{bind_port}
WantedBy=sockets.target
"""

with open(f"{NORMAL_DIR}/{ST2SVC}.socket", "w") as f:
f.write(contents)
for ext, contents in (("socket", socket_contents), ("service", service_contents)):
with open(f"{NORMAL_DIR}/{ST2SVC}.{ext}", "w") as f:
f.write(contents)

LOG.info(f"{ST2SVC} generated.")
19 changes: 0 additions & 19 deletions packages/st2/debian/st2api.service

This file was deleted.

37 changes: 33 additions & 4 deletions packages/st2/debian/st2auth-generator
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import logging
import time
import sys

ISO8601 = "%Y-%m-%dT%H:%M:%S%z"
EXEC_TIME = time.localtime()

ST2SVC="st2auth"
DEFAULT_IP="127.0.0.1"
DEFAULT_PORT="9100"
Expand Down Expand Up @@ -37,8 +40,11 @@ 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())}
# Default to gevent if the configuration is unset as this will be the correct option from v3.10+.
concurrency_library = config["system"].get("concurrency_library", "gevent")

socket_contents = f"""[Unit]
# Generated by {sys.argv[0]} at {time.strftime(ISO8601, EXEC_TIME)}
Description=StackStorm {ST2SVC} Socket.
PartOf={ST2SVC}.service
SourcePath={ST2CFG}
Expand All @@ -50,7 +56,30 @@ ListenStream={bind_address}:{bind_port}
WantedBy=sockets.target
"""

with open(f"{NORMAL_DIR}/{ST2SVC}.socket", "w") as f:
f.write(contents)
service_contents = f"""[Unit]
# Generated by {sys.argv[0]} at {time.strftime(ISO8601, EXEC_TIME)}
Description=StackStorm service st2auth
After=network.target st2auth.socket
Requires=st2auth.socket

[Service]
Type=simple
User=st2
Group=st2
Environment="DAEMON_ARGS=-k {concurrency_library} -b {bind_address}:{bind_port} --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
"""

for ext, contents in (("socket", socket_contents), ("service", service_contents)):
with open(f"{NORMAL_DIR}/{ST2SVC}.{ext}", "w") as f:
f.write(contents)

LOG.info(f"{ST2SVC} generated.")
19 changes: 0 additions & 19 deletions packages/st2/debian/st2auth.service

This file was deleted.

36 changes: 32 additions & 4 deletions packages/st2/debian/st2stream-generator
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import logging
import time
import sys

ISO8601 = "%Y-%m-%dT%H:%M:%S%z"
EXEC_TIME = time.localtime()

ST2SVC="st2stream"
DEFAULT_IP="127.0.0.1"
DEFAULT_PORT="9102"
Expand Down Expand Up @@ -37,8 +40,32 @@ 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())}
concurrency_library = config["system"].get("concurrency_library", "gevent")

service_contents = f"""[Unit]
# Generated by {sys.argv[0]} at {time.strftime(ISO8601, EXEC_TIME)}
Description=StackStorm service st2stream
After=network.target st2stream.socket
Requires=st2stream.socket

[Service]
Type=simple
User=st2
Group=st2
Environment="DAEMON_ARGS=-k {concurrency_library} -b {bind_address}:{bind_port} --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
"""

socket_contents = f"""[Unit]
# Generated by {sys.argv[0]} at {time.strftime(ISO8601, EXEC_TIME)}
Description=StackStorm {ST2SVC} Socket.
PartOf={ST2SVC}.service
SourcePath={ST2CFG}
Expand All @@ -50,7 +77,8 @@ ListenStream={bind_address}:{bind_port}
WantedBy=sockets.target
"""

with open(f"{NORMAL_DIR}/{ST2SVC}.socket", "w") as f:
f.write(contents)
for ext, contents in (("socket", socket_contents), ("service", service_contents)):
with open(f"{NORMAL_DIR}/{ST2SVC}.{ext}", "w") as f:
f.write(contents)

LOG.info(f"{ST2SVC} generated.")
19 changes: 0 additions & 19 deletions packages/st2/debian/st2stream.service

This file was deleted.

6 changes: 2 additions & 4 deletions packages/st2/rpm/st2.spec
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ Conflicts: st2common
%include rpm/preinst_script.spec

%post
%service_post st2actionrunner st2api st2stream st2auth st2notifier st2workflowengine
%service_post st2api st2stream st2auth
%service_post st2actionrunner st2notifier st2workflowengine
%service_post st2rulesengine st2timersengine st2sensorcontainer st2garbagecollector
%service_post st2scheduler
%include rpm/postinst_script.spec
Expand Down Expand Up @@ -122,9 +123,6 @@ Conflicts: st2common
%attr(775, root, %{packs_group}) /opt/stackstorm/virtualenvs
%{_unitdir}/st2actionrunner.service
%{_unitdir}/%{worker_name}.service
%{_unitdir}/st2api.service
%{_unitdir}/st2stream.service
%{_unitdir}/st2auth.service
%{_unitdir}/st2notifier.service
%{_unitdir}/st2rulesengine.service
%{_unitdir}/st2sensorcontainer.service
Expand Down
19 changes: 0 additions & 19 deletions packages/st2/rpm/st2api.service

This file was deleted.

19 changes: 0 additions & 19 deletions packages/st2/rpm/st2auth.service

This file was deleted.

19 changes: 0 additions & 19 deletions packages/st2/rpm/st2stream.service

This file was deleted.

Loading