Java service development
At the current state, this guide is tailored towards a Java Spring service setup.
Software prerequisites
- GIT
- Maven version 3.5.3 or above
- Java 8, use openJdk, not oracle.
- Docker version 19.03.8 or above
- telepresence
- kubectl
Installing dependencies and building the service
Clone the service project from the OneX UNI Group https://gitlab.com/one.exp/uni
Make sure you are doing this under a dedicated directory to be able to locate easily.Clone the shared libraries required to build the project using the commands below
git clone https://gitlab.com/one.exp/shared/libraries.gitgit clone https://gitlab.com/one.exp/shared/master-dependencies.gitgit clone https://gitlab.com/one.exp/shared/testing-libraries.gitWarning: this will soon be deprecated as dependencies move into each service
Once the libraries have been cloned, navigate to each of the directories and run the below command
mvn clean installWarning: this will soon be deprecated as dependencies move into each service
Once the libraries have been built successfully, navigate to the service project directory and
mvn clean install
once again to build the project.
Configuring Kubernetes access
- Install kubectl: installation guide. For mac follow the section Install with Homebrew on macOS for simple setup.
- Ensure the
kubectl
is installed on your system by runningkubectl version
. The server info shouldn't be yet available. - Ask your DevOps in charge for the
kubeconfig
access file for the development cluster. - Set the
KUBECONFIG
env variable to point to thekubeconfig
file on your device.export KUBECONFIG=(path to kubeconfig) - Verify once again with
kubectl version
. You should be able to the the server info now.
Installing telepresence
- Install telepresence: installation guide
Running your service remotely in the cluster
To build a docker image navigate into the service project directory and run
docker build -t my_service_image_tag .After the docker image is successfully built, run your service remotely via telepresence using
teledev.sh -n namespace -d deployment_name -i my_service_image_tagNote: Ask your DevOps to provide you with information about
namespace
anddeployment_name
values. Also with theteledev.sh
helper script.Now your application should be running remotely and you should be able to see by the logs.
Happy debugging with Postman and friends! ;-)