All right my friends.
Let's get started on our payment service.
So once again we are going to make essentially duplicate of a lot of stuff inside of our ticket service
offers begin by creating a new directory and I'll call it payments must most to zoom in just you can
see is a little bit more easily than inside of tickets.
I'm going to take Docker ignore Docker file package on empty US config.
I'm going to copy all those and paste them into payments then insider payments I'm gonna create a folder
of SLC and front tickets we're going to copy paste a decent amount of stuff over so we're going to take
MOX
we'll take test app index and that's rapper so the only thing that we are not taking are events models
and routes I'm going to copy all that over and paste it into the payments as our city directory
and that is it.
That is everything we need to get started as usual we're now going to go through a couple of these files
and make a few updates here and there will then install some dependencies build a Docker image and then
add in some config on the Cuban neti side let's go through this file by file so first off in the box
directory definitely no changes required there about the test setup file probably no changes required
about at yes while definitely inside of here we've got a lot of routing stuff related to our ticket
service so inside if you're going to delete the 4 imports or the routers
and then going to scroll down a little bit and find where we wired up all those different routers now
there are some other areas inside of here but they will go away once we start to install some dependencies
so right now going to say this I'll move on to our next file indexed yes inside of index out yes we
definitely do not need those two listeners at the top I'm also going to delete B to listeners after
we initialize the Nats wrapper
yet I think that's pretty good for this file so I'll say this one and close it Nats wrapper.
Definitely no changes required and finally let's move on to our package based on file inside a package
based on will update the name on this package.
Again not really required but while we're here let's do it anyways
and then our list of dependencies we're actually going to want all the same dependencies our payment
service is gonna be very similar nature to tickets and orders and then it's going to be processing events
publishing events that's also going to implement the expressed side of our application as well.
So it's going to have a root handler or two that is very different from say the exploration service
which we set up a bit ago in the exploration service we deleted a ton of dependencies because it did
not need to handle any incoming network requests.
All right so let's save this package is on file I'll then go back over to my terminal.
We're going to build an initial Docker image out of this thing and endure our Cuban natty setup it's
a back in my terminal I'll change it to payments inside of there we'll do a docker build dash t your
Docker I.T. and then naturally we will call this thing payments.
And don't forget the dot on the variant so I gonna let that do it thing.
Don't forget we do want to push this off to Docker Hub so we are going to come back to this terminal
window in just a moment and do that Docker push.
But while this initial install is running let's go install or do a little bit of Cuban setup first because
we kind of forgot it on the expiration service.
Let's first begin by setting up that scaffold GMO file and adding in yet another block to handle code
sync for this new payment service.
So inside of scaffold AML we will copy that last block right there e it down make some indentation
and I'll change expiration once and twice.
So two locations right there two payments instead.
That looks good.
So I'll say this file and close it.
And then finally we will go over to our infra directory and create a deployment and we are going to
have a Mongo DB database for this service as well.
We haven't really discussed what data is really going to be living inside the payment service beyond
this diagram right here and saying that we're gonna have something called charges and orders but suffice
it to say we will need a Mongo DB database and we will expand on the nature of these two records over
time.
Right now let's just set up a copy of Mongo DB.
In addition to these payments deployment inside of Gates I'll make a new file of payments dash depot
dot email I'm going to open up the ticket's deployment file.
Once again I'm going to copy everything and then paste it into this new payments deployment
and will go through and once again update tickets to payments.
It's going to change once twice three or five.
All those over two payments
on the environment variables section.
We definitely want to have the same Nats client I.D. setup same that's your l same cluster I.D. but
we will change the Mongo you or I we're going to set the Mongo your eye to be a copy of Mongo specifically
made for the payments deployment so I'll change tickets right there two payments and I'll change the
name of the internal database inside this Mongo instance that we're gonna connect to you two payments
as well so we just need to make sure that when recreate the Mongo DB database or the payments deployment
or payment service we just need to make sure it has a cluster I.P. service with the name of payments
Mongo SRB all right onto the bottom here's our service for the payments deployment.
Once again we'll find once twice three time and change them all to payments I should be able to do a
find in this file.
Look forward the word tickets and get no results the Nats cluster ideas right there.
Ticketing is okay.
That is different from the ticket service.
All right.
So that is it for our payments deployment file it's going to close this thing out then I will also create
another new file inside of our K it's directory.
This will be payments Mongo devil dot CMO and once again this is going to be identical in nature to
our tickets.
Mongo deployment file so we'll open that one up just do another copy paste it in.
And once again we'll go through and update tickets once twice three or four times over to payments and
then on the Cluster I.P. service we'll change the name on this thing as well once and twice two payments
and that should be at
all right.
Let's go see how our Docker images looks like it's all built.
Well go ahead and do a push over to Docker Hub.
They'll be a docker push my Docker I.D. slash payments that is going to take a moment or two to get
pushed over.
So just as a quick reminder when we come back we really want to make sure that scaffold is up and running
you might already see the payments service up and running right here or you might see something from
scaffold that says hey can't find this digester some I.D. like that.
Remember you can always just start stop scaffold and then restart it.
Just keep in mind that when you restart scaffold you might get a pod or two saying that it cannot connect
to not that's.
So if you see any messages saying hey I can't connect and that's writing like that you will want to
right now just manually restart those pods and as a reminder to do a manual restart we can open up a
neutral window to a cube CTO get pods find the pod that is failing to connect and you'll have to look
up the name based upon the logs you see inside a scaffold and then you'll do a cube tell delete pod
and then whatever the name of the pod is that you want to reset and again you only have to do all this
stuff if you decide that you have to restart scaffold OK.
Let's take a pause right here.
Next video going to have the expectation that everything is up and running.
So at this point I think that you've probably seen a lot of scenarios where stuff is not quite working
as expected.
It's going to kind of leave it up to you to do a little bit of troubleshooting on your own and hopefully
come out in the next video with everything up and running.