Java service development

At the current state, this guide is tailored towards a Java Spring service setup.

Software prerequisites

  1. GIT
  2. Maven version 3.5.3 or above
  3. Java 8, use openJdk, not oracle.
  4. Docker version 19.03.8 or above
  5. telepresence
  6. kubectl

Installing dependencies and building the service

  1. 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.

  2. Clone the shared libraries required to build the project using the commands below

    git clone https://gitlab.com/one.exp/shared/libraries.git
    git clone https://gitlab.com/one.exp/shared/master-dependencies.git
    git clone https://gitlab.com/one.exp/shared/testing-libraries.git

    Warning: this will soon be deprecated as dependencies move into each service

  3. Once the libraries have been cloned, navigate to each of the directories and run the below command

    mvn clean install

    Warning: this will soon be deprecated as dependencies move into each service

  4. 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

  1. Install kubectl: installation guide. For mac follow the section Install with Homebrew on macOS for simple setup.
  2. Ensure the kubectl is installed on your system by running kubectl version. The server info shouldn't be yet available.
  3. Ask your DevOps in charge for the kubeconfig access file for the development cluster.
  4. Set the KUBECONFIG env variable to point to the kubeconfig file on your device.
    export KUBECONFIG=(path to kubeconfig)
  5. Verify once again with kubectl version. You should be able to the the server info now.

Installing telepresence

  1. Install telepresence: installation guide

Running your service remotely in the cluster

  1. To build a docker image navigate into the service project directory and run

    docker build -t my_service_image_tag .
  2. 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_tag

    Note: Ask your DevOps to provide you with information about namespace and deployment_name values. Also with the teledev.sh helper script.

  3. Now your application should be running remotely and you should be able to see by the logs.

  4. Happy debugging with Postman and friends! ;-)