Skip to content

Instantly share code, notes, and snippets.

@aureamunoz
Last active September 13, 2019 15:41
Show Gist options
  • Select an option

  • Save aureamunoz/3ff630a253a2607fda76c23f78f2d8da to your computer and use it in GitHub Desktop.

Select an option

Save aureamunoz/3ff630a253a2607fda76c23f78f2d8da to your computer and use it in GitHub Desktop.
Try TOC

hal

Table of Contents

Overview

Hal is a CLI tool for developers to simplify the deployment of applications such as Spring Boot on OpenShift and Kubernetes using Dekorate and Halkyon Component Operator. Made with ❤️ by the Snowdrop team.

CircleCI

Key features

hal is capable of doing the following tasks

  • Scaffold Spring Boot applications
  • Deploy Microservices applications as Components
  • Switch the component from dev to build mode
  • Compose & link microservices

Building hal

  • git clone this project outside of your $GOPATH (since it uses go modules) or set GO111MODULE=on on your environment
  • Build: cd hal;make with Go 1.11+ (currently only 1.12 is tested)
  • Run: ./hal, this will display the inline help
  • Enjoy!

Downloading a snapshot

Deploying a component using hal

After installing hal, the following steps allows to create and deploy a project to a cluster. Note: this assumes that you are connected to a Halkyon-enabled OpenShift/Kubernetes cluster.

1 Scaffold the Spring Boot applications

  • Create a development folder on your laptop mkdir haldemo && cd haldemo

Create a new project using the HTTP rest template proposed by the scaffolding tool:

hal component spring-boot \
    -i hello-world \
    -g me.example \
    -p me.example.demo \
    -s 2.1.6.RELEASE \
    -t rest \
    -v 1.0.0-SNAPSHOT \
    --supported=false \
    hello-world

2 Deploy the Component

A component represents a micro-service, i.e. part of an application to be deployed. The Component custom resource provides a simpler to fathom abstraction over what's actually required at the Kubernetes level to deploy and optionally expose the micro-service outside of the cluster. In fact, when a component is deployed to a Halkyon-enabled cluster, the Halkyon operator will create these OpenShift/Kubernetes resources such as Deployment, Service, PersistentVolumeClaim, Ingress or Route on OpenShift if the component is exposed.

hal component push -c hello-world

Check if the components have been correctly installed: oc get components

NAME               RUNTIME       VERSION         AGE       MODE      STATUS    MESSAGE   REVISION
hello-world        spring-boot   2.1.6.RELEASE   7m17s     dev       Ready     Ready     6aadfc1a982fcd68

3 Connect to the rest services

Try the rest service to see if it works. To do so, get the route address of the microservice using this command oc get routes/hello-world --template={{.spec.host}} Copy/paste the address displayed within the terminal in a browser and say Hello world ;-)

Demonstration

The following demonstration provides an overview of hal:

TO DO : put here the recording embedded

Additional documentation

Additional documentation can be found below:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment