0% found this document useful (0 votes)
123 views7 pages

Kubernetes Deploy Mysql Spring Rest Api React Native App Instructions

This document provides instructions on how to deploy a Spring Boot backend API on Kubernetes that can be accessed by a React Native mobile app. It includes steps to clone the backend and frontend code repositories, build and run the backend as a Docker container on Kubernetes using a deployment YAML file, and configure and run the React Native frontend app to communicate with the backend API. The backend is built with Spring Boot, Spring Security, JWT, and an H2 in-memory database, while the frontend is a React Native app that calls the backend APIs using Axios.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
123 views7 pages

Kubernetes Deploy Mysql Spring Rest Api React Native App Instructions

This document provides instructions on how to deploy a Spring Boot backend API on Kubernetes that can be accessed by a React Native mobile app. It includes steps to clone the backend and frontend code repositories, build and run the backend as a Docker container on Kubernetes using a deployment YAML file, and configure and run the React Native frontend app to communicate with the backend API. The backend is built with Spring Boot, Spring Security, JWT, and an H2 in-memory database, while the frontend is a React Native app that calls the backend APIs using Axios.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 7

Instruction of how to run Spring Boot

app on Kubernetes and React Native


mobile app
https://youtu.be/arccsr1EuaU

https://github.com/sosereyboth/backend-api

https://github.com/sosereyboth/RNFrontEndApp

Spring Boot - Back End API


This project was built for an assignment. It is to be run as a micro service on
docker kubernetes environment.

Requirements
To run this back-end API service on your machine, you have to install the
following softwares:

 Git/Git Bash (Optional): for cloning source codes from the github.
 Apache Maven : for building and compiling Java project.
 Docker and Kubernetes : for deploying and running your application.

Technologies
This application was built from the following technologies:

 Java Spring Boot


 Spring Security with JWT
 H2 Database (In-memory database)
 Hibernate JPA (ORM - Object-Relational Mapping)

Let's Start

Step 1: Cloning Project


On your machine, open the terminal or git bash and then run this command
to clone the project from the git hub:
git clone https://github.com/sosereyboth/backend-api.git

Step 2: Building and Compiling Maven Project


When cloning project completed, on the terminal or git bash screen, navigate
to the downloaded folder named "backend-api" and start building the project.

cd backend-api

mvn clean package


After the process completed, a "jar" file was produced in the "target" directory
in the project root folder. This .jar file is going to be used to deploy and run
on the docker kubernetes.

Step 3: Building Docker Image


Now it's time to build a docker image from the .jar file and store the image on
docker repository. To do it, run the following command on the same terminal
screen:

docker build -t backend-api:latest .


When the process done, you can verify that image by running this command:

docker images
Then you'll see the image named "backend-api" with the tag "latest". We will
use this image to deploy on the kubernetes shortly.

Step 3: Deploying on Kubernetes


Under the "backend-api" folder on your terminal screen, you can view the file
named "deploy.yaml". This file is the Kubernetes deployment script. To deploy
our application on the Kubernetes, run the following command line on your
terminal screen:

kubectl apply -f deploy.yaml


Now you can verify your application running on the kubernetes using this
command:

kubectl get all -n manulife


Then you will see the service named "service/backend-api-svc" which running
on the port "30002". This port number is accessible from the outside of
Kubernetes cluster. This means you can access your back-end API service from
the client browser or postman or your front-end application through this port
"30002". Now you can test this URL on the local machine to make sure it
works:

http://localhost:30002/hello
Step 4: Testing APIs Using Postman
I've already put the postman testing specification in this project. The file
named "PostmanTests.zip". You can unzip this file and import into the
postman application.

Step 5: Testing APIs from Mobile App


I have already built a front-end mobile application using the React-Native. To
run the application, please check this document in another git repository here:

https://github.com/sosereyboth/RNFrontEndApp

React Native - Front End Mobile App


This is a React-Native project built for an assignment. This front-end app
accesses the back-end API service which is running on the docker kubernetes
environment.

If you haven't deployed the back-end service, check the document


here: https://github.com/sosereyboth/backend-api

Requirements
To run this application on your machine, you have to install the following
softwares:

 Git/Git Bash (Optional): for cloning source codes from the github.
 Node JS : for building and compiling source code.
 iOS simulator for Mac or Android Emulator for Android

Technologies
This application was built from the following technologies:

 React Navtive - Cross platform mobile app development


 Axios - To access back-end API through Http protocol

Let's Start
Step 1: Cloning Project
On your machine, open the terminal or git bash and then run this command
to clone the project from the git hub:

git clone https://github.com/sosereyboth/RNFrontEndApp.git


When the clone completed, you'll get a folder named "RNFrontEndApp".

Step 2: Building and Compiling Project


Open the downloaded project "RNFrontEndApp" with the VS Code IDE (or any
code editor you like). To open in the VS Code, run this command:

cd RNFrontEndApp

code .
Now edit the file named "axios.js" under the folder "/api" by defining the
"baseURL" as the IP of the machine which is running your back-end API
service (in this case the kubernetes machine). For example, baseURL:
'http://192.168.1.8:30002'

Remember: The 30002 port number is the Kubernetes service port on which
the back-end service was deployed.
I think now it's time to run the application. To do it, open a terminal on the
VSCode editor, and type this command:

npm install
Then

react-native run-ios //For iOS simulator


react-native run-android //For android emulator
When the app runs, you can test the login using this default username and
password:

Username: user1
Password: pwd1

Enjoy your test!


Dockerize Spring Boot Application with
MySQL
https://youtu.be/S2s28PCg4M4

Deploying a full-stack Spring boot,


Mysql, and React app on
Kubernetes with Persistent
Volumes and Secrets
RAJEEV SINGHDEVOPSSEPTEMBER 12, 20213 MINS READ

https://morioh.com/redirect?
id=5ed76745f0e6056e36306f57&own=5ebce777b6b21709213b471c&l=https%3A%2F
%2Fwww.callicoder.com%2Fdeploy-spring-mysql-react-nginx-kubernetes-persistent-volume-
secret%2F

You might also like