{"id":17967141,"url":"https://github.com/atkaridarshan04/springboot-devops","last_synced_at":"2025-04-03T21:27:53.433Z","repository":{"id":259935566,"uuid":"879876694","full_name":"atkaridarshan04/SpringBoot-DevOps","owner":"atkaridarshan04","description":"This project showcases the implementation of DevOps practices on a Java Spring Boot application","archived":false,"fork":false,"pushed_at":"2024-11-26T12:14:12.000Z","size":1015,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-09T09:29:15.292Z","etag":null,"topics":["cicd","docker","gitops","jenkins","kind","kubernetes","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atkaridarshan04.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-28T17:46:49.000Z","updated_at":"2024-11-26T12:14:16.000Z","dependencies_parsed_at":"2024-10-28T18:48:42.833Z","dependency_job_id":"abff870b-a541-42bf-92fd-1a7bc38e37df","html_url":"https://github.com/atkaridarshan04/SpringBoot-DevOps","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"de6aa33beae2d372b871d477c1927c2463a81cc8"},"previous_names":["atkaridarshan04/springboot-devops"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atkaridarshan04%2FSpringBoot-DevOps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atkaridarshan04%2FSpringBoot-DevOps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atkaridarshan04%2FSpringBoot-DevOps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atkaridarshan04%2FSpringBoot-DevOps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atkaridarshan04","download_url":"https://codeload.github.com/atkaridarshan04/SpringBoot-DevOps/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247081303,"owners_count":20880402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cicd","docker","gitops","jenkins","kind","kubernetes","spring-boot"],"created_at":"2024-10-29T14:04:16.246Z","updated_at":"2025-04-03T21:27:53.410Z","avatar_url":"https://github.com/atkaridarshan04.png","language":"HTML","readme":"# SpringBoot-DevOps Project\n\nThis guide provides detailed steps to **dockerize**, **publish**, and **deploy** the **SpringBoot-DevOps** bank application using **Docker** and **Kubernetes**. It covers both manual setup and automation with **Docker Compose** and **Kubernetes** using a **Kind cluster**.\n\n## Table of Contents\n\n| **Section**                                   | **Description**                                          |\n|-----------------------------------------------|----------------------------------------------------------|\n| [Dockerizing the Application](#dockerizing-the-application) | Containerize and run the Spring Boot app with MySQL. |\n| [Tagging and Pushing to Docker Hub](#tagging-and-pushing-to-docker-hub) | Push the Docker image to Docker Hub for sharing. |\n| [Deploying on Kubernetes](#deploying-on-kubernetes)         | Deploy the app using Kubernetes and Kind. |\n\n---\n\n## Dockerizing the Application  \n\nThis section explains how to containerize the **SpringBoot-DevOps** bank application and set it up manually and via Docker Compose.\n\n### Manual Dockerization Steps  \n\n#### 1. Clone the Repository and Build the Docker Image  \n\n```bash\ngit clone https://github.com/atkaridarshan04/SpringBoot-DevOps.git\ncd SpringBoot-DevOps\n\n# Build the Docker image for the application\ndocker build -t springboot-bankapp .\n```\n\n#### 2. Create a Docker Network  \n\nCreate a custom network for inter-container communication:\n\n```bash\ndocker network create bankapp\n```\n\n#### 3. Run the MySQL Database Container  \n\nStart a MySQL container:\n\n```bash\ndocker run -itd --name mysql \\\n  -e MYSQL_ROOT_PASSWORD=Test@123 \\\n  -e MYSQL_DATABASE=bankappdb \\\n  --network=bankapp \\\n  mysql:latest\n```\n\n#### 4. Run the SpringBoot Application Container  \n\nLaunch the Spring Boot application:\n\n```bash\ndocker run -itd --name BankApp \\\n  -e SPRING_DATASOURCE_USERNAME=\"root\" \\\n  -e SPRING_DATASOURCE_URL=\"jdbc:mysql://mysql:3306/bankappdb?useSSL=false\u0026allowPublicKeyRetrieval=true\u0026serverTimezone=UTC\" \\\n  -e SPRING_DATASOURCE_PASSWORD=\"Test@123\" \\\n  --network=bankapp \\\n  -p 8000:8000 \\\n  springboot-bankapp\n```\n\n#### 5. Verify the Running Containers  \n\nCheck if both containers are up and running:\n\n```bash\ndocker ps\n```\n\n#### 6. Access the Application  \n\n- **Remote Instance**:  \n  `http://\u003cpublic-ip\u003e:8000`  \n- **Local Instance**:  \n  `http://localhost:8000`  \n\n---\n\n### Automating Setup with Docker Compose  \n\n#### 1. Start the Services  \n\nLaunch the containers in detached mode:\n\n```bash\ndocker-compose up -d\n```\n\n#### 2. Verify the Running Services  \n\nConfirm that the services are running:\n\n```bash\ndocker ps\n```\n\n---\n\n### Stopping and Cleaning Up  \n\n#### 1. Stop and Remove the Containers  \n\nStop and remove all containers created by Docker Compose:\n\n```bash\ndocker-compose down\n```\n\n#### 2. Remove Docker Network (Optional)  \n\nTo clean up the network:\n\n```bash\ndocker network rm bankapp\n```\n\n---\n\n## Tagging and Pushing to Docker Hub  \n\nTo publish the Docker image to **Docker Hub**, follow these steps:\n\n### 1. Login to Docker Hub  \n\nAuthenticate with Docker Hub:\n\n```bash\ndocker login\n```\n\n### 2. Tag the Docker Image  \n\nLabel your image for pushing:\n\n```bash\ndocker tag springboot-bankapp atkaridarshan04/springboot-bankapp:v1\n```\n\n### 3. Push the Image to Docker Hub  \n\nUpload the image to your Docker Hub repository:\n\n```bash\ndocker push atkaridarshan04/springboot-bankapp:v1\n```\n\n---\n\n## Deploying on Kubernetes  \n\nThis section details deploying the application using a **Kind** (Kubernetes-in-Docker) cluster.\n\n### Kubernetes Setup with Kind Cluster\n\n#### 1. Install Kind  \n\nDownload and install Kind:\n\n```bash\ncurl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64\nchmod +x ./kind\nsudo mv ./kind /usr/local/bin/kind\n```\n\n#### 2. Verify the Installation  \n\nCheck the installed version of Kind:\n\n```bash\nkind version\n```\n\n#### 3. Create a Kind Cluster  \n\nCreate a `kind-config.yaml` file, as Kind runs Kubernetes in Docker containers, and by default, NodePorts might not be exposed outside the host (Docker bridge network).\n\n```yaml\nkind: Cluster\napiVersion: kind.x-k8s.io/v1alpha4\nnodes:\n  - role: control-plane\n    extraPortMappings:\n      - containerPort: 30008\n        hostPort: 30008\n        protocol: TCP\n\n```\nSet up a new Kind cluster:\n```bash\nkind create cluster --config kind-config.yaml\n```\n\nView the created cluster\n```bash\nkubectl cluster-info --context kind-kind\n```\n\n#### 4. Create and Set Namespace  \n\nEstablish a namespace for your application:\n\n```bash\nkubectl create ns bankapp\nkubectl config set-context --current --namespace=bankapp\n```\n\n---\n\n### Deploying Application and Services  \n\n1. **Apply the Persistent Volume** configuration:  \n   ```bash\n   kubectl apply -f pv.yml\n   ```\n\n2. **Apply the Persistent Volume Claim**:  \n   ```bash\n   kubectl apply -f pvc.yml\n   ```\n\n3. **Apply Secrets** for BankApp and MySQL credentials:  \n   ```bash\n   kubectl apply -f secrets.yml\n   ```\n\n4. **Deploy the MySQL Database**:  \n   ```bash\n   kubectl apply -f mysql.yml\n   ```\n\n5. **Deploy the Spring Boot Application**:  \n   ```bash\n   kubectl apply -f bankapp.yml\n   ```\n\n6. **Verify the Pods and Services**:  \n   ```bash\n   kubectl get pods\n   kubectl get svc\n   ```\n\n7. **Access the Application** at:  \n   ```plaintext\n   http://\u003cinstance-ip\u003e:30008\n   ```\n\n---\n\n### Cleanup  \n\nTo remove all resources, delete the **bankapp** namespace:\n\n```bash\nkubectl delete ns bankapp\nkind delete cluster\n```\n\n---\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatkaridarshan04%2Fspringboot-devops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatkaridarshan04%2Fspringboot-devops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatkaridarshan04%2Fspringboot-devops/lists"}