-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (66 loc) · 2.36 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
UID := $(shell id -u)
export UID
.PHONY: help
help: ## Show this message
@echo "usage:" >&2
@grep -h "[#]# " $(MAKEFILE_LIST) | \
sed 's/^/ make /' | \
sed 's/:[^#]*[#]# /|/' | \
column -t -s'|' >&2
.PHONY: docker
docker: ## Run shell with source code and deps inside Docker
scripts/docker-compose.bash build web-dev
scripts/docker-compose.bash run --service-ports web-dev || true
scripts/docker-compose.bash down
.PHONY: down
down: ## Download responses from Google Sheets to local JSON
./sheets.py download
.PHONY: up
up: ## Upload responses from local JSON back to Google Sheets
./sheets.py upload
.PHONY: build-prod
build-prod: ## Build static files for production
yarn parcel build --no-cache static/*.html
.PHONY: build-dev
build-dev: ## Build static files for development, and watch for changes
yarn parcel watch --hmr-port $${HMR_PORT:-8081} static/*.html
.PHONY: app-prod
app-prod: ## Start webserver for production
LAM_AUTOFETCH_ENABLED=1 \
gunicorn --workers 1 --threads 1 \
--bind $${HOST:-127.0.0.1}:$${PORT:-8080} app:app
.PHONY: app-dev
app-dev: ## Start webserver in admin mode, with live-reload
LAM_ADMIN_ENABLED=1 watchexec -r -e py \
"flask run --host $${HOST:-127.0.0.1} --port $${PORT:-8080}"
.PHONY: image
image: ## Build Docker image for deployment
scripts/docker-compose.bash build web-prod
.PHONY: image-run
image-run: image ## Build and run Docker image for deployment
scripts/docker-compose.bash down
LAM_OAUTH_PRIVATE_KEY="$$(< .oauth-private-key.json)" \
scripts/docker-compose.bash run --service-ports \
-e LAM_OAUTH_PRIVATE_KEY \
-e MESSENGER_PAGE_KEY -e MESSENGER_USER_ID web-prod \
poetry run make app-prod || true
scripts/docker-compose.bash down
.PHONY: deploy
deploy: image ## Deploy webapp to Heroku
scripts/docker.bash tag life-after-mudd \
registry.heroku.com/life-after-mudd/web
heroku auth:token | scripts/docker.bash login \
--username=_ --password-stdin registry.heroku.com
scripts/docker.bash push registry.heroku.com/life-after-mudd/web
heroku container:release web -a life-after-mudd
.PHONY: flush
flush: ## Delete contents of Redis
scripts/docker-compose.bash exec redis redis-cli FLUSHALL
.PHONY: sandwich
sandwich: ## https://xkcd.com/149/
@if bash -c '[ "$${EUID}" != 0 ]'; then \
echo "What? Make it yourself." >&2; \
exit 1; \
else \
echo "Okay." >&2; \
fi