-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (47 loc) · 1.44 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
# Fonts & colors
BOLD := $(shell tput bold)
UNDERLINE := $(shell tput smul)
BLACK := $(shell tput -Txterm setaf 0)
RED := $(shell tput -Txterm setaf 1)
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
BLUE := $(shell tput -Txterm setaf 4)
MAGENTA := $(shell tput -Txterm setaf 5)
CYAN := $(shell tput -Txterm setaf 6)
WHITE := $(shell tput -Txterm setaf 7)
.PHONY: mac-install-env
mac-install-env:
brew install elixir
mix deps.get
@cd assets && npm install
@make start-db
@make populate-db
@make stop-db
@cat ./config/.env.example >> ./config/.env
@echo ""
@echo "Success! Now you can run 'make start-server' to start the server."
@echo ""
.PHONY: populate-db
populate-db:
mix ecto.setup
# Starts db if one exists, otherwise creates a new db
# (workaround since closing the server doesn't stop the db)
.PHONY: start-db
start-db:
@docker start Haj-DB 2>/dev/null || \
docker run --rm -d -p 5432:5432 -v haj-data:/var/lib/postgresql/data --name=Haj-DB -e POSTGRES_PASSWORD=postgres postgres:12 && \
echo "${BOLD} ${GREEN}" && \
echo "Successfully started Haj-DB!" && \
echo ""
.PHONY: stop-db
stop-db:
docker stop Haj-DB
.PHONY: start-server
start-server:
@echo "${CYAN}Starting server @ https://localhost.datasektionen.se:4001...${WHITE}"
@echo ""
source config/.env && mix phx.server
.PHONY: start-dev
start-dev:
@make start-db
@make start-server