updated with required changes

This commit is contained in:
dhirsch1 2023-09-04 13:13:18 +03:00
parent 4fb6acb044
commit e0dd700744
3 changed files with 61 additions and 48 deletions

View file

@ -1,51 +1,8 @@
.SILENT: validate docker cluster prepare:
validate:
test -n "$$EMAIL" || (echo "EMAIL is not set. Please set it first."; exit 1) test -n "$$EMAIL" || (echo "EMAIL is not set. Please set it first."; exit 1)
if ! command which envsubst &> /dev/null; then \
echo "gettext is not installed. Please install it first."; \
exit 1; \
fi
if ! command which minikube &> /dev/null; then \
echo "minikube is not installed. Please install it first."; \
exit 1; \
fi
if ! command which kubectl &> /dev/null; then \
echo "kubectl is not installed. Please install it first."; \
exit 1; \
fi
if ! command which docker &> /dev/null; then \
echo "docker is not installed. Please install it first."; \
exit 1; \
fi
if ! command which md5sum &> /dev/null; then \
echo "md5sum is not installed. Please install it first."; \
exit 1; \
fi
if ! command which mvn &> /dev/null; then \
echo "maven is not installed. Please install it first."; \
exit 1; \
fi
docker: validate build:
if ! command docker info &> /dev/null; then \ ./mvnw package
echo "docker is not running. Please make sure docker is running."; \
exit 1; \
fi
cluster: docker run: prepare build
if ! command minikube status &> /dev/null; then \ java -javaagent:$$HOME/.m2/repository/com/contrastsecurity/contrast-agent/5.2.3/contrast-agent-5.2.3.jar -Dapplication.name=petclinic-${EMAIL} -Dcontrast.config.path=contrast.yaml -jar target/*.jar
minikube config set memory 4096; \
minikube start --driver=docker; \
fi \
build: cluster
mvn install
minikube image build -t petclinic:latest .
deploy: build
export RANDOM_PART=${EMAIL}_$$(hostname | md5sum | cut -c1-30) && \
minikube kubectl -- apply -f kube/postgresql.yaml && \
envsubst < kube/petclinic.yaml | minikube kubectl -- apply -f -
undeploy:
minikube kubectl -- delete -f kube/

51
Makefile.old Normal file
View file

@ -0,0 +1,51 @@
.SILENT: validate docker cluster
validate:
test -n "$$EMAIL" || (echo "EMAIL is not set. Please set it first."; exit 1)
if ! command which envsubst &> /dev/null; then \
echo "gettext is not installed. Please install it first."; \
exit 1; \
fi
if ! command which minikube &> /dev/null; then \
echo "minikube is not installed. Please install it first."; \
exit 1; \
fi
if ! command which kubectl &> /dev/null; then \
echo "kubectl is not installed. Please install it first."; \
exit 1; \
fi
if ! command which docker &> /dev/null; then \
echo "docker is not installed. Please install it first."; \
exit 1; \
fi
if ! command which md5sum &> /dev/null; then \
echo "md5sum is not installed. Please install it first."; \
exit 1; \
fi
if ! command which mvn &> /dev/null; then \
echo "maven is not installed. Please install it first."; \
exit 1; \
fi
docker: validate
if ! command docker info &> /dev/null; then \
echo "docker is not running. Please make sure docker is running."; \
exit 1; \
fi
cluster: docker
if ! command minikube status &> /dev/null; then \
minikube config set memory 4096; \
minikube start --driver=docker; \
fi \
build: cluster
mvn install
minikube image build -t petclinic:latest .
deploy: build
export RANDOM_PART=${EMAIL}_$$(hostname | md5sum | cut -c1-30) && \
minikube kubectl -- apply -f kube/postgresql.yaml && \
envsubst < kube/petclinic.yaml | minikube kubectl -- apply -f -
undeploy:
minikube kubectl -- delete -f kube/

View file

@ -37,6 +37,11 @@
<dependencies> <dependencies>
<!-- Spring and Spring Boot dependencies --> <!-- Spring and Spring Boot dependencies -->
<dependency>
<groupId>com.contrastsecurity</groupId>
<artifactId>contrast-agent</artifactId>
<version>5.2.3</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId> <artifactId>spring-boot-starter-actuator</artifactId>