Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (57 loc) · 2.28 KB
/
Copy pathMakefile
File metadata and controls
69 lines (57 loc) · 2.28 KB
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
.PHONY: all clean test build-personal nginx-install nginx-reload certbot-acktng service-install renewal-hooks-install
REPO_DIR := $(shell pwd)
SERVICE ?= web-server
# The Python app listens on 8080; nginx proxies port 80/443 to it.
export ACK_WEB_PORT ?= 8080
all:
systemctl restart $(SERVICE)
test:
python3 test_integration.py
# Copy the nginx site config and reload nginx.
nginx-install:
sudo cp nginx/ackmud.conf /etc/nginx/sites-available/ackmud.conf
sudo ln -sf /etc/nginx/sites-available/ackmud.conf /etc/nginx/sites-enabled/ackmud.conf
sudo nginx -t
sudo systemctl reload nginx
# Reload nginx (e.g. after a manual cert renewal or config edit).
nginx-reload:
sudo nginx -t
sudo systemctl reload nginx
# Obtain/renew the ackmud.com certificate using the nginx-served ACME webroot.
# nginx must already be running with the ackmud.conf config before calling this.
# acktng can run this target from its own deploy to certbot independently.
certbot-acktng:
sudo certbot certonly \
--webroot \
--webroot-path /var/www/certbot \
--non-interactive \
--agree-tos \
--email "${CERTBOT_EMAIL:-admin@ackmud.com}" \
-d ackmud.com \
-d www.ackmud.com
# Install certbot post-renewal hooks so nginx reloads after every cert renewal.
renewal-hooks-install:
sudo mkdir -p /etc/letsencrypt/renewal-hooks/post
sudo cp scripts/certbot-post-renew.sh \
/etc/letsencrypt/renewal-hooks/post/ackmud-reload-nginx.sh
sudo chmod +x \
/etc/letsencrypt/renewal-hooks/post/ackmud-reload-nginx.sh
sudo cp scripts/certbot-post-renew-acktng.sh \
/etc/letsencrypt/renewal-hooks/post/acktng-restart.sh
sudo chmod +x \
/etc/letsencrypt/renewal-hooks/post/acktng-restart.sh
@echo "Renewal hooks installed. Test with: sudo certbot renew --dry-run"
# Install and enable the Python web server systemd service, then start it.
# Uses the actual repo location (REPO_DIR) so the service works regardless of
# where the repo is checked out.
service-install:
sed 's|/home/user/web|$(REPO_DIR)|g' systemd/web-server.service \
| sudo tee /etc/systemd/system/web-server.service > /dev/null
sudo systemctl daemon-reload
sudo systemctl enable web-server
sudo systemctl restart web-server
# Build the personal site React SPA. Run after any changes to personal/src/.
build-personal:
cd personal && npm run build
clean:
@: