-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
102 lines (81 loc) · 2.15 KB
/
Makefile
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
all/dev: edits push/dev remote/deploy/dev remote/logs/dev
push/dev:
git push
edits:
git add -u
git commit -m "Edits"
build/prd:
hugo
build/dev:
hugo --buildDrafts --buildFuture
run/prd:
hugo
go run grellyddotcom.go
run/dev:
hugo --buildDrafts --buildFuture
go run grellyddotcom.go
define deploy-dev
git pull origin dev -f && \
git submodule update --init --recursive && \
hugo --buildDrafts --buildFuture && \
rm -f /var/http/grellyddotcom && \
rm -rf /var/http/public && \
rm -rf /var/http/templates && \
cp -r ./public /var/http && \
CGO_ENABLED=1 go build grellyddotcom.go && \
cp grellyddotcom /var/http/ && \
cp -r ./templates /var/http/ && \
ls /var/http/ && \
go version && \
systemctl restart grellyddotcom.service && \
systemctl status grellyddotcom.service
endef
deploy/dev:
$(deploy-dev)
remote/dev:
ssh root@dev.grellyd.com
remote/deploy/dev:
ssh root@dev.grellyd.com "cd grellyddotcom && $(deploy-dev)"
define deploy-prd
git pull origin prd -f && \
git submodule update --init --recursive && \
hugo && \
rm -f /var/http/grellyddotcom && \
rm -rf /var/http/public && \
rm -rf /var/http/templates && \
cp -r ./public /var/http && \
CGO_ENABLED=1 go build grellyddotcom.go && \
cp grellyddotcom /var/http/ && \
cp -r ./templates /var/http/ && \
ls /var/http/ && \
go version && \
systemctl restart grellyddotcom.service && \
systemctl status grellyddotcom.service
endef
deploy/prd:
$(deploy-prd)
remote/prd:
ssh root@grellyd.com
remote/deploy/prd:
ssh root@grellyd.com "cd grellyddotcom && $(deploy-prd)"
define logs
journalctl -u grellyddotcom.service --no-pager -f
endef
logs:
$(logs)
remote/logs/dev:
ssh root@dev.grellyd.com "$(logs)"
remote/logs/prd:
ssh root@grellyd.com "$(logs)"
new/writing:
NAME ?= $(shell bash -c 'read -s -p "Name: " name; echo $$name'')
hugo new content writing/$(NAME)
init-server:
git clone https://github.com/grellyd/grellyddotcom
apt install make
apt install build-essential
snap install go --channel=1.21/stable --classic
snap install hugo
cp ~/grellyddotcom/systemd-ufw/grellyddotcom.service /etc/systemd/system
systemctl daemon-reload
systemctl enable grellyddotcom.service