We've got a good start to our exploration service now in this video.
We're going to create a Docker image out of this project.
We're going to push that image off to a Docker Hub will then create a couple of different Trinity's
config files to make sure we load this thing up as a deployment into our cluster and also create an
instance of the readies in memory database as well.
That's a lot of fancy terminology.
So let's just start writing some code.
All right.
So back to my terminal again inside of exploration.
Well first build a Docker image with docker build.
I'm going to target with mock my Docker I.D. slash expiration.
And then don't forget the dot on the variant that will take just a moment or two.
So I'm just gonna let it do this thing and then once that is all complete once again we're gonna make
sure we push this off to Docker Hub image build is all complete.
So after that is all done I'll do a docker push my Docker I.D. flash expiration that's going to take
a moment or two to push off.
So while that's occurring I can go back over to my editor.
We're going to find our infra directory inside there is chaos.
And once again we're going to create a config file or expiration and create a separate one for our reddest
instance as well.
We'll start off with the reddest instance.
Now all the setup for this red is stuff.
Even if you're not familiar threats it really is going to be just about identical to what we did for
the Mongo deployments.
So inside of Kate's I'm gonna make a new file of expiration dash reddest dash devil dot emo
and then going to go into any of the different Mongo DB deployment files.
It's gonna copy everything inside their and take it over to the new readies deployment file that we
just created will then go through this thing.
So inside of expiration reddest Ash devil and we'll change a couple of different properties first we'll
change the name so instead of off Mongo deployment we're gonna change that once twice three times four
times over to expiration Dash.
Red is to make sure you now see four times in a row expiration dash Rectus inside of our listing of
containers.
Naturally we do not want to run a mongo DB.
Instead we want to run a copy of Red as well just replace it with the image.
Red is this is an actual name of an image.
And if you wanted to you could hop over to Docker Hub let's just do it for fun really quickly though
hub.
Dot dot dot dot com and we can do a quick search or read this and that is the image that we are specifying
now to connect to that redis instance.
We do still need to have a cluster IP service.
So we'll go down just a little bit and we'll change the name of this service from off Mongo service
over to expiration.
Dash readies SRB and we'll update that selector as well to expiration.
Read us
well then update the port to port twenty seven 0 1 7 as a port used by Mongo DV reticent steady uses
by default port 6 3 7 9 so we'll update both these 2 6 3 7 9 and 6 3 7 9 OK so that is it for our readies
deployment file.
Yep.
Not the worst thing in the world.
Naturally this is a very simplistic deployment of red.
There's definitely many more options we could throw in here.
But right now as we're just getting started with this expiration service this is good enough.
It's going to save this post about and will create a second config file and we'll name this one expiration
dash devil dot demo and as you could guess we're gonna throw our deployment for the actual image inside
of here once again just about everything is going to be identical to the ticket's deployment.
So we'll do another little copy paste to find the ticket's deployment file copy everything inside there.
Paste it inside of the expiration depot file that we just created and we'll go through it and update
a couple of different properties so once again I'm going to do a little multi select.
I'm gonna change tickets once twice three or five five times.
Over to expiration.
Well then take a look at the environment section still want to have our next client I.D. still want
to Nancy where l still want a cluster I.D. but we do not need a mongo you or I.
And we also do not need a Jason Webb token key either.
We are going to add in however one additional environment variable we're going to add in something that's
going to tell our expiration deployment how to connect to red.
They're gonna put in a new enviroment variable here with the name of readies underscore hosts and then
a value of the host name for the right a server that we want to connect to to connect to read as well.
We're just gonna specify the service name that we had just written out inside of the expiration readies
deployment file.
So the hostname or the service name that we want to connect to is expiration reddest SRB.
So inside of our expiration deployment file for the environment variable named read as host we'll put
in expiration readies SRB.
So that's it for the actual deployment will then go down to the cluster I.P. service.
And once again we'll update this thing just a little bit.
We're gonna change this to a name of expiration SRB a selector of expiration.
And then what ports do we care about here.
Oh wait a minute we don't care about any ports whatsoever.
Turns out that this service is not going to be contacted by any other part of our application directly
anyways.
We're also not going to have any network requests going directly to the expiration service or anything
like that.
So in this scenario we actually do not need a cluster IP service or expiration at all.
So we can delete this entire section and a three little dashes right above it all we really care about
in this case is creating the expiration pod that's gonna be running the expiration container and that
thing is going to communicate with everything else asynchronously through Nat streaming server so in
this case just a deployment nothing else that's going to save this blows it out.
And then finally let's go back over to our terminal and take a look at scaffold and see how it is doing
to back over at scaffold.
It looks like my deployment was just created and if I look a little bit above that it looks like the
red is deployment and the expiration read a service was created as well.
I don't really see any feedback from anything inside of your that could be scaffold is just kind of
stalled out so I could always restart scaffold manually but first I was going to do a quick cube TTL
get pods and see if I can see my expiration stuff running.
So when I do I get pods I see the deployment running right there.
I also see the red is server running as well.
So looks like for me everything is good to go now at this time incredibly possible that some pod is
stuck.
Without a doubt in particular if you just saved the expiration deployment file before you had finished
pushing your Docker image up to Docker Hub you might be seeing an error saying something like air image
pull or something like that.
If you see any errors like that whatsoever no problem.
I would encourage you to just restart scaffold.
That's pretty much it once you've got everything up and running.
We'll take a quick pause come back and then start working on our actual expiration service in just a
moment.