-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
148 lines (111 loc) · 3.8 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
_COLOR := $(shell echo "\\033[38;5;69m")
_RESET := $(shell echo "\\033[0m")
ifneq '$(shell command -v podman 2>&1 >/dev/null; echo $?)' '0'
CONTAINER_CMD := podman
CONTAINER_PREFIX := vdi_
CONTAINER_SUFFIX := _1
MERGED_COMPOSE_FILES := /tmp/$(shell basename $(shell pwd))-merged-compose.yml
MERGE_TARGET := __MERGE_COMPOSE
else
CONTAINER_CMD := docker
# FIXME: Incorrect prefix for docker compose
# This was based on the directory name, but with a name now defined in the
# compose files, it will likely change. Either set it based on the current
# directory name (if that's what docker compose does) or use the name from the
# compose.dev file.
CONTAINER_PREFIX := vdi-service-
CONTAINER_SUFFIX := -1
MERGED_COMPOSE_FILES := docker-compose.yml docker-compose.dev.yml docker-compose.ssh.yml
MERGE_TARGET :=
endif
MERGED_COMPOSE_FLAGS := $(foreach file,$(MERGED_COMPOSE_FILES),-f $(file))
.PHONY: default
default:
@echo "Please pick a make target."
####
## Component Building
####
.PHONY: build
build:
@$(CONTAINER_CMD) compose \
-f docker-compose.local.yml \
-f docker-compose.dev.yml \
build \
--build-arg=GITHUB_USERNAME=${GITHUB_USERNAME} \
--build-arg=GITHUB_TOKEN=${GITHUB_TOKEN}
.PHONY: raml-gen
raml-gen:
@which node || (echo 'NodeJS not found on $$PATH'; exit 1)
@./gradlew -q :service:rest-service:generate-jaxrs --rerun-tasks
@./gradlew -q generate-raml-docs --rerun-tasks
####
## Stack Management
####
.PHONY: config
config: env-file-test $(MERGE_TARGET)
@$(CONTAINER_CMD) compose $(MERGED_COMPOSE_FLAGS) config
.PHONY: up
up: env-file-test $(MERGE_TARGET)
@if [ -z "${SSH_AUTH_SOCK}" ]; then echo "SSH agent does not appear to be correctly running"; exit 1; fi
@$(CONTAINER_CMD) compose $(MERGED_COMPOSE_FLAGS) up -d
.PHONY: down
down: env-file-test $(MERGE_TARGET)
@$(CONTAINER_CMD) compose $(MERGED_COMPOSE_FLAGS) down -v
.PHONY: start
start: env-file-test $(MERGE_TARGET)
@if [ -z "${SSH_AUTH_SOCK}" ]; then echo "SSH agent does not appear to be correctly running"; exit 1; fi
@$(CONTAINER_CMD) compose $(MERGED_COMPOSE_FLAGS) start
.PHONY: stop
stop: env-file-test $(MERGE_TARGET)
@$(CONTAINER_CMD) compose $(MERGED_COMPOSE_FLAGS) stop
.PHONY: __MERGE_COMPOSE
__MERGE_COMPOSE:
@vpdb merge-compose -f docker-compose.yml -f docker-compose.dev.yml -f docker-compose.ssh.yml > $(MERGED_COMPOSE_FILES)
####
## Logging
####
.PHONY: log-service
log-service:
@$(CONTAINER_CMD) logs -f $(CONTAINER_PREFIX)service$(CONTAINER_SUFFIX)
.PHONY: log-plugin-noop
log-plugin-noop:
@$(CONTAINER_CMD) logs -f $(CONTAINER_PREFIX)plugin-example$(CONTAINER_SUFFIX)
.PHONY: log-plugin-genelist
log-plugin-genelist:
@$(CONTAINER_CMD) logs -f $(CONTAINER_PREFIX)plugin-genelist$(CONTAINER_SUFFIX)
.PHONY: log-plugin-rnaseq
log-plugin-rnaseq:
@$(CONTAINER_CMD) logs -f $(CONTAINER_PREFIX)plugin-rnaseq$(CONTAINER_SUFFIX)
.PHONY: log-plugin-isasimple
log-plugin-isasimple:
@$(CONTAINER_CMD) logs -f $(CONTAINER_PREFIX)plugin-isasimple$(CONTAINER_SUFFIX)
.PHONY: log-plugin-biom
log-plugin-biom:
@$(CONTAINER_CMD) logs -f $(CONTAINER_PREFIX)plugin-biom$(CONTAINER_SUFFIX)
.PHONY: log-plugin-bigwig
log-plugin-bigwig:
@$(CONTAINER_CMD) logs -f $(CONTAINER_PREFIX)plugin-bigwig$(CONTAINER_SUFFIX)
.PHONY: log-kafka
log-kafka:
@$(CONTAINER_CMD) logs -f $(CONTAINER_PREFIX)kafka$(CONTAINER_SUFFIX)
.PHONY: log-minio
log-minio:
@$(CONTAINER_CMD) logs -f $(PROJECT_PREFIX)minio-external$(CONTAINER_SUFFIX)
.PHONY: log-rabbit
log-rabbit:
@$(CONTAINER_CMD) logs -f $(PROJECT_PREFIX)rabbit-external$(CONTAINER_SUFFIX)
####
## Console Shortcuts
####
.PHONY: open-minio
open-minio:
@sensible-browser http://localhost:9001
.PHONY: open-rabbit
open-rabbit:
@sensible-browser http://localhost:9002
####
## Helpers
####
.PHONY: env-file-test
env-file-test:
@if [ ! -f .env ]; then echo "Missing .env file."; exit 1; fi