-
Notifications
You must be signed in to change notification settings - Fork 685
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Manage rq services with systemd instead of supervisor
This change makes securedrop-app-code Conflict/Replace supervisor, to ensure that supervisor is purged from the system. The rq worker and requeuing processes are now managed as systemd services, with configuration files in /lib/systemd/system. Submission hashing and deletion works as before. Requeuing a job interrupted by a reboot is less likely to work, as the worker seems to be shut down such that the running jobs are terminated and moved by rq to the failed queue. Files surviving that will be reported in the next daily check, and can be deleted with manage.py. The services now log to the systemd journal, which in our current configuration is stored only in memory, so will not survive reboots. This could be changed by creating /var/log/journal, but if we do that we'll need to audit what other systemd services are logging.
- Loading branch information
Showing
26 changed files
with
192 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
graft debian | ||
graft etc | ||
graft lib | ||
graft var | ||
prune var/www/securedrop/tests | ||
include requirements.txt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
.../ansible-base/roles/build-securedrop-app-code-deb-pkg/templates/securedrop_rqrequeue.conf
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
...sible-base/roles/build-securedrop-app-code-deb-pkg/templates/securedrop_rqrequeue.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[Unit] | ||
Description=SecureDrop rqrequeue process | ||
After=redis-server.service | ||
Wants=redis-server.service | ||
|
||
[Service] | ||
Environment=PYTHONPATH="{{ securedrop_code }}:{{ securedrop_venv_site_packages }}" | ||
ExecStart={{ securedrop_venv_bin }}/python /var/www/securedrop/scripts/rqrequeue --interval 60 | ||
PrivateDevices=yes | ||
PrivateTmp=yes | ||
ProtectSystem=full | ||
ReadOnlyDirectories=/ | ||
ReadWriteDirectories=/var/lib/securedrop | ||
Restart=always | ||
RestartSec=10s | ||
UMask=077 | ||
User=www-data | ||
WorkingDirectory={{ securedrop_code }} | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
21 changes: 21 additions & 0 deletions
21
...nsible-base/roles/build-securedrop-app-code-deb-pkg/templates/securedrop_rqworker.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[Unit] | ||
Description=SecureDrop rq worker | ||
After=redis-server.service | ||
Wants=redis-server.service | ||
|
||
[Service] | ||
Environment=PYTHONPATH="{{ securedrop_code }}:{{ securedrop_venv_site_packages }}" | ||
ExecStart={{ securedrop_venv_bin }}/rqworker | ||
PrivateDevices=yes | ||
PrivateTmp=yes | ||
ProtectSystem=full | ||
ReadOnlyDirectories=/ | ||
ReadWriteDirectories=/var/lib/securedrop | ||
Restart=always | ||
RestartSec=10s | ||
UMask=077 | ||
User=www-data | ||
WorkingDirectory={{ securedrop_code }} | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
10 changes: 0 additions & 10 deletions
10
...les/ansible-base/roles/build-securedrop-app-code-deb-pkg/templates/securedrop_worker.conf
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,13 @@ Section: web | |
Priority: optional | ||
Maintainer: SecureDrop Team <[email protected]> | ||
Homepage: https://securedrop.org | ||
Build-Depends: debhelper (>= 9), dh-python, python3-all, python3-setuptools, dh-virtualenv | ||
Build-Depends: debhelper (>= 9), dh-python, python3-all, python3-setuptools, dh-systemd, dh-virtualenv | ||
Standards-Version: 3.9.8 | ||
X-Python3-Version: >= 3.5 | ||
|
||
Package: securedrop-app-code | ||
Architecture: amd64 | ||
Conflicts: libapache2-mod-wsgi | ||
Replaces: libapache2-mod-wsgi | ||
Depends: ${dist:Depends}, ${misc:Depends}, ${python3:Depends}, apache2, apparmor-utils, coreutils, gnupg2, haveged, libapache2-mod-xsendfile, libpython3.5, paxctld, python3 (>= 3.5), python3 (<< 3.6), redis-server, securedrop-config, securedrop-keyring, sqlite3, supervisor | ||
Description: Packages the SecureDrop application code pip dependencies and apparmor profiles. This package will put the apparmor profiles in enforce mode. This package does use pip to install the pip wheelhouse | ||
Conflicts: libapache2-mod-wsgi,supervisor | ||
Replaces: libapache2-mod-wsgi,supervisor | ||
Depends: ${dist:Depends}, ${misc:Depends}, ${python3:Depends}, apache2, apparmor-utils, coreutils, gnupg2, haveged, libapache2-mod-xsendfile, libpython3.5, paxctld, python3 (>= 3.5), python3 (<< 3.6), redis-server, securedrop-config, securedrop-keyring, sqlite3 | ||
Description: SecureDrop application code, dependencies, Apache configuration, systemd services, and AppArmor profiles. This package will put the AppArmor profiles in enforce mode. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
install_files/securedrop-app-code/debian/securedrop-app-code.install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
var/www /var/ | ||
etc/apparmor.d/usr.sbin.apache2 /etc/apparmor.d | ||
etc/apparmor.d/usr.sbin.tor /etc/apparmor.d | ||
etc/supervisor/conf.d/securedrop_rqrequeue.conf /etc/supervisor/conf.d | ||
etc/supervisor/conf.d/securedrop_worker.conf /etc/supervisor/conf.d | ||
lib/systemd/system/securedrop_rqrequeue.service /lib/systemd/system | ||
lib/systemd/system/securedrop_rqworker.service /lib/systemd/system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
52 changes: 0 additions & 52 deletions
52
molecule/testinfra/staging/app-code/test_rqrequeue_conf.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.