-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
97 lines (75 loc) · 2.43 KB
/
Makefile
File metadata and controls
97 lines (75 loc) · 2.43 KB
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
# Grab, read & set any environment variables in optional .env file
ifneq (,$(wildcard ./.env))
include .env
VARS = $(shell sed -ne 's/ *\#.*$$//; /./ s/=.*$$// p' .env )
endif
$(foreach v,$(VARS),$(eval $(shell echo export $(v)="$($(v))")))
# scripts to verify local dev is ready
# if something fails, then install it
init.prereqs:
@which docker > /dev/null || (echo "Please install docker" && exit 1)
@which docker-compose > /dev/null || (echo "Please install docker-compose" && exit 1)
@which node > /dev/null || (echo "Please install node" && exit 1)
@which yarn || (echo "Please install yarn" && exit 1)
@[ -f .env.local ] || echo "" > .env.local
# scripts to initialize the project
init.install: init.prereqs
@yarn
# scripts to remove installed artifacts
init.uninstall:
@rm -rf node_modules
# get yo shiz running
init: init.prereqs init.install
#
# intialize infra needed to develop
docker.infra.up:
@docker-compose up -d postgres
# stop the infra
docker.infra.down:
@docker-compose rm -f -s postgres
# stop the infra
docker.infra.logs:
@docker-compose logs -f postgres
docker.infra: docker.infra.down docker.infra.up
# build / rebuild the docker images
# should be ran after code changes
docker.web.build:
@docker-compose build web
# start the web server
docker.web.up:
@DATABASE_URL="postgresql://user:password@pg:5432/sidegig?schema=public" \
JWT_SECRET="this_a_secret_dont_use_in_rl" \
docker-compose up -d web
# end the web server
docker.web.down:
@docker-compose rm -f -s web
# logs for web
docker.web.logs:
@docker-compose logs -f web
# do all docker web things
docker.web: docker.web.build docker.web.down docker.web.up docker.web.logs
# make up all docker elements
docker.up: docker.infra.up docker.web.up
@echo "All up"
# make down all docker elements
docker.down: docker.infra.down docker.web.down
@echo "All down"
# follow all docker logs
docker.logs:
@docker-compose logs -f
# local development -- web
local.web.dev: docker.web.down
@DATABASE_URL="postgresql://user:password@localhost:5432/sidegig?schema=public" \
yarn dev
# codegen
local.web.codegen:
@yarn codegen
# shortcut to running in dev mode
local.web: local.web.codegen local.web.dev
# local migrations
local.migrations.stage:
@DATABASE_URL="postgresql://user:password@localhost:5432/sidegig?schema=public" \
yarn migrations.stage
local.migrations.commit:
@DATABASE_URL="postgresql://user:password@localhost:5432/sidegig?schema=public" \
yarn migrations.commit