Walk through the process of generating the microservices project using the JHipster CLI and review the selection we are making and why.
- [Instructor] In this video, we are going to create our first microservice. We will generate our service, import it, and review some of the code. Then we're going to run it. So how do we create a microservice? We're going to use the JHipster CLI, just like we did while creating the API Gateway, except with a couple different choices. Okay, let's create our first JHipster microservice.
First, let's open up our terminal. Let's check what directory we're in by typing in print working directory, or pwd. Okay, so let's step back one directory by typing in cd.. Okay, let's type in pwd again, and now we're in our home directory. All right, now let's create a folder for our new service.
Let's type in the command make directory landon-hotel-room-svc. Then let's navigate to that directory. Finally, let's generate our application. Type in jhipster and press Enter. Okay, this time, let's select microservice application.
On the next prompt, let's name our application. Go ahead and type in roomservice. On the third prompt, we will need to set the port that our service will run on. Each service will need to run on a unique port, so we need to be sure to increment the port each time we create a new service. Our API Gateway is already running on 8080, so let's go ahead and pick 8081.
Let's set the Java package base name as com.linkedin.landonhotel. Okay, on the next prompt, let's go ahead and choose the JHipster registry. Next, as we discussed previously, we will be using JWT tokens. So let's go ahead and select that option. On the next prompt, we're going to go with SQL for the type of database.
In production, we're going to use PostgreSQL. Then, let's go ahead and choose H2 with disk-based persistence for our dev environment DB. On the next prompt, we will be choosing Hazelcast. Since our microservice can have multiple instances, it will be very beneficial to be able to cache across multiple nodes.
So let's go ahead and choose that option. We're going to go with Gradle for our build system. Then in this example, we are actually going to pass on using any other technologies. So go ahead and press Enter to move on. We're going to skip internationalization, so go ahead and press N for no. We're going to pass on additional testing frameworks in this case just to keep it simple.
Press Enter to move forward. And at this time, we're not going to use any other generators, so go ahead and press N to move on to the next prompt. And that's it. JHipster will begin to work its magic and soon we will have a fully functional microservice ready to go. Our microservice has no front end, so all we have to do to get it up and running is to invoke the Gradle Wrapper by typing in ./gradlew.
- Installing Yarn, Yeoman, and JHipster
- Benefits of microservices
- Costs of using microservices
- JHipster microservice architecture
- Creating an API gateway
- Importing, reviewing, and running code
- How JHipster integrates with Docker
- Managing multiple microservices
- Deployment cloud solutions