Skip to content

yitzhtal/spring-petclinic-jenkins-pipeline

Repository files navigation

Jenkins Pipeline for Spring-PetClinic Project (Deploy to DockerHub)

Introduction

Pipeline built in Jenkins for the Spring project: https://github.com/spring-projects/spring-petclinic.

Dockerhub Links

Prerequisites

  • Install wget using brew: brew install wget.
  • Docker installed.

Running the Project

  1. Clone the project:
    git clone https://github.com/talitz/spring-petclinic-jenkins-pipeline.git

  2. CD into the project and provide permissions to the shell running scripts:

  • cd spring-petclinic-jenkins-pipeline
  • chmod 755 *.sh
  1. Run a containerized Docker & Jenkins environemnt using (please provide your password when prompted):
    ./start.sh
    Note: this takes time, due to the download folder of 'jenkins_home'; it contains all the necessary configurations (job, plugins, etc) for the project to be initialized without manually installing Jenkins.

  2. Browse into localhost:8080 and insert the following username & password:

  • username: 'admin'.
  • password: run the following command in a new terminal and insert the output as a password:
    docker exec jenkins-docker cat /var/jenkins_home/secrets/initialAdminPassword
  • Please verify the password for the tyitzhak user in docker hub is the same in Jenkins Credentials Manager - unless you'll get bad credentials error in deploying to dockerhub.
  1. Go into the 'spring-petclinic-hub' job, and click on 'Build now'.
    Open BlueOcean and follow the pipeline. When it is done (it takes more then 15 minutes, the 'Compile' step takes time) it should look like that:


Note: If one of the stages fails, due to connection/unrelated issues, re-run the stage in Jenkins (shouldn't happen, but just in case).

How to use the Runnable Docker Image?

The runnable docker image is stored at tyitzhak/spring-petclinic-hub:latest.

Pull the latest petclinic-container image from the dockerhub repository:
docker pull tyitzhak/spring-petclinic-hub:latest

Run the container using:
docker run -d --name petclinic-container -p 8181:8181 tyitzhak/spring-petclinic-hub:latest

Go into localhost:8181 (it takes about ~10 seconds until the application is up).
Your application is now READY! :)

You can run the container's shell using:
docker exec -it petclinic-container sh

Terminate the Project

Run ./terminate.sh.

About

Pipeline built in Jenkins for the Spring project: https://github.com/spring-projects/spring-petclinic.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published