WEBVTT

00:01.196 --> 00:02.029
-: In the last section,

00:02.029 --> 00:02.862
we created our service account

00:02.862 --> 00:04.560
and we downloaded a JSON file

00:04.560 --> 00:07.320
that contains some credentials for that service account.

00:07.320 --> 00:10.140
We now need to download and install the Travis CLI

00:10.140 --> 00:11.760
which is a program that we're going to use

00:11.760 --> 00:14.550
to encrypt that service account JSON file

00:14.550 --> 00:16.950
and tie it to our Travis CI account.

00:16.950 --> 00:18.870
Remember, the entire idea behind this

00:18.870 --> 00:20.790
is that the JSON file we just downloaded.

00:20.790 --> 00:23.760
So this one right here has some very sensitive information

00:23.760 --> 00:25.710
inside of it and we do not want to expose it

00:25.710 --> 00:26.543
to the outside world

00:26.543 --> 00:28.590
from our GitHub account.

00:28.590 --> 00:31.623
All right, so to download and install the Travis CLI,

00:33.034 --> 00:35.250
we can go to Github.com blah blah blah,

00:35.250 --> 00:37.620
and download this thing and install it.

00:37.620 --> 00:40.230
However, there's just one little awkward thing

00:40.230 --> 00:41.943
about the Travis CLI,

00:42.904 --> 00:43.800
and that is that it requires Ruby

00:43.800 --> 00:45.650
to be installed on your local system.

00:47.176 --> 00:48.270
Now, if you are on a mac Os machine,

00:48.270 --> 00:49.980
you're in luck because by default,

00:49.980 --> 00:52.260
Ruby is installed on mac Os.

00:52.260 --> 00:54.330
However, if you are on Windows,

00:54.330 --> 00:56.490
well, life is a little bit harder.

00:56.490 --> 00:59.700
On Windows, installing Ruby is a little bit more challenging

00:59.700 --> 01:01.683
and it's kind of a pain in the rear.

01:03.900 --> 01:04.890
Now, I would hate to have to go

01:04.890 --> 01:06.930
through the Ruby installation process with you

01:06.930 --> 01:07.763
if you're on Windows

01:07.763 --> 01:09.090
because it is a little bit of a pain

01:09.090 --> 01:11.070
and it takes a decent amount of time.

01:11.070 --> 01:14.130
But there is a little work around that we can use.

01:14.130 --> 01:15.360
I want you to remember,

01:15.360 --> 01:17.580
what have we been doing in this entire course?

01:17.580 --> 01:20.370
We've been creating Docker images and containers

01:20.370 --> 01:22.770
and the entire purpose of these containers

01:22.770 --> 01:26.160
is that we can very easily get some different environment

01:26.160 --> 01:28.080
up and running on our local machine

01:28.080 --> 01:30.330
with some very customized dependencies

01:30.330 --> 01:32.310
inside of that container.

01:32.310 --> 01:35.790
So I think that rather than trying to install Ruby locally

01:35.790 --> 01:36.623
on your machine,

01:36.623 --> 01:38.790
especially if you are on Windows,

01:38.790 --> 01:42.000
instead, let's try getting a Docker image

01:42.000 --> 01:44.643
that has Ruby pre-installed inside of it.

01:45.600 --> 01:48.630
So we're going to get an image that has Ruby pre-installed.

01:48.630 --> 01:50.700
We'll then open up a shell or a terminal

01:50.700 --> 01:53.400
inside of that container and then we'll use that

01:53.400 --> 01:55.980
to install and run the Travis CLI.

01:55.980 --> 01:57.840
There's only a single command we have to run

01:57.840 --> 01:59.700
with Travis CLI essentially, you know,

01:59.700 --> 02:02.010
just the one command to encrypt that file

02:02.010 --> 02:02.910
that we care about.

02:02.910 --> 02:04.950
So we don't really need a persistent version

02:04.950 --> 02:06.600
of the Travis CLI to sit around

02:06.600 --> 02:08.310
because we just want to use it one time

02:08.310 --> 02:09.630
and then throw it away.

02:09.630 --> 02:11.430
So this would actually be a great use case

02:11.430 --> 02:12.960
where we could use a Docker container

02:12.960 --> 02:14.940
with Ruby already installed inside of it

02:14.940 --> 02:17.700
to install Travis CLI,

02:17.700 --> 02:18.840
use it to encrypt the file,

