-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathdocket.spec
226 lines (182 loc) · 8.34 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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
%global _docketdir /opt/rocknsm/docket
%if 0%{?epel}
%define scl rh-nodejs8
%define scl_prefix rh-nodejs8-
%endif
Name: docket
Version: 1.0.3
Release: 1
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
BuildRequires: %{?scl_prefix}npm
Requires(pre): shadow-utils
Requires: python2-flask
Requires: python2-flask-restful
Requires: python2-celery
Requires: python-redis
Requires: python-requests
Requires: python2-tonyg-rfc3339
Requires: uwsgi
Requires: uwsgi-plugin-python2
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
cd frontend
%{?scl:scl enable %{scl} "}
# Build ReactJS frontend
npm install
npm run build
%{?scl: "}
%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}/%{_docketdir}/frontend
mkdir -p %{buildroot}/%{_tmpfilesdir}
mkdir -p %{buildroot}/%{_unitdir}
mkdir -p %{buildroot}/%{_presetdir}
mkdir -p %{buildroot}/%{_localstatedir}/log/%{name}
# 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-query.service %{buildroot}%{_unitdir}/
install -p -m 644 systemd/docket-celery-io.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 frontend
cp -a frontend/dist/. %{buildroot}/%{_docketdir}/frontend/.
install -d -m 0755 %{buildroot}/run/%{name}/
install -d -m 0755 %{buildroot}%{_localstatedir}/spool/%{name}/
touch %{buildroot}/run/%{name}/%{name}.socket
touch %{buildroot}/%{_localstatedir}/log/%{name}/%{name}.log
%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-query.service docket-celery-io.service
%preun
%systemd_preun docket.socket docket.service docket-celery-query.service docket-celery-io.service
%postun
%systemd_postun_with_restart docket.socket docket.service docket-celery-query.service docket-celery-io.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}/
%dir %{_localstatedir}/log/%{name}/
%attr(-,docket,docket) %{_localstatedir}/log/%{name}/
# Add the systemd socket so it's removed on uninstall
%ghost /run/%{name}/%{name}.socket
%ghost %{_localstatedir}/log/%{name}/%{name}.log
%doc README.md LICENSE.txt docs/
%doc contrib/nginx-example.conf
%doc contrib/docket_lighttpd_scgi.conf
%doc contrib/docket_lighttpd_vhost.conf
%changelog
* Thu Feb 21 2019 Derek Ditch <[email protected]> 1.0.3-1
- Fix issue where redirect goes to wrong root. ([email protected])
* Thu Feb 21 2019 Derek Ditch <[email protected]> 1.0.2-1
- Fixed bug preventing usage of URI api when webroot was changed
* Fri Sep 14 2018 Derek Ditch <[email protected]> 1.0.1-4
- Bumped uwsgi-plugin-python depedency to match upstream pkg as uwsgi-plugin-python2
* Fri Feb 23 2018 Derek Ditch <[email protected]> 1.0.1-3
- Fixed LICENSE in spec file ([email protected])
- Allows for easy push directly to Copr :magic: ([email protected])
* Fri Feb 23 2018 Derek Ditch <[email protected]> 1.0.1-2
- Fixed typo in the log path ([email protected])
* Fri Feb 23 2018 Derek Ditch <[email protected]> 1.0.0-1
- Better concurrency & new UI (#22)
- Update docket configuration path (#17) ([email protected])
- Checked in Vagrantfile for testing ([email protected])
- Lots of bugs squashed. Probably more introduced. ¯\_(ツ)_/¯
* Mon Jan 08 2018 Jeffrey Kwasha <[email protected]> 0.2.1-1
- Requests are queued to improve stenographer performance and squash docket CPU spikes
- Queries now return JSON: query, id, url where the capture will be created, queue time.
- Parallelized queries to stenographer instances
- New API: /urls - a JSON dictionary of id : url for all available captures
- New API: /ids - a JSON list of ids for active and completed queries
- New API: /status - JSON: the state of active and completed queries
- New API: /cleanup - ignores CLEANUP_PERIOD and runs immediately
- New GUI: /gui - an HTML form with a dynamic stack of queries made with links
- More helpful error messages and better 'front-end' request validation.
- improved cleanup - query expiration is configurable by time, free space, frequency
- improved logging and error handling
- config options now understand 'capacity' ('2MB') and 'duration' ('30s') depending on the option
- Result captures are served directly by nginx
* 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