-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
76 lines (63 loc) · 1.88 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
DENO_FLAGS = --allow-write --allow-read --unstable --location http://localhost --allow-net --allow-env
.PHONY: dev
dev:
deno run $(DENO_FLAGS) ./src/dev/serve.ts
.PHONY: prod
prod:
deno run $(DENO_FLAGS) ./src/prod/serve.ts
CLIENT_ENTRY_FILE=src/twizzle.net/stream/index.html
.PHONY: dev-client
dev-client:
npx parcel $(CLIENT_ENTRY_FILE)
.PHONY: deploy
deploy: deploy-server deploy-client
.PHONY: deploy-server
deploy-server:
# This uploads everything every time.
# TODO: Figure out how to use SFTP/rsync
gcloud compute scp \
--project cubing --zone us-west2-b \
--recurse \
./Caddyfile \
./Makefile \
./src \
api-twizzle-net:~/api.twizzle.net/
make restart-prod-api-server
.PHONY: backup-server
backup-server:
gcloud compute scp \
--project cubing --zone us-west2-b \
--recurse \
api-twizzle-net:~/api.twizzle.net/ \
~/.data/api.twizzle.net/backups/
.PHONY: restart-prod-api-server
restart-prod-api-server:
gcloud compute ssh api-twizzle-net --project cubing --zone us-west2-b -- "sudo systemctl daemon-reload; sudo systemctl restart twizzle-api-server"
@sleep 1
@echo "\n\n\n\n"
curl -i https://api.twizzle.net/v0/infra/liveness_check
@echo "\n\n\n\n"
.PHONY: start-prod-server-caddy
start-prod-server-caddy:
gcloud compute ssh api-twizzle-net --project cubing --zone us-west2-b -- "cd /home/lgarron/api.twizzle.net; sudo caddy start"
CLIENT_SFTP_PATH = "towns.dreamhost.com:~/twizzle.net/stream/"
CLIENT_URL = "https://twizzle.net/stream/"
.PHONY: deploy-client
deploy-client: build-prod-client
rsync -avz \
--exclude .DS_Store \
--exclude .git \
./dist/ \
${CLIENT_SFTP_PATH}
echo "\nDone deploying. Go to ${CLIENT_URL}\n"
.PHONY: build-prod-client
build-prod-client: clean
env NODE_ENV=production \
npx parcel build \
--no-source-maps \
--no-scope-hoist \
--public-url ./ \
$(CLIENT_ENTRY_FILE)
.PHONY: clean
clean:
rm -rf .parcel-cache dist