02:18.840 --> 02:20.790
and then throw the entire container away

02:20.790 --> 02:23.220
'cause we don't need it for anything else.

02:23.220 --> 02:24.633
So let's give this a shot.

02:25.800 --> 02:27.720
Now, in this section as we go through this process

02:27.720 --> 02:30.420
we are going to be running a good number of commands.

02:30.420 --> 02:32.460
And so, I wanted to put all the commands up here

02:32.460 --> 02:34.290
and all the different steps we're going to go through

02:34.290 --> 02:35.880
just in case you are skipping

02:35.880 --> 02:37.230
through this video rather quickly,

02:37.230 --> 02:39.120
I wanna make sure that you don't accidentally skip

02:39.120 --> 02:40.770
one of the commands inside of here.

02:40.770 --> 02:43.350
So I would almost recommend that you take a screenshot

02:43.350 --> 02:45.390
of this diagram right here just to make sure

02:45.390 --> 02:48.660
that you nail each and every one of these commands.

02:48.660 --> 02:50.704
So the first thing we're going to do

02:50.704 --> 02:52.950
is execute a Docker run command.

02:52.950 --> 02:54.450
The image that we're going to be running

02:54.450 --> 02:57.090
is Ruby version 2.3.

02:57.090 --> 02:58.140
And then at the same time,

02:58.140 --> 03:00.750
we're gonna start up a shell inside there

03:00.750 --> 03:03.060
and we're also gonna set up a volume.

03:03.060 --> 03:04.350
The purpose of the volume right here

03:04.350 --> 03:07.740
is to eventually get the service account JSON file

03:07.740 --> 03:09.060
inside the container.

03:09.060 --> 03:10.980
Remember, this is the file that we want to encrypt

03:10.980 --> 03:11.813
so we need to make sure

03:11.813 --> 03:14.220
that it is available inside the container.

03:14.220 --> 03:16.470
So we're going to use a volume to do that.

03:16.470 --> 03:19.350
Now, notice that we're using the dollar sign parentheses

03:19.350 --> 03:20.550
and interpolation here.

03:20.550 --> 03:23.160
This is only valid if you're on a Unix-based system

03:23.160 --> 03:26.730
or if you're on Windows using Git Bash as your terminal.

03:26.730 --> 03:28.740
If you are on Windows and you're using something

03:28.740 --> 03:31.740
like the command line or PowerShell,

03:31.740 --> 03:33.960
you're going to use curly braces there instead.

03:33.960 --> 03:36.540
So just be aware of that little difference.

03:36.540 --> 03:38.250
Okay, so let's get to it.

03:38.250 --> 03:40.260
I'm gonna open up my terminal and I'm going to make sure

03:40.260 --> 03:42.450
that I'm inside of my complex directory

03:42.450 --> 03:45.420
because we're going to eventually put that JSON file

03:45.420 --> 03:48.360
inside of here and encrypt it.

03:48.360 --> 03:50.670
And we're using specifically the complex directory

03:50.670 --> 03:52.500
'cause remember we're going to make sure

03:52.500 --> 03:54.060
that the volume is available

03:54.060 --> 03:55.290
inside the container.

03:55.290 --> 03:56.733
All right, so we'll do Docker run

03:56.733 --> 03:58.950
dash I T

03:58.950 --> 03:59.783
dash V

03:59.783 --> 04:00.723
to set up the volume.

04:02.510 --> 04:03.990
I'll say dollar sign PWD

04:03.990 --> 04:05.550
to say present working directory

04:05.550 --> 04:07.740
of the complex folder.

04:07.740 --> 04:09.070
I'll then do a colon

04:09.968 --> 04:11.940
and I'm going to map this present working directory

04:11.940 --> 04:14.370
of complex to the folder

04:14.370 --> 04:16.710
about app inside the container.

04:16.710 --> 04:18.600
Now we don't actually have any app thing to put

04:18.600 --> 04:19.433
inside the container,

04:19.433 --> 04:23.010
I'm just choosing that folder name totally at random.

04:23.010 --> 04:24.090
You could probably figure out a better name

04:24.090 --> 04:27.090
but honestly it just doesn't really matter that much.

04:27.090 --> 04:29.470
We'll then specify the image of Ruby 2.3

04:31.500 --> 04:33.480
and then the command that I want to run inside

04:33.480 --> 04:35.400
of this container is sh

04:35.400 --> 04:37.113
to start up a shell inside there.

