Reader small image

You're reading from  Hands-On Full Stack Development with Spring Boot 2.0 and React

Product typeBook
Published inJun 2018
Reading LevelBeginner
PublisherPackt
ISBN-139781789138085
Edition1st Edition
Languages
Right arrow
Author (1)
Juha Hinkula
Juha Hinkula
author image
Juha Hinkula

Juha Hinkula is a software development lecturer at Haaga-Helia University of Applied Sciences in Finland. He received an MSc degree in Computer Science from the University of Helsinki and he has over 17 years of industry experience in software development. Over the past few years, he has focused on modern full stack development. He is also a passionate mobile developer with Android-native technology, and also uses React Native.
Read more about Juha Hinkula

Right arrow

Chapter 14. Deploying Your Application

This chapter explains how to deploy your backend and frontend to a server. There are a variety of cloud servers or PaaS (Platform as a Service) providers available, such as Amazon (AWS), DigitalOcean, and Microsoft Azure. In this book, we are using Heroku, which supports multiple programming languages that are used in web development. We will also show you how to use Docker containers in deployment.

In this chapter, we will look at the following:

  • Different options for deploying the Spring Boot application
  • How to deploy the Spring Boot application to Heroku
  • How to deploy the React app to Heroku
  • How to create the Spring Boot and MariaDB Docker container

Technical requirements


The Spring Boot application that we created in Chapter 4Securing and Testing Your Backend, is required (GitHubhttps://github.com/PacktPublishing/Hands-On-Full-Stack-Development-with-Spring-Boot-2.0-and-React/tree/master/Chapter%204).

The React app that we used in the previous chapter is also required (GitHub: https://github.com/PacktPublishing/Hands-On-Full-Stack-Development-with-Spring-Boot-2.0-and-React/tree/master/Chapter%2011).

Docker installation is necessary.

Deploying the backend

If you are going to use your own server, the easiest way to deploy the Spring Boot application is to use an executable JAR file. An executable JAR file is generated, if you use Maven, in the command line by typing the mvn clean install command. That command creates the JAR file in the build folder. In this case, you don't have to install a separate application server because it is embedded in your JAR file. Then you just have to run the JAR file using the java command, java -jar your_appfile...

Summary


In this chapter, we learned how to deploy the Spring Boot application. We went through the different deployment options of the Spring Boot application and deployed the application to Heroku. Next, we deployed our React frontend to Heroku using the Heroku Buildpack for create-react-app, which makes the deployment process fast. Finally, we used Docker to create containers from our Spring Boot application and MariaDB database. In the next chapter, we will cover some more technologies and best practises that you should explore.

Questions


  1. How should you create a Spring Boot-executable JAR file?
  2. How should you deploy the Spring Boot application to Heroku?
  3. How should you deploy the React app to Heroku?
  4. What is Docker?
  5. How should you create the Spring Boot application container?
  6. How should you create the MariaDB container?
lock icon
The rest of the chapter is locked
You have been reading a chapter from
Hands-On Full Stack Development with Spring Boot 2.0 and React
Published in: Jun 2018Publisher: PacktISBN-13: 9781789138085
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Juha Hinkula

Juha Hinkula is a software development lecturer at Haaga-Helia University of Applied Sciences in Finland. He received an MSc degree in Computer Science from the University of Helsinki and he has over 17 years of industry experience in software development. Over the past few years, he has focused on modern full stack development. He is also a passionate mobile developer with Android-native technology, and also uses React Native.
Read more about Juha Hinkula