forked from tobymao/18xx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (51 loc) · 2.03 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
.DEFAULT_GOAL := dev_up_b
CONTAINER_COMPOSE ?= $(CONTAINER_ENGINE)-compose
CONTAINER_ENGINE ?= docker
clean:
sudo rm -rfv build/ public/assets/*.js public/assets/*.js.map public/assets/*.js.gz public/assets/version.json
cleandeps:
sudo rm -rfv public/assets/deps.js
# ensure ./db/data exists and is not owned by root
data_dir:
./scripts/data_dir.sh $(CONTAINER_ENGINE)
# ensure the required environment variables exist when running with prod config
ensure_prod_env:
./scripts/ensure_prod_env.sh
# manage the override symlink
clean_link:
rm -f docker-compose.override.yml
dev_link : clean_link
ln -s docker-compose.dev.yml docker-compose.override.yml
prod_link : clean_link
ln -s docker-compose.prod.yml docker-compose.override.yml
# dev config, run locally
dev_build : dev_link data_dir
$(CONTAINER_COMPOSE) build
dev_up : dev_link data_dir
$(CONTAINER_COMPOSE) up
dev_up_b : dev_link data_dir
$(CONTAINER_COMPOSE) up --build
# prod config, run locally
prod_build : prod_link data_dir ensure_prod_env
$(CONTAINER_COMPOSE) build
prod_up : prod_link data_dir ensure_prod_env
$(CONTAINER_COMPOSE) up
prod_up_b : prod_link data_dir ensure_prod_env
$(CONTAINER_COMPOSE) up --build
prod_up_b_d : prod_link data_dir ensure_prod_env
$(CONTAINER_COMPOSE) up --build --detach
prod_rack_up_b_d : prod_link data_dir ensure_prod_env
$(CONTAINER_COMPOSE) up --build --no-deps --detach rack && \
$(CONTAINER_COMPOSE) up --build --no-deps --detach queue && \
sleep 20 && \
$(CONTAINER_COMPOSE) up --build --no-deps --detach rack_backup
# remotely deploy latest master in prod
prod_deploy : clean
$(CONTAINER_COMPOSE) run rack rake precompile && \
rsync --verbose --checksum public/pinned/*.js.gz deploy@18xx:~/18xx/public/pinned/ && \
rsync --verbose --checksum public/assets/*.js public/assets/*.js.gz public/assets/version.json deploy@18xx:~/18xx/public/assets/ && \
ssh -l deploy 18xx "source ~/.profile && cd ~/18xx/ && git pull && make prod_rack_up_b_d"
style:
$(CONTAINER_COMPOSE) exec rack rubocop -A
test:
$(CONTAINER_COMPOSE) exec rack rake