We've built our image and pushed it off to Docker Hub again only required if you're running Docker on
your local machine.
Not if you're running Docker or communities on Google Cloud.
Let's move on.
We're gonna start to write out our Cuban net filed for the deployment and service to run our test service.
Back inside my editor I'm gonna find my infra directory inside the K AIDS folder I'll make a new file
called tickets dash double yellow now inside of here we're gonna write out a very familiar looking deployment
and service config.
So once again rather than doing all this from scratch let's just do a copy paste from our off deployment.
It really is going to be completely identical except wherever we have the word off we're gonna replace
it with the word tickets so I will open up the off deployment file.
I'm going to copy the contents I'll then go over to the newly created tickets depot file.
I'm going to pass this in and I'll go through here every single place I see.
I will replace it with tickets.
I'm going to do one two three or
so five in the deployment section.
Make sure you have updated all those as well.
You'll notice that inside of here we've still got a reference to that environment variable of JWT key.
Do we need this for the ticket service.
Yes absolutely.
Because our ticket service remember it's going to try to handle authentication by itself.
That ticket service is going to need to decide whether or not a request includes a valid Jason Webb
token and we can only validate a token if we have the original key that we create the token with our
ticket service.
Definitely needs the Jason Webb token key.
Now that we've done those five updates up here let's go down to the service itself.
So here's the cluster I.P. service and we will update 1 2
once I've got that all done.
I'll save this file.
All right.
That's pretty much it.
We are done with writing out that Cuban Eddie's deployment file we're now going to move on to updating
our scaffold Yama file.
Again this is all about setting up that file sinking I'll find the scaffold yeah we'll file I'm going
to go down to the bottom let's find how about the auto section right here really off is our template
to be honest if you are gonna copy that and then paste it down at the very bottom.
I'll fix up some indentation
and then I'm going to update off over two tickets
it looks like the source right here can stay the same because we still want to sink everything inside
that s our city directory.
So that should pretty much be it for the scaffold the angel file.
I will save this.
Now the very last thing we have to do let's make sure that we write out the Cuban I.D. file where the
Mongo DB deployment and the cluster I.P. service fought as well.
And guess what do you think we're going to be able to copy the authentication Mongo deployment.
Yes absolutely we can.
It's gonna be 100 percent identical.
So inside the Cade's directory I'll make a new file called tickets Mongo double dot ammo I will open
up the off Mongo deployment file I gonna copy everything inside of here then go back over to the tickets
Mongo deployment file we just created I'll paste everything inside and once again anywhere we see the
word off we'll replace it with tickets so I will do one to three
make sure you've got four updates I'll then go down to my cluster I.P. service and I'm going to do update
1 and 2.
Let's save this and close it out.
Well that is it.
That is how we would normally create a new service.
Well almost exactly how we do it.
Obviously we might not want to do that copy paste of another service because who knows what dependencies
we might be pulling over that we don't actually want or some config or who knows what else.
But at least inside this course.
That's how we're gonna create new service.
The last thing I'm going to do is make sure that I can get scaffold up and running successfully so I
can go back over to my terminal I can find the terminal window running scaffolds.
I would recommend you shut scaffold down entirely and then after closing it do a cube TTL get pods and
make sure that all the different pods actually do get terminated.
It might take a moment or two so we can run the command a couple of times and eventually there we go.
They're all dead.
So then start my scaffold back up with scaffold Dev.
That quick note you might see an air start to appear.
It might be a big red air might say something like it cannot pull image or can't find image your dock
or I.D. slash tickets.
If you see an error like that here's what you should do.
Go back over to your tickets directory rebuild the image manually so inside of tickets rerun that docker
build dash t your Docker I.D. slash tickets dot run that do another doctor push
and then after the push is complete restart scaffold again and hopefully after that the air should be
going away.
So go ahead give that a shot.
Hopefully everything gets up and running and at some point inside a slog there's a lot of information
side of it.
Now we should see something and says tickets depot connected to mongo DB and listening on port three
thousand well looks good for me I do want you to recall we are connecting to mongo DV inside of here.
But remember right now we are connecting to the wrong instance of Mongo DV inside of tickets.
We go back over to our editor find tickets index not to us remember wrong you are L right there.
So we need to make sure that we fix that thing up quick pause right here.
Let's continue in just a moment.