WEBVTT

00:00.400 --> 00:04.280
All right, my friends, in this section we're going to start working on our Travis config file.

00:04.280 --> 00:08.600
So without any further delaying on my part, let's flip over to our code editor.

00:08.880 --> 00:13.440
Inside of my root project directory I'm going to make a new Travis dot YAML file.

00:13.680 --> 00:17.560
Now I want you to remember we have a leading period in the name of this file.

00:17.560 --> 00:22.680
So I'm going to put in dot Travis dot YAML like so.

00:22.720 --> 00:24.440
Or we can just do the abbreviation YAML.

00:24.480 --> 00:25.040
Same thing.

00:25.400 --> 00:27.680
So dot Travis dot yml.

00:28.600 --> 00:32.560
So now inside of here we're going to eventually end up with a tremendous amount of configuration.

00:32.560 --> 00:34.920
Some the stuff inside of here is going to look rather familiar.

00:34.920 --> 00:36.880
And a lot of it is going to be pretty new.

00:36.880 --> 00:40.960
So we're going to kind of speed through the stuff that we already understand and get over to some of

00:40.960 --> 00:41.720
the new stuff.

00:42.120 --> 00:47.080
So the first thing I'm going to do is add on sudo required, because we're making use of Docker, I'm

00:47.120 --> 00:52.720
then going to say that we require the Docker service to be pre-installed as soon as we try to run our

00:52.720 --> 00:57.280
build, because we definitely need Travis to build our images and even run that test container.

00:58.360 --> 01:02.840
After that, we're then going to add on a before install flag.

01:03.240 --> 01:08.360
So this is going to be a series of steps that's going to essentially do just about everything up to

01:08.560 --> 01:09.360
that point.

01:09.850 --> 01:11.410
These first four things right here.

01:12.930 --> 01:17.690
Now, the first thing that we're going to do is attempt to download and install the Google Cloud SDK.

01:18.090 --> 01:23.410
So to do so, kind of hard for me to give you a good explanation of where this command is coming from.

01:23.450 --> 01:27.650
Essentially, this is something that you would go and do a little bit of research on and just read up

01:27.650 --> 01:29.730
on how to install the Google Cloud SDK.

01:30.010 --> 01:34.010
Of course, I'm going to show you right now, I just want you to understand that this is kind of something

01:34.010 --> 01:35.290
coming from the outside world.

01:35.290 --> 01:43.770
So we're going to do a curl https colon slash slash SDK cloud google.com.

01:44.410 --> 01:46.010
And then we'll put a pipe.

01:46.010 --> 01:47.770
So that's a vertical symbol right there.

01:47.810 --> 01:48.610
It's shift.

01:48.610 --> 01:51.010
And then the key above your return button.

01:51.290 --> 01:52.450
That is not an L.

01:52.450 --> 01:54.850
So not null not a capital L not a capital I.

01:54.970 --> 01:56.370
It's a pipe symbol.

01:57.050 --> 02:03.730
And we'll say bash greater than sign slash dev null and then a colon like so.

02:04.650 --> 02:05.010
All right.

02:05.010 --> 02:08.930
So this command right here is going to download Google Cloud SDK.

02:09.250 --> 02:14.570
And then everything on the other side of the pipe right here is going to install it locally on our little

02:14.770 --> 02:17.810
instance that is assigned to us by Travis-ci.

02:20.100 --> 02:23.940
After installing it, we're then going to run one other kind of strange command.

02:23.980 --> 02:33.740
I'm going to say source dollar, sign home, Google Cloud SDK and then path dot Bash Inc.

02:34.340 --> 02:39.900
So this right here is going to look at the default install directory of Google Cloud SDK which is by

02:39.940 --> 02:42.820
again by default at home Google Cloud SDK.

02:43.060 --> 02:46.340
And it's going to source the file path Bash Inc.

02:46.420 --> 02:50.900
Essentially, that just means that there is some configuration that's going to modify our shell inside

02:50.900 --> 02:52.780
of Travis-ci inside this file.

02:52.780 --> 02:56.460
And we're going to apply that additional configuration through the source command.

02:56.780 --> 03:00.940
Again these two lines of configuration right here kind of something that you would look up ahead of

03:00.940 --> 03:03.140
time and just be told, hey, run these two commands.

03:03.140 --> 03:06.300
And it's going to set up Google Cloud locally on your machine for you.

03:07.380 --> 03:07.700
Okay.

03:07.740 --> 03:12.740
So then after we install this thing, we're going to make sure that Google Cloud or the CLI is going

03:12.740 --> 03:18.420
to also install the kubectl command, the same one that you and I have been using throughout this course

03:18.420 --> 03:20.500
to manipulate our Kubernetes cluster.

03:21.020 --> 03:27.550
To do so, I'll write out G cloud components update Cube CTL.

03:27.590 --> 03:28.190
Like so.

03:28.790 --> 03:32.870
So that's going to install and update cube CTL inside of our Travis environment.

03:32.870 --> 03:38.230
And again we're going to eventually use this kubectl to apply all those different configuration files.

03:38.230 --> 03:42.950
And some of the other imperative commands we have to run to set our images on each deployment.

03:46.150 --> 03:51.790
Now after doing all this initial setup, we then have to do some authorization with Google Cloud or

03:51.790 --> 03:53.270
this G cloud SDK.

03:53.470 --> 03:56.110
We have to tell it, hey, who's this is who we are.

03:56.150 --> 04:01.190
And here's our password or whatever it might be, everything that it needs to actually log in and get

04:01.190 --> 04:02.790
access to our account.

04:03.110 --> 04:05.750
Now the command for this is going to be a little bit more involved.

04:05.790 --> 04:09.190
We're going to write out the command and then we'll talk about exactly what it's doing.

04:09.350 --> 04:20.590
So I'm going to say gcloud auth activate service account dash dash key file and then service account

04:20.630 --> 04:22.070
dot JSON like so.

04:25.510 --> 04:25.830
All right.

04:25.830 --> 04:31.110
So you might remember back when we were working with AWS in Elastic Beanstalk, we had created that

04:31.150 --> 04:37.120
IAM user and we had assigned it some number of permissions that essentially allowed that kind of user

04:37.120 --> 04:43.800
that we made use of inside of Travis-ci to actually access our copy of Elastic Beanstalk and do a deployment

04:43.800 --> 04:44.680
at some point.

04:45.320 --> 04:49.640
This service account right here, the Active Activate Service account, is essentially equivalent to

04:49.680 --> 04:51.760
that entire IAM system.

04:52.120 --> 04:58.360
So in order to tell Google Cloud or this SDK who we are and give it access to our account, we have

04:58.360 --> 05:04.360
to activate a service account and then provide a set of credentials inside of a file that we are calling

05:04.400 --> 05:05.840
service account dot JSON.

05:06.840 --> 05:10.480
So inside of this file that does not exist yet we haven't created it.

05:10.520 --> 05:15.800
We're going to eventually need to put some information that's going to give clear access to our Google

05:15.800 --> 05:16.840
Cloud account.

05:17.320 --> 05:22.040
Now as you might guess, these credentials that are going to be placed inside that file are extremely

05:22.040 --> 05:28.600
sensitive and in no way, shape or form would we ever want to allow anyone to get access to those credentials.

05:29.240 --> 05:31.000
So let's take a quick pause right now.

05:31.000 --> 05:34.800
When we come back to the next section, we're going to generate this set of credentials that are going

05:34.800 --> 05:37.360
to allow access to be given to our account.

05:37.600 --> 05:41.360
And then we're going to make sure that we somehow securely add them into Travis.

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