1 00:00:00,960 --> 00:00:01,680 All right my friends. 2 00:00:01,680 --> 00:00:03,420 Let's get started on our payment service. 3 00:00:03,510 --> 00:00:07,980 So once again we are going to make essentially duplicate of a lot of stuff inside of our ticket service 4 00:00:08,490 --> 00:00:13,500 offers begin by creating a new directory and I'll call it payments must most to zoom in just you can 5 00:00:13,500 --> 00:00:17,400 see is a little bit more easily than inside of tickets. 6 00:00:17,440 --> 00:00:24,770 I'm going to take Docker ignore Docker file package on empty US config. 7 00:00:24,990 --> 00:00:32,820 I'm going to copy all those and paste them into payments then insider payments I'm gonna create a folder 8 00:00:32,880 --> 00:00:40,170 of SLC and front tickets we're going to copy paste a decent amount of stuff over so we're going to take 9 00:00:40,320 --> 00:00:40,860 MOX 10 00:00:43,930 --> 00:00:52,090 we'll take test app index and that's rapper so the only thing that we are not taking are events models 11 00:00:52,120 --> 00:00:57,520 and routes I'm going to copy all that over and paste it into the payments as our city directory 12 00:01:00,230 --> 00:01:00,800 and that is it. 13 00:01:00,800 --> 00:01:05,300 That is everything we need to get started as usual we're now going to go through a couple of these files 14 00:01:05,330 --> 00:01:11,390 and make a few updates here and there will then install some dependencies build a Docker image and then 15 00:01:11,390 --> 00:01:17,620 add in some config on the Cuban neti side let's go through this file by file so first off in the box 16 00:01:17,620 --> 00:01:23,020 directory definitely no changes required there about the test setup file probably no changes required 17 00:01:24,140 --> 00:01:29,370 about at yes while definitely inside of here we've got a lot of routing stuff related to our ticket 18 00:01:29,370 --> 00:01:34,800 service so inside if you're going to delete the 4 imports or the routers 19 00:01:39,110 --> 00:01:46,540 and then going to scroll down a little bit and find where we wired up all those different routers now 20 00:01:46,540 --> 00:01:51,400 there are some other areas inside of here but they will go away once we start to install some dependencies 21 00:01:52,610 --> 00:01:59,560 so right now going to say this I'll move on to our next file indexed yes inside of index out yes we 22 00:01:59,560 --> 00:02:05,380 definitely do not need those two listeners at the top I'm also going to delete B to listeners after 23 00:02:05,380 --> 00:02:07,180 we initialize the Nats wrapper 24 00:02:11,080 --> 00:02:16,180 yet I think that's pretty good for this file so I'll say this one and close it Nats wrapper. 25 00:02:16,190 --> 00:02:22,970 Definitely no changes required and finally let's move on to our package based on file inside a package 26 00:02:22,970 --> 00:02:25,920 based on will update the name on this package. 27 00:02:26,110 --> 00:02:29,170 Again not really required but while we're here let's do it anyways 28 00:02:31,950 --> 00:02:37,020 and then our list of dependencies we're actually going to want all the same dependencies our payment 29 00:02:37,020 --> 00:02:41,520 service is gonna be very similar nature to tickets and orders and then it's going to be processing events 30 00:02:41,940 --> 00:02:46,010 publishing events that's also going to implement the expressed side of our application as well. 31 00:02:46,020 --> 00:02:50,850 So it's going to have a root handler or two that is very different from say the exploration service 32 00:02:50,850 --> 00:02:55,440 which we set up a bit ago in the exploration service we deleted a ton of dependencies because it did 33 00:02:55,440 --> 00:02:59,730 not need to handle any incoming network requests. 34 00:02:59,770 --> 00:03:05,490 All right so let's save this package is on file I'll then go back over to my terminal. 35 00:03:05,490 --> 00:03:11,550 We're going to build an initial Docker image out of this thing and endure our Cuban natty setup it's 36 00:03:11,610 --> 00:03:22,550 a back in my terminal I'll change it to payments inside of there we'll do a docker build dash t your 37 00:03:22,550 --> 00:03:26,890 Docker I.T. and then naturally we will call this thing payments. 38 00:03:27,130 --> 00:03:32,220 And don't forget the dot on the variant so I gonna let that do it thing. 39 00:03:32,220 --> 00:03:37,110 Don't forget we do want to push this off to Docker Hub so we are going to come back to this terminal 40 00:03:37,110 --> 00:03:39,560 window in just a moment and do that Docker push. 41 00:03:39,690 --> 00:03:47,640 But while this initial install is running let's go install or do a little bit of Cuban setup first because 42 00:03:47,640 --> 00:03:50,370 we kind of forgot it on the expiration service. 43 00:03:50,400 --> 00:03:56,310 Let's first begin by setting up that scaffold GMO file and adding in yet another block to handle code 44 00:03:56,310 --> 00:03:58,470 sync for this new payment service. 45 00:03:58,530 --> 00:04:06,760 So inside of scaffold AML we will copy that last block right there e it down make some indentation 46 00:04:09,760 --> 00:04:12,270 and I'll change expiration once and twice. 47 00:04:12,310 --> 00:04:17,950 So two locations right there two payments instead. 48 00:04:17,980 --> 00:04:19,190 That looks good. 49 00:04:19,190 --> 00:04:20,710 So I'll say this file and close it. 50 00:04:21,720 --> 00:04:26,610 And then finally we will go over to our infra directory and create a deployment and we are going to 51 00:04:26,610 --> 00:04:29,400 have a Mongo DB database for this service as well. 52 00:04:29,400 --> 00:04:33,300 We haven't really discussed what data is really going to be living inside the payment service beyond 53 00:04:33,300 --> 00:04:37,410 this diagram right here and saying that we're gonna have something called charges and orders but suffice 54 00:04:37,410 --> 00:04:42,420 it to say we will need a Mongo DB database and we will expand on the nature of these two records over 55 00:04:42,420 --> 00:04:43,200 time. 56 00:04:43,200 --> 00:04:45,600 Right now let's just set up a copy of Mongo DB. 57 00:04:45,600 --> 00:04:53,020 In addition to these payments deployment inside of Gates I'll make a new file of payments dash depot 58 00:04:53,290 --> 00:04:58,930 dot email I'm going to open up the ticket's deployment file. 59 00:04:59,350 --> 00:05:04,070 Once again I'm going to copy everything and then paste it into this new payments deployment 60 00:05:06,880 --> 00:05:11,200 and will go through and once again update tickets to payments. 61 00:05:11,200 --> 00:05:18,460 It's going to change once twice three or five. 62 00:05:18,460 --> 00:05:19,600 All those over two payments 63 00:05:24,450 --> 00:05:26,040 on the environment variables section. 64 00:05:26,040 --> 00:05:31,140 We definitely want to have the same Nats client I.D. setup same that's your l same cluster I.D. but 65 00:05:31,140 --> 00:05:36,750 we will change the Mongo you or I we're going to set the Mongo your eye to be a copy of Mongo specifically 66 00:05:36,750 --> 00:05:44,500 made for the payments deployment so I'll change tickets right there two payments and I'll change the 67 00:05:44,500 --> 00:05:49,660 name of the internal database inside this Mongo instance that we're gonna connect to you two payments 68 00:05:49,720 --> 00:05:56,440 as well so we just need to make sure that when recreate the Mongo DB database or the payments deployment 69 00:05:56,440 --> 00:06:00,820 or payment service we just need to make sure it has a cluster I.P. service with the name of payments 70 00:06:00,820 --> 00:06:08,820 Mongo SRB all right onto the bottom here's our service for the payments deployment. 71 00:06:08,970 --> 00:06:15,870 Once again we'll find once twice three time and change them all to payments I should be able to do a 72 00:06:15,870 --> 00:06:17,260 find in this file. 73 00:06:17,430 --> 00:06:23,670 Look forward the word tickets and get no results the Nats cluster ideas right there. 74 00:06:23,700 --> 00:06:24,680 Ticketing is okay. 75 00:06:24,690 --> 00:06:27,690 That is different from the ticket service. 76 00:06:27,750 --> 00:06:27,960 All right. 77 00:06:27,960 --> 00:06:35,380 So that is it for our payments deployment file it's going to close this thing out then I will also create 78 00:06:35,410 --> 00:06:37,600 another new file inside of our K it's directory. 79 00:06:37,610 --> 00:06:46,450 This will be payments Mongo devil dot CMO and once again this is going to be identical in nature to 80 00:06:46,450 --> 00:06:47,040 our tickets. 81 00:06:47,050 --> 00:06:52,000 Mongo deployment file so we'll open that one up just do another copy paste it in. 82 00:06:52,240 --> 00:07:01,520 And once again we'll go through and update tickets once twice three or four times over to payments and 83 00:07:01,520 --> 00:07:06,560 then on the Cluster I.P. service we'll change the name on this thing as well once and twice two payments 84 00:07:08,050 --> 00:07:08,890 and that should be at 85 00:07:12,000 --> 00:07:12,570 all right. 86 00:07:12,690 --> 00:07:16,230 Let's go see how our Docker images looks like it's all built. 87 00:07:16,240 --> 00:07:19,180 Well go ahead and do a push over to Docker Hub. 88 00:07:19,260 --> 00:07:27,430 They'll be a docker push my Docker I.D. slash payments that is going to take a moment or two to get 89 00:07:27,430 --> 00:07:27,970 pushed over. 90 00:07:28,510 --> 00:07:33,250 So just as a quick reminder when we come back we really want to make sure that scaffold is up and running 91 00:07:34,370 --> 00:07:39,110 you might already see the payments service up and running right here or you might see something from 92 00:07:39,110 --> 00:07:43,010 scaffold that says hey can't find this digester some I.D. like that. 93 00:07:43,070 --> 00:07:47,380 Remember you can always just start stop scaffold and then restart it. 94 00:07:47,570 --> 00:07:52,460 Just keep in mind that when you restart scaffold you might get a pod or two saying that it cannot connect 95 00:07:52,460 --> 00:07:53,590 to not that's. 96 00:07:53,750 --> 00:07:57,860 So if you see any messages saying hey I can't connect and that's writing like that you will want to 97 00:07:57,980 --> 00:08:04,160 right now just manually restart those pods and as a reminder to do a manual restart we can open up a 98 00:08:04,160 --> 00:08:12,030 neutral window to a cube CTO get pods find the pod that is failing to connect and you'll have to look 99 00:08:12,030 --> 00:08:20,500 up the name based upon the logs you see inside a scaffold and then you'll do a cube tell delete pod 100 00:08:20,650 --> 00:08:24,990 and then whatever the name of the pod is that you want to reset and again you only have to do all this 101 00:08:24,990 --> 00:08:28,490 stuff if you decide that you have to restart scaffold OK. 102 00:08:28,530 --> 00:08:29,540 Let's take a pause right here. 103 00:08:29,580 --> 00:08:33,210 Next video going to have the expectation that everything is up and running. 104 00:08:33,240 --> 00:08:37,530 So at this point I think that you've probably seen a lot of scenarios where stuff is not quite working 105 00:08:37,530 --> 00:08:38,310 as expected. 106 00:08:38,370 --> 00:08:42,510 It's going to kind of leave it up to you to do a little bit of troubleshooting on your own and hopefully 107 00:08:42,570 --> 00:08:44,490 come out in the next video with everything up and running.