WEBVTT

00:00.840 --> 00:02.430
-: In this section, we're gonna start talking about

00:02.430 --> 00:05.040
the travis.eml file that we're going to put together

00:05.040 --> 00:06.870
to build all of our different images

00:06.870 --> 00:08.730
and then eventually deploy our application

00:08.730 --> 00:10.263
to our Kubernetes cluster.

00:11.100 --> 00:14.190
Now, unfortunately, all the travis.eml files

00:14.190 --> 00:17.130
we've put together before we're all kind of preparation

00:17.130 --> 00:19.110
for the one that we're going to put together now,

00:19.110 --> 00:21.060
because by a large margin

00:21.060 --> 00:24.270
this is going to be the most complicated travis.eml file

00:24.270 --> 00:25.500
that we're going to put together.

00:25.500 --> 00:27.780
Lot of stuff is going to be going on inside of here,

00:27.780 --> 00:29.820
lot of different configuration.

00:29.820 --> 00:33.150
So I've got a little flow diagram to give us an idea

00:33.150 --> 00:35.790
of what we're going to be doing inside of our config file

00:35.790 --> 00:38.400
to eventually deploy our application.

00:38.400 --> 00:41.040
So everything is gonna start inside of our config file

00:41.040 --> 00:44.040
by installing a Google Cloud SDK.

00:44.040 --> 00:46.200
Remember, the entire purpose of Travis

00:46.200 --> 00:48.960
as we are using it, is to not only test our code

00:48.960 --> 00:51.420
but then to also deploy our application

00:51.420 --> 00:53.430
after our test runs successfully.

00:53.430 --> 00:54.270
And so we need to make sure

00:54.270 --> 00:56.580
that Travis has the ability to somehow reach out

00:56.580 --> 00:59.580
to our Kubernetes cluster and make changes to it,

00:59.580 --> 01:02.400
or essentially run a series of configuration files

01:02.400 --> 01:04.530
and apply them to our cluster.

01:04.530 --> 01:08.190
So to do so, we're going to install a Google Cloud SDK.

01:08.190 --> 01:11.160
This is a CLI that is going to allow us to

01:11.160 --> 01:13.620
essentially remotely interact with

01:13.620 --> 01:15.630
and configure our Kubernetes cluster,

01:15.630 --> 01:19.023
most notably by applying different config files.

01:20.220 --> 01:22.530
Now, unfortunately this SDK does not come

01:22.530 --> 01:24.900
kind of preconfigured with Travis.

01:24.900 --> 01:26.880
In other words, we have to actually download

01:26.880 --> 01:31.140
and install the SDK every time that we run our Travis built.

01:31.140 --> 01:33.450
So after we install this thing, after we download

01:33.450 --> 01:36.540
and install it, we then have to configure the SDK

01:36.540 --> 01:39.570
with some information from our Google Cloud account.

01:39.570 --> 01:41.910
Essentially, we're going to authorize this CLI

01:41.910 --> 01:44.490
to make changes to our Google Cloud account

01:44.490 --> 01:45.690
and more specifically,

01:45.690 --> 01:48.690
the Kubernetes cluster that we just created.

01:48.690 --> 01:50.340
So that's kind of a little bit of preamble,

01:50.340 --> 01:52.110
some stuff that we're gonna do at the very start

01:52.110 --> 01:55.470
of the script and get this CLI ready to then later on

01:55.470 --> 01:58.800
deploy our application towards the end of the process.

01:58.800 --> 02:00.780
After that, we're then going to start to go through

02:00.780 --> 02:03.000
with some steps that are very similar to what we had done

02:03.000 --> 02:06.270
previously on our other different Travis builds.

02:06.270 --> 02:09.270
So we're going to log into the Docker CLI.

02:09.270 --> 02:10.950
We're going to build the test version

02:10.950 --> 02:12.480
of the multi-client image,

02:12.480 --> 02:14.970
and we're going to use that thing to run our tests.

02:14.970 --> 02:17.160
Remember, we don't really care about the tests

02:17.160 --> 02:19.710
that are inside of that multi-client image.

02:19.710 --> 02:21.750
I just want you to have a good example of

02:21.750 --> 02:25.110
how you would run some tests inside of your application

02:25.110 --> 02:27.090
so that when you actually go and apply all this knowledge

02:27.090 --> 02:29.310
to your own personal project, you understand like,

02:29.310 --> 02:32.250
okay, at this phase right here, I'm going to run a command

02:32.250 --> 02:34.080
that's going to execute my test.

