We've now seen how to work with cluster IP services and note port services.
Now we're gonna go around to the rest of the micro services inside of our app specifically comments
carry in moderation and integrate those into our Cuban 80s cluster.
Here's the steps we need to go through.
For each one we're going to go to the source code for each of those three and we're going to update
the or else in each them to make sure that they post events to the event bus SRB because remember right
now they are trying to send events to local Post four thousand five then for each those we will build
an image and push them to Docker Hub will then create a deployment in a cluster IP service for each
of them and apply those all to our cluster.
And then finally we're going to update our event plus code that it once again sends events to comments
query and moderation because we commented out that code just a moment ago.
So the bad news here is that we're going to be essentially doing the same thing three times over or
comments query and moderation.
That's the bad news.
The good news is we're going to get a lot of practice very quickly in creating services and deployments.
So let's get to it.
We're going to first take a look at comments create moderation update your Ls in each of those to reach
out to event plus a Savi whenever they need to create an event or begin inside of comments going to
find the index not just file inside their and then I'm going to scroll through and just look for local
host.
Here's one right here I can replace local host with event bus as Savi.
Then keep going here's another.
So event bus s RV and I think that's it.
To make sure that you have two updates inside of here.
If you do a control F and look for local host you should do or get zero results.
I'll then say this file and close it that's one down.
Let's now move on to moderation inside there.
I'll find the index not ust file is local host once right here I'll update that to event bus s RV.
Save the file and.
OK I think that's it as well.
I'll do another control after local host no issue I'll save that and close it.
And then finally inside of query a fine index not J.S..
I'll go down inside of here and it looks like we have one right here where we tried to do that kind
of sink operation so I gonna make sure that I replace local hosts with event bus as Savi I'll say the
file
all right.
So now comments moderation and query are all attempting to reach out to the event plus cluster IP service
which is exactly what we want.
So we're not going to go around inside of our terminal to all three of those directories and build images
out of each of them and push them up to Docker Hub back at my terminal I'll first start off inside of
comments I'll do a docker build dash t by Docker I.D. slash comments and then a dot
looks good I'll do a docker push comments
and that should take just a moment or two I'll let it just do its thing very quickly very good that's
it for comments I'm not going to change over to a moderation
I'll do a docker build moderation in their and a docker push
and it looks like that one's gonna do a little bit of an upload so all that is running I'll open up
a another terminal window just to save our selves a little bit of time here so you don't have to watch
my slow upload speed so our last one is going to be for query so I'll change in the query I'll build
that image
and we'll do a docker push
requiring
all right so we have now updated the URLs we built images and pushed them to Docker Hub now lastly we
need to do is create a deployment in a cluster IP service for each one this video might run a little
bit long but I figure let's get all these steps done at least in one video just kind of to kind of get
this busy work out of the way so let's just keep going.
Right now they're getting created deployment and cluster IP service for each one.
We'll do that back inside of our code.
Ed remember we're going to write out a config file to get started for each of those inside my infra
directory.
I will first take care of comments so I'll make a new file called comments devil got Jamil rather than
writing out the entire deployment file from scratch I'll just go and copy paste all the config from
the event bus deployment file because just about all of our config around these deployments are going
to be identical for right now.
So years event bus depot.
I'm to copy everything inside of here including the cluster I.P. service at the very bottom and I'll
paste it into this new comments Dash.
Double and then going to go through here an update event plus to say comments instead so I'll do one
year to year three year for and here's five so make sure that you have no mention of event plus inside
the deployment anymore.
I'll then go down to the cluster IP service and I will replace even bus once Weiss and three times and
then finally remember comments is not listening on port four thousand five Cummins listens on port four
thousand one.
I will update that as well.
Do 4000 and 1 Make sure you don't have forty thousand won just four thousand and one all right.
One down two to go.
So going to say this file will then create another new file inside my gates directory.
I'll call this one moderation dash double I'm going to paste that default config once again and I'll
go through the same thing again.
So event bus this time I'm just going to do a multi select since you just saw me do all those updates.
So event bus 5 times update them all to moderation
and then downside the service.
I'm going to update those three to moderation and then remember moderation listens on port.
What is it four thousand three I think I'll do a quick check inside of the index dot j ust file for
moderation.
So yes four thousand three they'll update the port and target ports to four thousand three gonna say
this file and then finally one last file inside of eights.
I'll do a query double memo in a paste once again and one more multi select there's query five times
through
replace these three with query and then this one is four thousand and two
and I'll save the file.
All right.
That should be at it.
So we've now made updates or created these three new deployment files.
Each one consists of a deployment and a cluster IP service down the last thing we have to do is take
those files and apply them into our cluster.
Let's go back over to our command line going to change into that case in front directory in case and
then we're going to apply all the config files inside of here.
We could apply them all one by one but it would save us just a little bit of time to apply them all
inside of one go to apply multiple config files with one single command.
We write out cube CTO apply dash F and then dot and once again dot means find all the different config
files inside of the current working directory and apply them so it's all run that and then I'll see
a bunch of things being created.
I've now got my query service there's the query deployment a I've got my common service Commons deployment
and so on we can now do a cube Seitel get pods and we should now see some additional pods running and
all them should have a status of running as well if any of them do not have a status of running then
chances are that you made a mistake during pushing these images off to Docker Hub or alternatively maybe
inside of a config file.
So if you see a status of any of these of something like air image back off or air image pull any kind
of air whatsoever.
The first thing to do to debug it is to copy that pods name and then do a cube Seitel describe pod and
then the pods name the run that command and you'll see a series of events down here which hopefully
should give you some more information about what is going on.
We should also make sure that all the different services were created as well so we can do a cube Seitel
get services and we should see comments event bus moderation.
Host cluster OHS which is our node bought and query Well I'd say it looks pretty good.
Now the very last thing we have to do.
Is make sure that we update the event bus to once again send events to comments query and moderation.
So we'll take care of that in just a moment and then start to do a final test of our application.