aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJason McCormick <jason@mfamily.org>2026-10-16 17:43:03 -0400
committerJason McCormick <jason@mfamily.org>2026-10-16 17:43:03 -0400
commit67383e6863fcff8b49e680b5b861b3154f8cb518 (patch)
treed5c09bf85857783eb7a50dfff6cb47e80bd88118 /Makefile
parent7edb33c87cb1d3ad3421a6fb33247dc871828d7a (diff)
prod 1
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile34
1 files changed, 21 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 411a519..436587b 100644
--- a/Makefile
+++ b/Makefile
@@ -2,9 +2,10 @@ SHELL := /bin/sh
APP_DIR := /opt/blind-uploader
SYSTEMD_UNIT := /etc/systemd/system/blind-uploader.service
-NGINX_CONFIG := /etc/nginx/conf.d/blind-uploader.conf
TARGETS_FILE := /etc/blind-uploader/allowed-uris
+UPLOAD_STATE_DIR := /var/lib/blind-uploader/uploads
DOMAIN ?= upload.example.com
+NGINX_CONFIG := /etc/nginx/sites-available/$(DOMAIN)
.PHONY: help check prerequisites install
@@ -18,24 +19,31 @@ check:
prerequisites:
@test "$$(id -u)" -eq 0 || { echo "Run installation as root: sudo make install DOMAIN=upload.example.com" >&2; exit 1; }
- @for command in python3 install systemctl nginx sed; do \
+ @for command in python3 install systemctl nginx sed id chown chmod; do \
command -v "$$command" >/dev/null 2>&1 || { echo "Required command not found: $$command" >&2; exit 1; }; \
done
+ @id -u www-data >/dev/null 2>&1 || { echo "Required service account not found: www-data" >&2; exit 1; }
install: prerequisites
- install -d -m 0755 $(APP_DIR) $(APP_DIR)/static
- install -m 0755 server.py $(APP_DIR)/server.py
- install -m 0644 README.md $(APP_DIR)/README.md
- install -m 0644 static/index.html static/styles.css static/app.js $(APP_DIR)/static/
- install -d -m 0755 $$(dirname $(TARGETS_FILE))
- @test -e $(TARGETS_FILE) || install -m 0644 allowed-uris.txt $(TARGETS_FILE)
- install -m 0644 deploy/blind-uploader.service $(SYSTEMD_UNIT)
- install -d -m 0755 $$(dirname $(NGINX_CONFIG))
- sed 's/upload\.example\.com/$(DOMAIN)/g' deploy/nginx-blind-uploader.conf > $(NGINX_CONFIG)
- chmod 0644 $(NGINX_CONFIG)
+ install -d -o root -g root -m 0755 $(APP_DIR) $(APP_DIR)/static
+ install -o root -g root -m 0755 server.py $(APP_DIR)/server.py
+ install -o root -g root -m 0644 README.md $(APP_DIR)/README.md
+ install -o root -g root -m 0644 static/index.html static/styles.css static/app.js $(APP_DIR)/static/
+ install -d -o root -g www-data -m 0750 $$(dirname $(TARGETS_FILE))
+ @test -e $(TARGETS_FILE) || install -o root -g www-data -m 0640 allowed-uris.txt $(TARGETS_FILE)
+ chown root:www-data $(TARGETS_FILE)
+ chmod 0640 $(TARGETS_FILE)
+ install -d -o www-data -g www-data -m 0700 /var/lib/blind-uploader $(UPLOAD_STATE_DIR)
+ install -o root -g root -m 0644 deploy/blind-uploader.service $(SYSTEMD_UNIT)
+ @if test ! -e $(NGINX_CONFIG); then \
+ sed 's/upload\.example\.com/$(DOMAIN)/g' deploy/nginx-blind-uploader.conf > $(NGINX_CONFIG); \
+ chown root:root $(NGINX_CONFIG); \
+ chmod 0644 $(NGINX_CONFIG); \
+ fi
nginx -t
systemctl daemon-reload
- systemctl enable --now blind-uploader.service
+ systemctl enable blind-uploader.service
+ systemctl restart blind-uploader.service
systemctl reload nginx
@echo "Private Drop installed for http://$(DOMAIN)"
@echo "Uploads will be stored privately under /var/lib/blind-uploader/uploads"