forked from rocknsm/docket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docket.spec
168 lines (134 loc) · 5.73 KB
/
docket.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
%global _docketdir /opt/rocknsm/docket
Name: docket
Version: 0.1.1
Release: 1%{?dist}
Summary: A Python HTTP API for Google Stenographer
License: BSD
URL: http://rocknsm.io/
Source0: https://github.com/rocknsm/%{name}/archive/%{name}-%{version}-1.tar.gz#/%{name}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python-devel
%{?systemd_requires}
BuildRequires: systemd
Requires(pre): shadow-utils
Requires: python2-flask
Requires: python2-flask-restful
Requires: python-flask-script
Requires: python2-celery
Requires: python-redis
Requires: python-requests
Requires: python2-tonyg-rfc3339
Requires: uwsgi
Requires: uwsgi-plugin-python
Requires: wireshark
Requires: redis
%description
Docket provides an HTTP API layer for Google Stenographer, allowing RESTful API access to indexed PCAP. Docket is written in Python and uses the veritable Flask framework.
%prep
%setup -q
%build
# Nothing to do here
%install
rm -rf %{buildroot}
DESTDIR=%{buildroot}
# make directories
mkdir -p %{buildroot}/%{_sysconfdir}/{docket,sysconfig}
mkdir -p %{buildroot}/%{_docketdir}
mkdir -p %{buildroot}/%{_docketdir}/docket
mkdir -p %{buildroot}/%{_tmpfilesdir}
mkdir -p %{buildroot}/%{_unitdir}
mkdir -p %{buildroot}/%{_presetdir}
# Install docket files
cp -a docket/. %{buildroot}/%{_docketdir}/docket/.
cp -a conf/. %{buildroot}/%{_sysconfdir}/docket/.
install -p -m 644 systemd/docket.service %{buildroot}%{_unitdir}/
install -p -m 644 systemd/docket.socket %{buildroot}%{_unitdir}/
install -p -m 644 systemd/docket-celery.service %{buildroot}%{_unitdir}/
install -p -m 644 systemd/docket-tmpfiles.conf %{buildroot}%{_tmpfilesdir}/%{name}.conf
install -p -m 644 systemd/docket-uwsgi.ini %{buildroot}%{_sysconfdir}/docket/
install -p -m 644 systemd/docket.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name}
install -p -m 644 systemd/docket.preset %{buildroot}%{_presetdir}/95-%{name}.preset
install -d -m 0755 %{buildroot}/run/%{name}/
install -d -m 0755 %{buildroot}%{_localstatedir}/spool/%{name}/
touch %{buildroot}/run/%{name}/%{name}.socket
%pre
getent group %{name} >/dev/null || groupadd -r %{name}
getent passwd %{name} >/dev/null || \
useradd -r -g %{name} -d %{_docketdir} -s /sbin/nologin \
-c "System account for Docket services for ROCK NSM" %{name}
exit 0
%post
%systemd_post docket.socket docket.service docket-celery.service
%preun
%systemd_preun docket.socket docket.service docket-celery.service
%postun
%systemd_postun_with_restart docket.socket docket.service docket-celery.service
%files
%defattr(0644, root, root, 0755)
%dir %{_docketdir}
%{_docketdir}/*
# Config files
%config %{_sysconfdir}/docket/*.yaml
%config %{_sysconfdir}/docket/docket-uwsgi.ini
# Service files
%{_tmpfilesdir}/%{name}.conf
%{_unitdir}/*
%{_presetdir}/*
%{_sysconfdir}/sysconfig/%{name}
# Runtime dirs
%dir /run/%{name}/
%attr(-,docket,docket) /run/%{name}/
%dir %{_localstatedir}/spool/%{name}/
%attr(-,docket,docket) %{_localstatedir}/spool/%{name}/
# Add the systemd socket so it's removed on uninstall
%ghost /run/%{name}/%{name}.socket
%doc README.md LICENSE docs/
%doc contrib/nginx-example.conf
%doc contrib/docket_lighttpd_scgi.conf
%doc contrib/docket_lighttpd_vhost.conf
%changelog
* Fri Dec 01 2017 Derek Ditch <[email protected]> 0.1.1-1
- Fixes lingering permission issues with systemd. ([email protected])
* Wed Nov 22 2017 Derek Ditch <[email protected]> 0.1.0-1
- Ansible role under contrib/rocknsm.docket now deploys docket
- Ansible role currently supports lighttpd and configs stenographer keys
* Sun Aug 06 2017 Derek Ditch <[email protected]> 0.0.14-1
- Add docs dir to documentation ([email protected])
* Sun Aug 06 2017 Derek Ditch <[email protected]> 0.0.13-1
- Changed location of anchors to fix formatting
- Changed formating of `docs/README.md` ([email protected])
* Sun Aug 06 2017 Derek Ditch <[email protected]> 0.0.12-1
- Restructured the documentation slightly ([email protected])
- Added docs and tweaked default config ([email protected])
* Sat Aug 05 2017 Derek Ditch <[email protected]> 0.0.11-1
- Nothing to see here ([email protected])
- Added vagrant to gitignore ([email protected])
* Sat Aug 05 2017 Derek Ditch <[email protected]> 0.0.10-1
- Accidentally left blank
* Sat Aug 05 2017 Derek Ditch <[email protected]> 0.0.9-1
- Updated socket path in nginx example ([email protected])
* Sat Aug 05 2017 Derek Ditch <[email protected]> 0.0.8-1
- Adds socket to package for autoremoval ([email protected])
- Fixes several discrepancies with systemd socket activation vs uwsgi
- Some cleanup with runtime dirs ([email protected])
- Cleans up systemd service files, renames main service to `docket.service`.
* Sat Aug 05 2017 Derek Ditch <[email protected]> 0.0.7-1
- Fixes typo in logic ([email protected])
* Sat Aug 05 2017 Derek Ditch <[email protected]> 0.0.6-1
- Adds HTTP POST API supporting form-encoded and json-encoded requests
- Fixes several bugs in error handling and data parsing
* Sun Jul 30 2017 Derek Ditch <[email protected]> 0.0.5-1
- Fixes for RPM build and systemd dependencies
* Sun Jul 30 2017 Derek Ditch <[email protected]> 0.0.4-1
- Adds service depndency ([email protected])
- Adds systemd config and tweaks to RPM spec - Adds tmpfiles.d configuration
for docket spool dir - Adds service files for celery workers and uwsgi
configuration - Adds socket-activation for uwsgi workers - Adds environment
file for both systemd services `/etc/sysconfig/docket` ([email protected])
* Thu Jul 27 2017 Derek Ditch <[email protected]> 0.0.3-1
- Removed .spec from gitignore ([email protected])
* Thu Jul 27 2017 Derek Ditch <[email protected]> 0.0.2-1
- Initial use of tito to build SRPM