02:34.080 --> 02:35.790
Again, we don't really care about the test

02:35.790 --> 02:37.173
in our particular case.

02:38.400 --> 02:40.620
After that, if all the tests run successfully

02:40.620 --> 02:42.090
we're going to run a script.

02:42.090 --> 02:43.770
So this will be a separate script

02:43.770 --> 02:45.840
outside of our travis.eml file

02:45.840 --> 02:49.500
that's going to attempt to deploy the newest images.

02:49.500 --> 02:50.700
Inside that script,

02:50.700 --> 02:52.740
we're going to build all of our different images

02:52.740 --> 02:56.670
so that's the multi-client, multi-server, and multi worker,

02:56.670 --> 02:59.320
and then we're gonna push each one off to Docker hub.

03:00.720 --> 03:02.460
After that, we're then going to apply

03:02.460 --> 03:05.970
all the different config files inside of our K8s directory.

03:05.970 --> 03:08.550
So specifically, everything inside of here.

03:08.550 --> 03:11.550
We're just going to apply the entire directory.

03:11.550 --> 03:12.810
Now, the benefit to that is that

03:12.810 --> 03:15.000
if at some point in time you and I decide,

03:15.000 --> 03:16.770
oh, hey, we need a new deployment

03:16.770 --> 03:19.170
or we need a new service, or whatever it might be,

03:19.170 --> 03:21.210
all we have to do is add a new file

03:21.210 --> 03:22.530
to the K8s directory

03:22.530 --> 03:24.840
and then push our code up to GitHub.

03:24.840 --> 03:28.140
After Travis builds our code, it's then going to apply

03:28.140 --> 03:30.300
all the config files in that K8s folder.

03:30.300 --> 03:32.610
And so essentially our Kubernetes cluster

03:32.610 --> 03:35.220
is always going to be 100% in sync

03:35.220 --> 03:37.050
with our GitHub repository.

03:37.050 --> 03:39.120
Any changes that we make to our config files

03:39.120 --> 03:41.880
in the K8s directory are always going to be applied

03:41.880 --> 03:44.460
to our Kubernetes cluster in Google Cloud

03:44.460 --> 03:46.830
as soon as we push our code off to Travis.

03:46.830 --> 03:49.203
So overall, it's actually a pretty cool system.

03:50.850 --> 03:52.650
Now, after we apply those configs,

03:52.650 --> 03:54.420
we have to do one other little step.

03:54.420 --> 03:57.750
Remember, we had a lecture a while ago

03:57.750 --> 04:00.030
where I showed you how it was kind of a pain in the rear

04:00.030 --> 04:03.450
to get a deployment to use the latest version of an image.

04:03.450 --> 04:05.550
We saw that if we just tried to reapply

04:05.550 --> 04:08.670
a deployment config file that did not somehow magically

04:08.670 --> 04:11.580
get the deployment to automatically go out to Docker hub

04:11.580 --> 04:13.920
and check to see if a new version was available.

04:13.920 --> 04:16.200
And so as a workaround, I had showed you that

04:16.200 --> 04:19.380
very special command that very imperatively

04:19.380 --> 04:22.770
set the image version that a deployment was supposed to use,

04:22.770 --> 04:24.300
and that's how we're going to eventually

04:24.300 --> 04:27.450
get our deployments to make use of the new images

04:27.450 --> 04:29.250
that we built during this step right here.

04:29.250 --> 04:31.320
So in addition to applying all those configs,

04:31.320 --> 04:32.910
we're also going to make sure that we do some

04:32.910 --> 04:36.540
imperative command to update the versions of each image

04:36.540 --> 04:39.360
that each of our deployments is making use of.

04:39.360 --> 04:40.710
Okay, so a lot of knowledge here.

04:40.710 --> 04:43.500
Like I said, this is going to be a really intense

04:43.500 --> 04:46.500
travis.eml file, and there's even a couple steps

04:46.500 --> 04:48.630
during this process that I didn't actually write

04:48.630 --> 04:50.610
into this diagram just because it would make the diagram

04:50.610 --> 04:51.720
a little bit crazy.

04:51.720 --> 04:54.270
So a lot of stuff going on, a lot of stuff to talk about.

04:54.270 --> 04:55.830
So let's take a pause right here.

04:55.830 --> 04:58.440
In the next section, we're gonna create our config file

04:58.440 --> 05:02.010
and start by installing the Google Cloud SDK.

05:02.010 --> 05:04.460
So quick pause and I'll see you in just a minute.
