Giter Club home page Giter Club logo

spring-petclinic-actions's Introduction

Red Hat Actions - Spring Pet Clinic Sample

OpenShift Pet Clinic Workflow

This is a fork of the Spring Pet Clinic which uses Red Hat's GitHub Actions to build an application image and deploy it to OpenShift as an example CI/CD workflow.

A Dockerfile and Helm Chart have been added to make this a cloud-ready version of the petclinic.

This workflow uses the following Red Hat Actions:

It demos an end-to-end workflow which:

  • Compiles a Java Spring web application
  • Builds a container image
  • Pushes that image to a registry
  • Logs in to an OpenShift cluster
  • Creates a Deployment, Service and Route to start a container and expose it to the internet
  • Checks that the app is running successfully
  • Tears down the test resources

This workflow runs on GitHub's Ubuntu runners, which come with oc 4.6.0 pre-installed.

If you're not using the Ubuntu runners, use oc-installer to install oc.

Try it yourself

To run the workflow on your fork, you have to replace a few environment variables and secrets with your own values.

  1. Fork this repository.

  2. Enable actions on your fork by navigating to the Actions tab and allowing actions to run.

  3. Replace the environment variable values in the workflow yaml with your own.

    • The environment variables you must edit are at the top of the workflow file.
    • Edit the REGISTRY_USER and TEST_REGISTRY to point to your container registry.
      • For example, if you want to push to Dockerhub as john:
        • Set IMAGE_REGISTRY to docker.io.
        • Set REGISTRY_USER to john.
        • The password is stored in a secret called REGISTRY_PASSWORD - see below.
    • Edit the TEST_NAMESPACE to the namespace you want the workflow to issue oc commands against. The namespace must exist before the workflow runs.
      • You can also remove the TEST_NAMESPACE and the workflow will use the default for your user.
  4. Add the necessary secrets in your forked repository's Settings.

    • Create a secret called REGISTRY_PASSWORD which contains the password, encrypted password, or token for the REGISTRY_USER you set up above.
    • See the oc-login Getting Started to determine the values for OPENSHIFT_SERVER and OPENSHIFT_TOKEN, and to read about the advantages and disadvantages of each authentication method.
      • The easiest way to retrieve these, if you're already logged in locally:
        • oc whoami --show-server for the OPENSHIFT_SERVER.
        • oc whoami --show-token for the OPENSHIFT_TOKEN.
  5. Commit your changes and push to your fork.

  6. The workflow will run to compile, build and deploy the petclinic.

  7. To clean up the resources, log in locally, run helm ls, and delete the release that the workflow created.

    To have the workflow clean up after itself, set TEAR_DOWN: true in the env section at the top of the workflow.

Docker Build

Separate from the demo above, the project can also be built from its Dockerfile with:

mvn package && docker build . -t petclinic:latest
docker run -p 8080:8080 petclinic:latest

After the server starts, the app will be available at localhost:8080.

spring-petclinic-actions's People

Contributors

arey avatar snicoll avatar tetchel avatar nmalvankar avatar dsyer avatar verydapeng avatar trepel avatar tduchateau avatar oscr avatar crydust avatar gordonad avatar cyrille-leclerc avatar freemansoft avatar boykoalex avatar trisberg avatar divyansh42 avatar liouxiao avatar spring-operator avatar rstoyanchev avatar cruftex avatar arka-bandyopadhyay avatar aaguilera avatar adityaketkar avatar meltsufin avatar mustafau avatar oltruong avatar piyush-garg avatar saturnism avatar rognetta avatar tejasm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.