Setup Java microservices
Pre-requisites
- IntelliJ (https://www.jetbrains.com/idea/download/?section=windows)
kubectl
to be able to access EDM and Postgres databases from localhost (https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/)- Get a copy of config file (see LastPass)
- Java 11 (https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/downloads-list.html)
- Maven setup with user credentials
- Either generate from jfrog or get copy of
settings.xml
file (see LastPass) - The
settings.xml
file should be placed in your .m2 folderD:\Users\USERNAME\.m2
- Either generate from jfrog or get copy of
See Enterprise LastPass page for config files :)
Enterprise LastPass for Kubernetes config
Located in kubectl .kube config.
- Download and save the config file.
- Copy the config file to
D:\Users\<USERNAME>\.kube\
in Windows or/home/<username>/.kube/
in linux. - Verify that kubectl works by
Once you have kubectl installed and the config file saved in the correct location, verify that it works with
kubectl cluster-info
and try listing some pods with
kubectl get pods -n dsis-system
IntelliJ setup
- Open IntelliJ with cloned repo, e.g. microservice-log-transfer
- Navigate to File -> Settings -> Build, Execution, Deployment -> Maven. Make sure that these are pointing to the correct folder/file:
- Navigate to File -> Project Structure -> Set SDK and Language Level:
- Navigate to
Current File
(Top right) ->Edit Configurations
->Add New Configuration
- Name = Your choice, e.g. the environment you're pointing to
- Main class = com.lgc.dist.core.msp.grizzly.GrizzlyServer
- Environment variables = get a copy of env variables, paste (make sure to separate each line with semi colon)
- Navigate to Maven-menu (M-symbol on the right) -> Click refresh symbol
- Install Lombok plugin
- After setup done in IntelliJ -> Port forward with kubectl (in Powershell):
# DSWC (assuming you use the file from LastPass)
kubectl config use-context dswc
kubectl port-forward service/dsdsedmdwp 32000:31000 -n dsis-system
#AkerBP (assuming you use the file from LastPass)
kubectl config use-context akerbp
kubectl port-forward service/dsdsedmakerbp242 31000:31000 -n dsis-system-akerbp242
- Run application with Play-symbol, should be getting "INFO: Global parameters generated" at the bottom of the output window if successful.
Restarting IntelliJ, clicking refresh-symbol or double-clicking clean / compile in Maven Lifecycle menu may fix errors that appear:
Getting the following error?
Go to pom.xml and change the version numbers of jersey-proxy-client
and jersey-media-json-jackson
to 2.39.1
(Don't commit pom.xml!) and then Maven clean + install.