April 6, 2016 | by Veer Muchandi
Today we continue with Veer Muchandi's series of 4 videos that will guide you through every detail you need to know to start building and running your own Microservices.
This third video in the series takes an example with three different microservices that come together to form an application. While each microservice is written in a different language, it show cases how developers will build microservices with their code in a git repository.
The code used in this example is available on github at https://github.com/debianmaster/microservices-on-openshift
Create some environment variable that makes it easy to deal with some of the parameters we use in the subsequent commands
export OSE_PROJECT=<
export OSE_DOMAIN=<>
Creating the Email Microservice:
The command below creates a new application for email service. This service receives the email request and sends out the email.
oc new-app --context-dir='python-email-api' https://github.com/debianmaster/microservices-on-openshift.git --name=emailsvc --image-stream='python:2.7' -l microservice=emailsvc
Creating the User Registration Backend Service :
This has two steps:
1- Create a MongoDB database
oc new-app -e MONGODB_USER=mongouser,MONGODB_PASSWORD=password,MONGODB_DATABASE=userdb,MONGODB_ADMIN_PASSWORD=password registry.access.redhat.com/rhscl/mongodb-26-rhel7 --name mongodb -l microservice=userregsvc
2- Create the User Registration Service and expose the service so that we can use a URL to make calls to the REST APIs exposed by this service. This service uses the MongoDB database and Email service created earlier.
oc new-app -e EMAIL_APPLICATION_DOMAIN=http://emailsvc:8080,MONGODB_DATABASE=userdb,MONGODB_PASSWORD=password,MONGODB_USER=mongouser,DATABASE_SERVICE_NAME=mongodb --context-dir='nodejs-users-api' https://github.com/debianmaster/microservices-on-openshift.git --name='userregsvc' -l microservice=userregsvc
oc expose svc/userregsvc
Create a front-end UserRegistration application and expose the service so that we can use a URL to access the webpages.
oc new-app -e USER_REGISTRATION_APPLICATION_DOMAIN="http://userregsvc-$OSE_PROJECT.$OSE_DOMAIN" --context-dir='php-ui' https://github.com/debianmaster/microservices-on-openshift.git --name='userreg' -l microservice=userregfrontend
oc expose svc/userreg
This series of videos was created by Veer Muchandi in collaboration with Chakradhar Jonagam.
Chakradhar Jonagam works as a Solution Architect at Red Hat.
He helps companies architect their PaaS infrastructure, Prior to this he was a full stack developer with some infosec background. In his free time he loves to take long hikes.
You can find many of Veer's blog posts here. He has created a multitude of demos that cover interesting aspects of the OpenShift Platform.
You can also follow Veer's twitter account: @VeerMuchandi
View the Entire OpenShift 3 Demo Playlist
For the latest information on OpenShift 3, please visit enterprise.openshift.com.
Categories
News, OpenShift Container Platform, Products, Videos, OpenShift Dedicated, OpenShift Online
March 20, 2023
March 17, 2023
March 16, 2023