-
-
Notifications
You must be signed in to change notification settings - Fork 751
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into packaging-runners.sh
- Loading branch information
Showing
28 changed files
with
607 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.