-
Notifications
You must be signed in to change notification settings - Fork 212
/
Copy pathMakefile
128 lines (98 loc) · 3.58 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
MAKEFLAGS = --no-print-directory --always-make --silent
MAKE = make $(MAKEFLAGS)
DC = $(shell command -v docker-compose >/dev/null 2>&1 && echo "docker-compose" || echo "docker compose")
dev:
@echo "Booting up backend w/ local db..."
clojure -M:dev:run
bootstrap-oss:
clojure -X:dev:oss-bootstrap
dev-oss:
@echo "Booting up backend w/ local db..."
clojure -X:dev:oss-bootstrap
@echo "Starting server..."
clojure -M:dev:run
docker-compose:
$(DC) -f ./docker-compose-dev.yml build && $(DC) -f ./docker-compose-dev.yml up
dev-up:
@echo "Migrating dev db up to latest"
migrate -database "postgresql://localhost:5432/instant?sslmode=disable" -path resources/migrations up
dev-down:
@echo "Migrating dev db up down by 1"
migrate -database "postgresql://localhost:5432/instant?sslmode=disable" -path resources/migrations down 1
dev-storm:
@echo "Booting up dev with storm debugger..."
@echo "Usage:"
@echo " user> (require '[flow-storm.api :as fs-api])"
@echo " user> (fs-api/local-connect)"
clojure -M:dev:storm:run
test:
TEST=true clojure -M:test
eftest:
TEST=true clojure -X:test instant.test-core/eftest-main
retest:
TEST=true clojure -M:retest
deploy:
./scripts/eb_deploy.clj
manual-deploy:
./scripts/manual_deploy.sh
restart:
@echo "Restarting beanstalk..."
aws elasticbeanstalk restart-app-server --environment-name Instant-prod-env
dev-with-prod-db:
@DATABASE_URL=$$(./scripts/prod_connection_string.sh); \
echo "[IMPORTANT] Booting up backend w/ prod db..." && \
DATABASE_URL="$${DATABASE_URL}" clj -M:dev:run
prod-ssh:
./scripts/prod_ssh.sh
prod-tunnel:
./scripts/prod_tunnel.sh
prod-connect:
clj -M:repl-connect
prod-version:
@DATABASE_URL=$$(./scripts/prod_connection_string.sh); \
echo "Checking prod db version... [y/N]" && \
read ans && [ $$ans = y ] && \
migrate -database "$${DATABASE_URL}" -path resources/migrations version
prod-up:
@DATABASE_URL=$$(./scripts/prod_connection_string.sh); \
echo "[IMPORTANT] Migrating prod up to latest -- are you sure you want to do this? [y/N]" && \
read ans && [ $$ans = y ] && \
migrate -database "$${DATABASE_URL}" -path resources/migrations up
prod-down:
@DATABASE_URL=$$(./scripts/prod_connection_string.sh); \
echo "[IMPORTANT] Migrating prod db down by 1 -- are you sure you want to do this? [y/N]" && \
read ans && [ $$ans = y ] && \
migrate -database "$${DATABASE_URL}" -path resources/migrations down 1
psql:
@echo "Connecting to local db..."
psql -h localhost -d instant
prod-psql:
@DATABASE_URL=$$(./scripts/prod_connection_string.sh); \
echo "[IMPORTANT] Connecting to prod db -- are you sure you want to do this? [y/N]" && \
read ans && [ $$ans = y ] && \
psql "$${DATABASE_URL}"
psql-dump:
@DATABASE_URL=$$(./scripts/prod_connection_string.sh); \
echo "Exporting prod db..." && \
pg_dump "$${DATABASE_URL}" -f dump.sql
psql-dump-schema:
@DATABASE_URL=$$(./scripts/prod_connection_string.sh); \
echo "Exporting prod db..." && \
pg_dump "$${DATABASE_URL}" --schema-only -f dump.schema.sql
tail-web:
aws logs tail /aws/elasticbeanstalk/Instant-docker-prod-env-2/var/log/eb-docker/containers/eb-current-app/stdouterr.log --follow
MINS?=30
errors:
aws logs filter-log-events \
--log-group-name "/aws/elasticbeanstalk/Instant-docker-prod-env-2/var/log/eb-docker/containers/eb-current-app/stdouterr.log" \
--start-time $$(expr `date -v-$(MINS)M +%s` \* 1000) \
--filter-pattern "ERROR" \
--output text
tail-pg:
aws logs tail /aws/rds/cluster/instant-aurora-1/postgresql --follow
encrypt-secret-dev:
clj -X:encrypt-secret :env :dev
encrypt-secret-prod:
clj -X:encrypt-secret :env :prod
lint:
clojure -M:lint