Changeset - 03e06738a00c
[Not reviewed]
0 5 1
Ben Sturmfels (bsturmfels) - 5 months ago 2023-11-23 23:01:34
ben@sturm.com.au
Add conservancy-www-db.service to repository, document Systemd services
6 files changed with 55 insertions and 3 deletions:
0 comments (0 inline, 0 general)
TODO.md
Show inline comments
...
 
@@ -2,3 +2,3 @@
 

	
 
* consider running the /etc/systemd/system/conservancy-www-db.service on a timer so it doesn't require an Apache restart (and brief outage) - document this service too
 
* consider running the /etc/systemd/system/conservancy-www-db.service on a timer so it doesn't require an Apache restart (and brief outage)
 
* use `<detail>` elements for supporter page hidden sections, rather than complex jQuery - or consider Alpine.js
systemd/README.md
Show inline comments
 
Install with:
 
# SystemD services
 

	
 
## Installing
 

	
 
Install all SystemD services with:
 

	
...
 
@@ -7,4 +11,8 @@ Install with:
 
    systemctl start conservancy-www-update.timer
 
    systemctl enable conservancy-www-db.service
 

	
 

	
 
##  Website updates
 

	
 
Monitor with:
 
Monitor the website update service with:
 

	
...
 
@@ -19 +27,8 @@ Updates will fail unless `/var/www/website` has a git upstream, so set that with
 
Note that the update script does not run `migrate`.
 

	
 

	
 
## Fundraiser/sustainer database updates
 

	
 
The `conservancy-www-db.service` applies SQL updates to the website
 
database. These include the fundraising total and sustainers to be publicly
 
acknowledged.
systemd/conservancy-www-cleanup.service
Show inline comments
 
# Remove old Django login sessions.
 

	
 
[Unit]
systemd/conservancy-www-db.service
Show inline comments
 
new file 100644
 
# Update the fundraiser total/sustainer list from an SQL file on Apache restart.
 

	
 
[Unit]
 
Description=Update Conservancy website database
 
Before=apache2.service
 

	
 
[Service]
 
Type=oneshot
 
User=www-data
 
ExecStart=/usr/bin/sqlite3 -bail /var/lib/www/database/conservancy-website.sqlite3 ".timeout 30000" "BEGIN TRANSACTION;" ".read /home/debian/django-supporters-list.sql" "COMMIT;"
 

	
 
SystemCallFilter=~@clock @cpu-emulation @debug @module @mount @obsolete
 
CapabilityBoundingSet=
 
NoNewPrivileges=true
 

	
 
PrivateDevices=true
 
PrivateNetwork=true
 
PrivateTmp=true
 
PrivateUsers=false
 
ProtectControlGroups=true
 
ProtectHome=read-only
 
ProtectKernelModules=true
 
ProtectKernelTunables=true
 
ProtectSystem=strict
 
ReadWritePaths=/var/lib/www/database
 

	
 
[Install]
 
WantedBy=apache2.service
systemd/conservancy-www-update.service
Show inline comments
 
# Run the website update script (see also: conservancy-www-update.timer).
 

	
 
[Unit]
systemd/conservancy-www-update.sh
Show inline comments
...
 
@@ -2,2 +2,7 @@
 

	
 
# Pull in and apply Conservancy website updates from the git repository.
 
#
 
# This is intended to be run on a timer. Note that it does *not* restart the
 
# Django application or run the migrate and collectstatic commands.
 

	
 
set -e
0 comments (0 inline, 0 general)