Skip to content

Commit

Permalink
st2actions with all system services
Browse files Browse the repository at this point in the history
  • Loading branch information
dennybaa committed Aug 25, 2015
1 parent b574093 commit abd7dde
Show file tree
Hide file tree
Showing 10 changed files with 182 additions and 11 deletions.
2 changes: 0 additions & 2 deletions sources/st2actions/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
13 changes: 13 additions & 0 deletions sources/st2actions/rpm/st2actionrunner.service
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions sources/st2actions/rpm/st2actionrunner@.service
Original file line number Diff line number Diff line change
@@ -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
54 changes: 51 additions & 3 deletions sources/st2actions/rpm/st2actions.spec
Original file line number Diff line number Diff line change
@@ -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
<insert long description, indented with spaces>

%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
18 changes: 18 additions & 0 deletions sources/st2actions/rpm/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/sysconfig/st2notifier
ExecStart=/usr/bin/st2notifier $DAEMON_ARGS
TimeoutSec=60
PrivateTmp=true
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
18 changes: 18 additions & 0 deletions sources/st2actions/rpm/st2resultstracker.service
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion sources/st2actions/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def fetch_requirements():
scripts=[
'bin/st2actionrunner',
'bin/st2notifier',
'bin/st2resultstracker'
'bin/st2resultstracker',
'bin/runners.sh'
]
)
4 changes: 2 additions & 2 deletions sources/st2api/rpm/st2api.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,7 +32,7 @@ Requires: st2common = %{version}-%{release}
%inst_venv_divertions

%preun
%systemd_preun st2api.service
%systemd_preun %{name}

%postun
%uninst_venv_divertions
Expand Down
18 changes: 18 additions & 0 deletions sources/st2auth/rpm/st2auth.service
Original file line number Diff line number Diff line change
@@ -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
46 changes: 43 additions & 3 deletions sources/st2auth/rpm/st2auth.spec
Original file line number Diff line number Diff line change
@@ -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
<insert long description, indented with spaces>

%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

0 comments on commit abd7dde

Please sign in to comment.