04:38.070 --> 04:40.500
Okay, so I'm gonna run this command.

04:40.500 --> 04:41.910
Now when I run the command,

04:41.910 --> 04:44.580
I immediately get kicked into a terminal right here

04:44.580 --> 04:46.410
or a shell inside the container

04:46.410 --> 04:48.870
because I've already downloaded the Ruby image

04:48.870 --> 04:49.770
in the past.

04:49.770 --> 04:51.960
For you, you probably need to download this image

04:51.960 --> 04:54.120
and so it's gonna take maybe a minute or two

04:54.120 --> 04:55.080
to download the image

04:55.080 --> 04:57.090
and then eventually create a container out of it.

04:57.090 --> 04:59.190
So I encourage you to pause the video right now

04:59.190 --> 05:01.350
and just leave it paused until you eventually get

05:01.350 --> 05:02.763
into a shell like so.

05:05.010 --> 05:06.120
Okay, so if you're now here

05:06.120 --> 05:08.970
I'm going to assume that you've successfully gotten

05:08.970 --> 05:11.040
into a shell inside the container.

05:11.040 --> 05:13.424
So if we now do an ls, we can see that app folder.

05:13.424 --> 05:15.045
So there's the app folder right there

05:15.045 --> 05:18.720
the one that we just set up as a volume.

05:18.720 --> 05:20.670
If I change into that app folder

05:20.670 --> 05:22.500
and I encourage you to do so right now as well.

05:22.500 --> 05:24.690
So I'm gonna make sure I'm inside that app folder.

05:24.690 --> 05:28.140
I can do an ls and I'll see all of the project folders

05:28.140 --> 05:30.663
out of our original complex directory.

05:31.500 --> 05:34.140
Okay, so that definitely worked out pretty well so far.

05:34.140 --> 05:36.030
So now the next thing we're going to do

05:36.030 --> 05:37.650
is install Travis.

05:37.650 --> 05:39.310
This is the Travis CLI

05:40.170 --> 05:43.435
We're installing it by using the program, jim

05:43.435 --> 05:44.760
Jim is essentially a dependency manager

05:44.760 --> 05:46.770
for the Ruby programming language.

05:46.770 --> 05:49.803
So we're using the jim program to install Travis.

05:50.790 --> 05:52.140
So I'll do jiminstalltravis

05:53.790 --> 05:54.623
and I'll put on

05:54.623 --> 05:56.550
no dash r doc

05:56.550 --> 05:58.920
and no RI

05:58.920 --> 06:00.930
And these two flags over here at the right hand side

06:00.930 --> 06:02.550
these are a hundred percent optional.

06:02.550 --> 06:03.690
They're essentially just saying

06:03.690 --> 06:04.523
do not attempt to

06:04.523 --> 06:06.930
install any documentation along with this jim

06:06.930 --> 06:08.760
It just makes the installation go very

06:08.760 --> 06:10.830
very slightly faster.

06:10.830 --> 06:14.280
All right, so I'm gonna run this and then

06:14.280 --> 06:17.430
we're going to very quickly see everything get installed.

06:17.430 --> 06:18.810
All right, now it looks like I paused there

06:18.810 --> 06:21.570
for a second on building native extensions.

06:21.570 --> 06:24.210
Now something kind of interesting that I want to mention

06:24.210 --> 06:25.860
this is a total side topic,

06:25.860 --> 06:27.060
completely unrelated

06:27.060 --> 06:29.370
from all this Travis stuff and you're probably gonna hate me

06:29.370 --> 06:30.540
for going on a side topic

06:30.540 --> 06:32.280
while we're running all these intense commands,

06:32.280 --> 06:34.230
but I have to do it,

06:34.230 --> 06:36.090
I have to tell you about this side topic.

06:36.090 --> 06:38.280
I feel a hundred percent compelled to do so.

06:38.280 --> 06:39.900
So you'll notice during that entire process

06:39.900 --> 06:42.510
it says building native extensions right here.

06:42.510 --> 06:44.550
That's essentially a step where Ruby

06:44.550 --> 06:45.960
and the jim program

06:45.960 --> 06:48.180
are taking a bunch of Ruby Source code files

06:48.180 --> 06:50.340
and essentially compiling them to get them to work

06:50.340 --> 06:51.930
on your local system.

06:51.930 --> 06:53.760
Now that's kind of a build step

06:53.760 --> 06:56.452
and it requires some modules inside

