diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e31208fb48..2c12d95fc2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -79,7 +79,7 @@ Added to pants' use of PEX lockfiles. This is not a user-facing addition. #6118 #6141 #6133 #6120 #6181 #6183 #6200 #6237 #6229 #6240 #6241 #6244 #6251 #6253 #6254 #6258 #6259 #6260 #6269 #6275 #6279 #6278 #6282 #6283 #6273 #6287 #6306 #6307 - #6311 #6314 #6315 #6317 #6319 #6312 #6320 #6321 #6323 #6324 #6325 + #6311 #6314 #6315 #6317 #6319 #6312 #6320 #6321 #6323 #6324 #6325 #6326 Contributed by @cognifloyd * Build of ST2 EL9 packages #6153 Contributed by @amanda11 diff --git a/packaging/BUILD b/packaging/BUILD index a9b72c147e..313d5b3ac6 100644 --- a/packaging/BUILD +++ b/packaging/BUILD @@ -34,6 +34,8 @@ nfpm_deb_package( name="st2.deb", dependencies=[ "./deb/scripts", + "./deb/systemd:services", + "./common/systemd:generators", ], scripts=dict( preinstall="deb/scripts/pre-install.sh", @@ -62,6 +64,8 @@ nfpm_rpm_package( name="st2.rpm", dependencies=[ "./rpm/scripts", + "./rpm/systemd:services", + "./common/systemd:generators", ], scripts=dict( preinstall="rpm/scripts/pre-install.sh", diff --git a/packaging/common/systemd/BUILD b/packaging/common/systemd/BUILD new file mode 100644 index 0000000000..946aac96b0 --- /dev/null +++ b/packaging/common/systemd/BUILD @@ -0,0 +1,20 @@ +_generators = ( + "st2api-generator", + "st2auth-generator", + "st2stream-generator", +) + +python_sources( + name="generator_files", + sources=_generators, +) + +nfpm_content_files( + name="generators", + description="systemd service generator files for nfpm packages", + dependencies=[":generator_files"], + files=[(gen, f"/usr/lib/systemd/system-generators/{gen}") for gen in _generators], + file_owner="root", + file_group="root", + file_mode="rwxr-xr-x", +) diff --git a/packaging/common/systemd/st2api-generator b/packaging/common/systemd/st2api-generator index ae6d2e7eed..81e88e2369 100755 --- a/packaging/common/systemd/st2api-generator +++ b/packaging/common/systemd/st2api-generator @@ -1,4 +1,18 @@ #!/usr/bin/env python3 +# Copyright 2021 The StackStorm Authors. +# +# 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. + import configparser import logging import time diff --git a/packaging/common/systemd/st2auth-generator b/packaging/common/systemd/st2auth-generator index f1b017e99b..6db641d611 100755 --- a/packaging/common/systemd/st2auth-generator +++ b/packaging/common/systemd/st2auth-generator @@ -1,12 +1,26 @@ #!/usr/bin/env python3 +# Copyright 2021 The StackStorm Authors. +# +# 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. + import configparser import logging import time import sys -ST2SVC="st2auth" -DEFAULT_IP="127.0.0.1" -DEFAULT_PORT="9100" +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. diff --git a/packaging/common/systemd/st2stream-generator b/packaging/common/systemd/st2stream-generator index e7d82e0f44..51494f9315 100755 --- a/packaging/common/systemd/st2stream-generator +++ b/packaging/common/systemd/st2stream-generator @@ -1,12 +1,26 @@ #!/usr/bin/env python3 +# Copyright 2021 The StackStorm Authors. +# +# 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. + import configparser import logging import time import sys -ST2SVC="st2stream" -DEFAULT_IP="127.0.0.1" -DEFAULT_PORT="9102" +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. diff --git a/packaging/deb/systemd/BUILD b/packaging/deb/systemd/BUILD new file mode 100644 index 0000000000..620b07a635 --- /dev/null +++ b/packaging/deb/systemd/BUILD @@ -0,0 +1,29 @@ +_services = ( + "st2actionrunner.service", + "st2actionrunner@.service", + "st2api.service", + "st2auth.service", + "st2garbagecollector.service", + "st2notifier.service", + "st2rulesengine.service", + "st2scheduler.service", + "st2sensorcontainer.service", + "st2stream.service", + "st2timersengine.service", + "st2workflowengine.service", +) + +files( + name="service_files", + sources=_services, +) + +nfpm_content_files( + name="services", + description="systemd service files for nfpm deb packages", + dependencies=[":service_files"], + files=[(svc, f"/usr/lib/systemd/system/{svc}") for svc in _services], + file_owner="root", + file_group="root", + file_mode="rw-r--r--", +) diff --git a/packaging/rpm/systemd/BUILD b/packaging/rpm/systemd/BUILD new file mode 100644 index 0000000000..2b2c823f93 --- /dev/null +++ b/packaging/rpm/systemd/BUILD @@ -0,0 +1,29 @@ +_services = ( + "st2actionrunner.service", + "st2actionrunner@.service", + "st2api.service", + "st2auth.service", + "st2garbagecollector.service", + "st2notifier.service", + "st2rulesengine.service", + "st2scheduler.service", + "st2sensorcontainer.service", + "st2stream.service", + "st2timersengine.service", + "st2workflowengine.service", +) + +files( + name="service_files", + sources=_services, +) + +nfpm_content_files( + name="services", + description="systemd service files for nfpm rpm packages", + dependencies=[":service_files"], + files=[(svc, f"/usr/lib/systemd/system/{svc}") for svc in _services], + file_owner="root", + file_group="root", + file_mode="rw-r--r--", +)