-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
164 lines (134 loc) · 5.41 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
###
#
# Version: 1.3.0
# Date: 2020-05-07
# Author: Yves Vindevogel (vindevoy)
#
# Features:
# - dependency for django-htmlmin
# - create sitemap.xml
#
###
# Clean is only for development. If you want to clean the logs in production for example,
# use the proper Linux tools
clean:
@find . -name '__pycache__' -type d -delete
@find . -name '*.log' -type f -delete
@rm -rf ./tmp ./log ./download
@echo '[OK] Cleaned'
download: clean
@mkdir -p ./tmp
@wget -O ./tmp/startbootstrap-blog-home.zip https://github.com/BlackrockDigital/startbootstrap-blog-home/archive/gh-pages.zip
@wget -O ./tmp/startbootstrap-blog-post.zip https://github.com/BlackrockDigital/startbootstrap-blog-post/archive/gh-pages.zip
@wget -O ./tmp/startbootstrap-shop-home.zip https://github.com/BlackrockDigital/startbootstrap-shop-homepage/archive/gh-pages.zip
@wget -O ./tmp/startbootstrap-heroic-features.zip https://github.com/BlackrockDigital/startbootstrap-heroic-features/archive/gh-pages.zip
@mkdir -p ./download
@unzip -o ./tmp/startbootstrap-blog-home.zip -d ./download
@unzip -o ./tmp/startbootstrap-blog-post.zip -d ./download
@unzip -o ./tmp/startbootstrap-shop-home.zip -d ./download
@unzip -o ./tmp/startbootstrap-heroic-features.zip -d ./download
@rm -rf ./tmp
@echo '[OK] Download done'
update:
@git pull origin
@echo '[OK] Update done'
install-certbot:
@wget https://dl.eff.org/certbot-auto -P /tmp
@mv /tmp/certbot-auto /usr/local/bin/certbot-auto
@chown root:root /usr/local/bin/certbot-auto
@chmod 755 /usr/local/bin/certbot-auto
install-certificate:
@/usr/local/bin/certbot-auto certonly --standalone
update-certificate:
@echo "0 0,12 * * * root python3 -c 'import random; import time; time.sleep(random.random() * 3600)' && /usr/local/bin/certbot-auto renew -q" | tee -a /etc/crontab > /dev/null
dependencies:
@pip3 install cherrypy
@pip3 install jinja2
@pip3 install pyyaml
@pip3 install markdown
@pip3 install django-htmlmin
@echo '[OK] Dependencies in Python installed'
readme:
@echo '# ABOUT CherryBlog' > ./README.md
@echo '' >> ./README.md
@sed -e '1,/----------/d' ./src/data/pages/about.md >> ./README.md
@echo '' >> ./README.md
@echo '# DOCUMENTATION' >> ./README.md
@echo '' >> ./README.md
@sed -e '1,/----------/d' ./src/data/pages/docs.md >> ./README.md
@echo '' >> ./README.md
@echo '# CREDITS' >> ./README.md
@echo '' >> ./README.md
@sed -e '1,/----------/d' ./src/data/pages/credits.md >> ./README.md
@echo '[OK] README.md created'
history:
@python3 ./src/application/history.py
@echo '[OK] HISTORY.md created'
@rm -f ./src/data/pages/releases.md
@echo '---' > ./src/data/pages/releases.md
@echo '' >> ./src/data/pages/releases.md
@echo 'title: "Release notes"' >> ./src/data/pages/releases.md
@echo '' >> ./src/data/pages/releases.md
@echo 'image: "blossom4.jpg"' >> ./src/data/pages/releases.md
@echo '' >> ./src/data/pages/releases.md
@echo 'author: "Yves Vindevogel"' >> ./src/data/pages/releases.md
@date +"date: \"%Y-%m-%d\"" >> ./src/data/pages/releases.md
@echo '' >> ./src/data/pages/releases.md
@echo '----------' >> ./src/data/pages/releases.md
@echo '' >> ./src/data/pages/releases.md
@cat ./HISTORY.md >> ./src/data/pages/releases.md
@echo '' >> ./src/data/pages/releases.md
@echo '[OK] history copied to pages'
sitemap:
@mkdir -p ./src/data/sitemap
@python3 ./src/application/sitemap.py
@echo '[OK] sitemap.xml created'
google: sitemap
@curl http://www.google.com/ping?sitemap=https://cherryblog.org/sitemap.xml > /dev/null
develop: sitemap
@mkdir -p ./log
@python3 ./src/application/main.py 2>&1 | tee ./log/application.log
production: sitemap
@mkdir -p /var/log/cherryblog
@python3 ./src/application/main.py --env production 2>&1 | tee /var/log/cherryblog/application.log &
stop:
@cat ./log/cherryblog.pid | xargs kill
###
#
# Version: 1.2.1
# Date: 2020-04-25
# Author: Yves Vindevogel (vindevoy)
#
# Fixes:
# - all logging is now in application.log instead of ENVIRONMENT.log (settings determine it for the run)
# - better history generation
#
# Version: 1.2.0
# Date: 2020-04-11
# Author: Yves Vindevogel (vindevoy)
#
# Features:
# - stop command
# - better history generation
#
# Version: 1.1.0
# Date: 2020-04-11
# Author: Yves Vindevogel (vindevoy)
#
# Features:
# - Add logging
#
# Version: 1.0.1
# Date: 2020-04-09
# Author: Yves Vindevogel (vindevoy)
#
# Features:
# - Cleaned some commands
#
# Version: 1.0.0
# Date: 2020-03-29
# Author: Yves Vindevogel (vindevoy)
#
# Original file
#
###