forked from ihucos/counter.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (42 loc) · 1.81 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
alpineversion = 3.11
go = ./scripts/go
include config/makefile.env
export
.PHONY: tests
tests:
. config/test.sh && $(go) test
.PHONY: runserver
devserver:
. config/dev.sh && $(go) run .
format:
plash --from alpine:3.11 --apk npm --run 'npm i prettier --global' -- prettier --write .
$(go) fmt *.go
$(go) fmt models/*.go
logs:
ssh [email protected] cat log
build:
$(go) build -o webstats
deploy:
make build
make deploy-static
ssh [email protected] "pkill -x dtach; sleep 5; dtach -n /tmp/dtach ./scripts/prodrun"
deploy-static:
rsync static config webstats scripts [email protected]: -av
curl -X POST "https://api.cloudflare.com/client/v4/zones/$(CLOUDFLARE_ZONE1)/purge_cache" -H "Content-Type:application/json" -H "Authorization: Bearer $(CLOUDFLARE_TOKEN)" --data '{"purge_everything":true}' --fail
curl -X POST "https://api.cloudflare.com/client/v4/zones/$(CLOUDFLARE_ZONE2)/purge_cache" -H "Content-Type:application/json" -H "Authorization: Bearer $(CLOUDFLARE_TOKEN)" --data '{"purge_everything":true}' --fail
redis-server:
scp [email protected]:/var/lib/redis/dump.rdb /tmp/webstats-production.rdb
plash --from alpine:$(alpineversion) --apk redis -- redis-server --dbfilename webstats-production.rdb --dir /tmp
.PHONY: log
log:
ssh [email protected] tail log
integrations:
ssh [email protected] python3 scripts/integrations.py
#provision:
# ssh [email protected] sh -c ' \
# for i in `curl https://www.cloudflare.com/ips-v4`; do iptables -I INPUT -p tcp -m multiport --dports http,https -s $i -j ACCEPT; done \
# for i in `curl https://www.cloudflare.com/ips-v6`; do ip6tables -I INPUT -p tcp -m multiport --dports http,https -s $i -j ACCEPT; done \
# iptables -A INPUT -p tcp -m multiport --dports http,https -j DROP \
# ip6tables -A INPUT -p tcp -m multiport --dports http,https -j DROP \
# '
#