06:56.452 --> 06:58.725
of Ruby to be installed or essentially these kind

06:58.725 --> 07:01.380
of development programs to be installed with Ruby.

07:01.380 --> 07:02.280
One thing you might notice

07:02.280 --> 07:05.410
that's kind of interesting is when we originally ran

07:06.563 --> 07:07.530
that docker run command right here

07:07.530 --> 07:12.240
we specified a image tagged as 2.3 from Ruby.

07:12.240 --> 07:16.023
If you actually open up the Docker hub page,

07:18.180 --> 07:20.430
so Docker hub for that Ruby image

07:20.430 --> 07:22.092
we just made use of...

07:22.092 --> 07:22.925
So I'm gonna search for Ruby

07:22.925 --> 07:24.300
and then go to the repository right here.

07:24.300 --> 07:25.133
You'll notice that

07:25.133 --> 07:27.930
there are a ton of other versions available,

07:27.930 --> 07:30.300
some of which are tagged as alpine.

07:30.300 --> 07:31.950
So remember a alpine version

07:31.950 --> 07:33.810
of an image is essentially just saying,

07:33.810 --> 07:35.970
Hey, this is a stripped down version of this image

07:35.970 --> 07:38.520
with just the bare minimum required

07:38.520 --> 07:40.350
to get this thing running.

07:40.350 --> 07:41.370
Now in our case

07:41.370 --> 07:45.240
we had to install a jim that did this extra build step

07:45.240 --> 07:46.073
and like I said

07:46.073 --> 07:49.290
that requires some extra packages to be installed with Ruby.

07:49.290 --> 07:53.070
If we had used the Alpine version of this Ruby image

07:53.070 --> 07:55.770
this step right here would've actually completely failed.

07:55.770 --> 07:57.960
'Cause remember the Alpine version is a hundred

07:57.960 --> 07:59.100
percent stripped down.

07:59.100 --> 08:01.530
And so the Alpine version of the Ruby image does

08:01.530 --> 08:05.640
not have those extra packages required to do this step

08:05.640 --> 08:07.920
of building a native extension.

08:07.920 --> 08:09.690
So if we had used,

08:09.690 --> 08:11.850
I keep scrolling up 'cause I think the command is up there,

08:11.850 --> 08:12.690
but it's not.

08:12.690 --> 08:14.940
If we had used an Alpine version

08:14.940 --> 08:17.490
like say Alpine 2.3 right here

08:17.490 --> 08:19.320
that jim installs step would've failed

08:19.320 --> 08:21.300
because we did not have all the dependencies

08:21.300 --> 08:23.910
required to build this jim.

08:23.910 --> 08:26.280
So this is a great example where the Alpine version

08:26.280 --> 08:28.980
of an image is not always the best solution,

08:28.980 --> 08:30.810
not always the best solution.

08:30.810 --> 08:33.120
Okay, I apologize for that little quick aside,

08:33.120 --> 08:34.290
I just had to mention it.

08:34.290 --> 08:36.720
I felt compelled, like I mentioned.

08:36.720 --> 08:38.049
All right, so it looks

08:38.049 --> 08:40.020
like everything successfully got installed.

08:40.020 --> 08:41.940
So now to make sure everything is set up correctly

08:41.940 --> 08:44.970
I'll do the command Travis like so

08:44.970 --> 08:45.803
it's gonna ask me

08:45.803 --> 08:47.790
if I want to install some shell completion.

08:47.790 --> 08:50.280
This is essentially some autocomplete stuff.

08:50.280 --> 08:51.113
We don't need it

08:51.113 --> 08:53.580
because we're just running like one or two commands here.

08:53.580 --> 08:54.723
So I'll just say no.

08:55.710 --> 08:58.050
And then after that I'll get prompted here

08:58.050 --> 09:00.090
with the list of all the commands that are available

09:00.090 --> 09:02.080
to me tied to the Travis CLI

09:03.090 --> 09:04.690
Okay, so Travis is definitely up

09:05.638 --> 09:07.080
and running successfully without us having to go

09:07.080 --> 09:09.780
through that long process of installing Ruby.

09:09.780 --> 09:11.280
Now let's take a quick pause right here.

09:11.280 --> 09:12.720
We're gonna come back to the next section

09:12.720 --> 09:13.740
and we're gonna continue going

09:13.740 --> 09:15.420
through a couple of other steps.

09:15.420 --> 09:17.783
So quick break and I'll see you in just a minute.
