diff --git a/sources/st2actions/Makefile b/sources/st2actions/Makefile index cb583dc2..5b5fefe2 100644 --- a/sources/st2actions/Makefile +++ b/sources/st2actions/Makefile @@ -10,8 +10,6 @@ ifneq (,$(wildcard /etc/debian_version)) DESTDIR ?= $(CURDIR)/debian/$(ST2_COMPONENT) else REDHAT := 1 - RPM_SPECS_DIR := $(HOME)/rpmbuild/SPECS - RPM_SOURCES_DIR := $(HOME)/rpmbuild/SOURCES endif diff --git a/sources/st2actions/rpm/st2actionrunner.service b/sources/st2actions/rpm/st2actionrunner.service new file mode 100644 index 00000000..e9028990 --- /dev/null +++ b/sources/st2actions/rpm/st2actionrunner.service @@ -0,0 +1,13 @@ +[Unit] +Description=StackStorm service st2actionrunner +After=network.target + +[Service] +Type=oneshot +EnvironmentFile=-/etc/sysconfig/st2actionrunner +ExecStart=/bin/bash /usr/share/python/st2actions/bin/runners.sh start +ExecStop=/bin/bash /usr/share/python/st2actions/bin/runners.sh start stop +RemainAfterExit=true + +[Install] +WantedBy=multi-user.target diff --git a/sources/st2actions/rpm/st2actionrunner@.service b/sources/st2actions/rpm/st2actionrunner@.service new file mode 100644 index 00000000..8410ea61 --- /dev/null +++ b/sources/st2actions/rpm/st2actionrunner@.service @@ -0,0 +1,17 @@ +[Unit] +Description=StackStorm service st2actionrunner +After=network.target + +[Service] +Type=simple +Environment="DAEMON_ARGS=--config-file /etc/st2/st2.conf" +Environment="WORKERID=%i" +EnvironmentFile=-/etc/sysconfig/st2actionrunner +ExecStart=/usr/bin/st2actionrunner $DAEMON_ARGS +TimeoutSec=60 +PrivateTmp=true +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target diff --git a/sources/st2actions/rpm/st2actions.spec b/sources/st2actions/rpm/st2actions.spec index b2a0a4ce..90e7f9c8 100644 --- a/sources/st2actions/rpm/st2actions.spec +++ b/sources/st2actions/rpm/st2actions.spec @@ -1,5 +1,53 @@ %define package st2actions -%define specs_dir /root/code/rpmspec -%define _builddir /root/code/%{package} +%define _sourcedir /root/code +%define specdir /root/code/rpmspec +%include %{specdir}/package_top.spec -%include %{specs_dir}/venv_package.spec +Summary: st2actions - StackStorm API component +Requires: st2common = %{version}-%{release} + +%include %{specdir}/package_venv.spec +%include %{specdir}/helpers.spec + +%description + + +%install + %default_install + %pip_install_venv + + # systemd service file + mkdir -p %{buildroot}%{_unitdir} + install -m0644 %{SOURCE0}/rpm/st2actionrunner.service %{buildroot}%{_unitdir}/st2actionrunner.service + install -m0644 %{SOURCE0}/rpm/st2actionrunner@.service %{buildroot}%{_unitdir}/st2actionrunner@.service + install -m0644 %{SOURCE0}/rpm/st2notifier.service %{buildroot}%{_unitdir}/st2notifier.service + install -m0644 %{SOURCE0}/rpm/st2resultstracker.service %{buildroot}%{_unitdir}/st2resultstracker.service + make post_install DESTDIR=%{?buildroot} + +%prep + rm -rf %{buildroot} + mkdir -p %{buildroot} + +%clean + rm -rf %{buildroot} + +%pre + %inst_venv_divertions + +%preun + %systemd_preun st2actionrunner + %systemd_preun st2notifier + %systemd_preun st2resultstracker + +%postun + %uninst_venv_divertions + %systemd_postun + +%files + %{_bindir}/* + %{_datadir}/python/%{name} + %config(noreplace) %{_sysconfdir}/%{name}/* + %{_unitdir}/st2actionrunner.service + %{_unitdir}/st2actionrunner@.service + %{_unitdir}/st2notifier.service + %{_unitdir}/st2resultstracker.service diff --git a/sources/st2actions/rpm/st2notifier.service b/sources/st2actions/rpm/st2notifier.service new file mode 100644 index 00000000..9787c9a2 --- /dev/null +++ b/sources/st2actions/rpm/st2notifier.service @@ -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/sysconfig/st2notifier +ExecStart=/usr/bin/st2notifier $DAEMON_ARGS +TimeoutSec=60 +PrivateTmp=true +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target diff --git a/sources/st2actions/rpm/st2resultstracker.service b/sources/st2actions/rpm/st2resultstracker.service new file mode 100644 index 00000000..978829d1 --- /dev/null +++ b/sources/st2actions/rpm/st2resultstracker.service @@ -0,0 +1,18 @@ +[Unit] +Description=StackStorm service st2resultstracker +After=network.target + +[Service] +Type=simple +User=st2 +Group=st2 +Environment="DAEMON_ARGS=--config-file /etc/st2/st2.conf" +EnvironmentFile=-/etc/sysconfig/st2resultstracker +ExecStart=/usr/bin/st2resultstracker $DAEMON_ARGS +TimeoutSec=60 +PrivateTmp=true +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target diff --git a/sources/st2actions/setup.py b/sources/st2actions/setup.py index cdedbd7b..7cd0e314 100644 --- a/sources/st2actions/setup.py +++ b/sources/st2actions/setup.py @@ -49,6 +49,7 @@ def fetch_requirements(): scripts=[ 'bin/st2actionrunner', 'bin/st2notifier', - 'bin/st2resultstracker' + 'bin/st2resultstracker', + 'bin/runners.sh' ] ) diff --git a/sources/st2api/rpm/st2api.spec b/sources/st2api/rpm/st2api.spec index 64e061d1..4bcc5261 100644 --- a/sources/st2api/rpm/st2api.spec +++ b/sources/st2api/rpm/st2api.spec @@ -18,7 +18,7 @@ Requires: st2common = %{version}-%{release} # systemd service file mkdir -p %{buildroot}%{_unitdir} - install -m0644 %{SOURCE0}/rpm/st2api.service %{buildroot}%{_unitdir}/st2api.service + install -m0644 %{SOURCE0}/rpm/%{name}.service %{buildroot}%{_unitdir}/%{name}.service make post_install DESTDIR=%{?buildroot} %prep @@ -32,7 +32,7 @@ Requires: st2common = %{version}-%{release} %inst_venv_divertions %preun - %systemd_preun st2api.service + %systemd_preun %{name} %postun %uninst_venv_divertions diff --git a/sources/st2auth/rpm/st2auth.service b/sources/st2auth/rpm/st2auth.service new file mode 100644 index 00000000..c007c4d4 --- /dev/null +++ b/sources/st2auth/rpm/st2auth.service @@ -0,0 +1,18 @@ +[Unit] +Description=StackStorm service st2auth +After=network.target + +[Service] +Type=simple +User=st2 +Group=st2 +Environment="DAEMON_ARGS=--config-file /etc/st2/st2.conf" +EnvironmentFile=/etc/sysconfig/st2notifier +ExecStart=/usr/bin/st2auth ${DAEMON_ARGS} +TimeoutSec=60 +PrivateTmp=true +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target diff --git a/sources/st2auth/rpm/st2auth.spec b/sources/st2auth/rpm/st2auth.spec index fe5da1f5..f02a9a06 100644 --- a/sources/st2auth/rpm/st2auth.spec +++ b/sources/st2auth/rpm/st2auth.spec @@ -1,5 +1,45 @@ %define package st2auth -%define specs_dir /root/code/rpmspec -%define _builddir /root/code/%{package} +%define _sourcedir /root/code +%define specdir /root/code/rpmspec +%include %{specdir}/package_top.spec -%include %{specs_dir}/venv_package.spec +Summary: St2Auth - StackStorm authentication service component +Requires: st2common = %{version}-%{release} + +%include %{specdir}/package_venv.spec +%include %{specdir}/helpers.spec + +%description + + +%install + %default_install + %pip_install_venv + + # systemd service file + mkdir -p %{buildroot}%{_unitdir} + install -m0644 %{SOURCE0}/rpm/%{name}.service %{buildroot}%{_unitdir}/%{name}.service + make post_install DESTDIR=%{?buildroot} + +%prep + rm -rf %{buildroot} + mkdir -p %{buildroot} + +%clean + rm -rf %{buildroot} + +%pre + %inst_venv_divertions + +%preun + %systemd_preun %{name} + +%postun + %uninst_venv_divertions + %systemd_postun + +%files + %{_bindir}/* + %{_datadir}/python/%{name} + %config(noreplace) %{_sysconfdir}/%{name}/* + %{_unitdir}/%{name}.service