-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
205 lines (165 loc) · 7.75 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# SPDX-FileCopyrightText: the TeamDojo authors
#
# SPDX-License-Identifier: Apache-2.0
# This Makefile contains various helper targets to do JHipster stuff
#
# This is more a collection of command documentation, so we remember the
# flags and options. It is not a build script.
#
PROJECT_DIR = $(shell pwd)
TOOLS_DIR = $(PROJECT_DIR)/tools
COMPOSE_FILES = $(PROJECT_DIR)/src/main/docker
DIAGRAMS := $(shell find $(PROJECT_DIR) -type f -name '*.puml')
IMAGES := $(addsuffix .png, $(basename $(DIAGRAMS)))
JAVA_VERSION := $(shell cut -d'=' -f 2 .sdkmanrc)
all: help
.PHONY: prerequisites
prerequisites: ## Install prerequisite npm tools.
@echo "Installing prerequisites with JHipster ..."
npm install -g [email protected]
npm install -g yo
npm install -g rimraf
# This target is ment to be run after code generation: It will re-add custom dependencies again
# to the package.json, after code generation overwrites the file.
.PHONY: npm-dependencies
npm-dependencies: ## Install all additional npm packages.
@echo "Installing additional npm packages ..."
npm install simplebar
npm install ngx-markdown
npm install moment
npm install @ibm/plex
npm install @fortawesome/fontawesome-free
.PHONY: install-java
install-java: ## Install Java with SDKMAN
source $(HOME)/.sdkman/bin/sdkman-init.sh && sdk install java $(JAVA_VERSION)
.PHONY: generate-app
generate-app: ## Generate application based on the selected options.
@echo "Generate app with JHipster..."
jhipster app --with-entities --with-generated-flag
.PHONY: generate-client-app
generate-client-app: ## Generate client application based on the selected options.
@echo "Generate client app with JHipster..."
jhipster app --skip-server --with-generated-flag
.PHONY: generate-server-app
generate-server-app: ## Generate server application based on the selected options.
@echo "Generate server app with JHipster..."
jhipster app --skip-client --with-generated-flag
.PHONY: generate-jdl
generate-jdl: ## Generate entities from the JDL file.
@echo "Generating with JHipster..."
jhipster jdl --with-generated-flag teamDojo_v2.jdl
.PHONY: generate-ci-cd
generate-ci-cd: ## Generate pipeline scripts.
jhipster ci-cd
.PHONY: deploy-kubernetes
deploy-kubernetes: ## Deploy the current application to Kubernetes.
cd deployment/K8S-generated/kustomize && jhipster kubernetes
.PHONY: deploy-kubernetes-helm
deploy-kubernetes-helm: ## Deploy the current application to Kubernetes using Helm.
cd deployment/K8S-generated/helm && jhipster kubernetes-helm
.PHONY: generate-all
generate-all: generate-app generate-jdl generate-ci-cd ## Generate everything.
.PHONY: start-keycloak
start-keycloak: ## Start the Keycloak container for authentication.
docker-compose -f $(COMPOSE_FILES)/keycloak.yml up -d
$(TOOLS_DIR)/wait-for-container.sh \
'Keycloak' \
$(COMPOSE_FILES)/keycloak.yml \
'Admin console listening on'
.PHONY: stop-keycloak
stop-keycloak: ## Stop the Keycloak container.
docker-compose -f $(COMPOSE_FILES)/keycloak.yml down || true
.PHONY: start-postgres
start-postgres: ## Start the PostgreSQL container.
docker-compose -f $(COMPOSE_FILES)/postgresql.yml up -d
.PHONY: stop-postgres
stop-postgres: ## Stop the PostgreSQL container.
docker-compose -f $(COMPOSE_FILES)/postgresql.yml down || true
.PHONY: start-registry
start-registry: start-keycloak ## Start the JHipster Registry container
docker-compose -f $(COMPOSE_FILES)/jhipster-registry.yml up -d
$(TOOLS_DIR)/wait-for-container.sh \
'JHipster Registry' \
$(COMPOSE_FILES)/jhipster-registry.yml \
"Application 'jhipster-registry' is running!"
.PHONY: stop-registry
stop-registry: ## Stop the JHipster Registry container
docker-compose -f $(COMPOSE_FILES)/jhipster-registry.yml down || true
.PHONY: start-backend
start-backend: start-keycloak ## Start the application backend in dev mode.
$(PROJECT_DIR)/gradlew -x webapp -Pdev,swagger
.PHONY: start-backend-debug
start-backend-debug: start-keycloak ## Start the application backend with java debug port enabled in dev mode.
# It is mandatory to mention the gradle task explicit here, unless the option --debug-jvm from bootRun is not recognized
# correctly by Gradle as an option of the default task (which is bootRun) and Gradle exits w/ error.
$(PROJECT_DIR)/gradlew -x webapp bootRun -Pdev,swagger --debug-jvm
.PHONY: start-frontend
start-frontend: ## Start the application frontend in dev mode.
npm install
npm start
.PHONY: start ## Start the application with all dependent containers.
start: start-keycloak start-postgres ## Start the application (backend & frontend) in production mode.
$(PROJECT_DIR)/gradlew -Pprod
.PHONY: start-debug
start-debug: start-postgres ## Start the application with java debug port enabled (backend & frontend) in production mode.
# It is mandatory to mention the gradle task explicit here, unless the option --debug-jvm from bootRun is not recognized
# correctly by Gradle as an option of the default task (which is bootRun) and Gradle exits w/ error.
$(PROJECT_DIR)/gradlew bootRun --debug-jvm -Pprod
.PHONY: stop ## Stop all dependent containers.
stop: stop-registry stop-keycloak stop-postgres ## Stop everything.
.PHONY: build-prod-jar ## Build the productive fat jar.
build-prod-jar: ## Generates production bootable jar in build/libs/."
$(PROJECT_DIR)/gradlew -Pprod clean bootJar
.PHONY: sonar
sonar: ## Run Sonarqube analysis.
# Copy _secrets to .secrets and add the password of your local SonarQube.
$(PROJECT_DIR)/gradlew -Pprod clean check jacocoTestReport sonarqube \
-Dsonar.host.url=http://localhost:9001 \
-Dsonar.login=admin \
-Dsonar.password=$(SONAR_PASSWORD) \
.PHONY: start-local-sonar
start-local-sonar: ## Start local dev Sonarqube server.
# https://www.jhipster.tech/code-quality/
docker-compose -f $(COMPOSE_FILES)/sonar.yml up -d
.PHONY: stop-local-sonar
stop-local-sonar: ## Stop local dev Sonarqube server.
# https://www.jhipster.tech/code-quality/
docker-compose -f $(COMPOSE_FILES)/sonar.yml down
.PHONEY: test-backend
test-backend: ## Run backend tests.
npm run ci:backend:test
.PHONEY: integrationtest-backend
integrationtest-backend: ## Run backend integrationtest.
./gradlew test integrationTest -x webapp -x webapp_test -Dlogging.level.ROOT=OFF -Dlogging.level.org.zalando=OFF -Dlogging.level.tech.jhipster=OFF -Dlogging.level.com.iteratec.teamdojo=OFF -Dlogging.level.org.springframework=OFF -Dlogging.level.org.springframework.web=OFF -Dlogging.level.org.springframework.security=OFF "-Pprod"
.PHONEY: test-frontend
test-frontend: ## Run frontend tests.
npm run ci:frontend:test
.PHONEY: test
test: test-backend test-frontend ## Run all tests.
.PHONY: github-action
github-action: ## Execute the GitHub action on your local machine (requires act installed).
# https://github.com/nektos/act
act -e $(PROJECT_DIR)/.github/event_data.json
.PHONEY: clean
clean: ## Wipes all local built artifacts.
$(PROJECT_DIR)/gradlew clean
rm -rf node_modules
# These files a generated bc one can't disable resource generation for an entity,
# but we do not want to expose an endpoint for the audit logging entities. These
# files are ignored, but generated always you run jhipster generator.
rm -f \
src/main/java/com/iteratec/teamdojo/web/rest/PersistentAuditEventDataResource.java \
src/main/java/com/iteratec/teamdojo/web/rest/PersistentAuditEventResource.java \
src/test/java/com/iteratec/teamdojo/web/rest/PersistentAuditEventDataResourceIT.java \
src/test/java/com/iteratec/teamdojo/web/rest/PersistentAuditEventResourceIT.java
.PHONY: puml
puml: $(IMAGES) ## Generate PlantUML images
%.png: %.puml
plantuml -tpng $^
.PHONY: start-docs
start-docs: puml ## Start Mkdocs server locally
mkdocs serve
.PHONEY: help
help: ## Display this help screen.
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'