WEBVTT

00:00.720 --> 00:02.460
-: Hopefully you've now got Scaffold installed

00:02.460 --> 00:03.720
on your local system.

00:03.720 --> 00:05.610
To make sure that everything is working correctly,

00:05.610 --> 00:08.190
you should be able to run Scaffold version

00:08.190 --> 00:11.520
at the terminal and see a version print up like so.

00:11.520 --> 00:13.230
If you are running a version newer than me,

00:13.230 --> 00:14.640
that's totally fine.

00:14.640 --> 00:17.610
Scaffold has remained relatively unchanged

00:17.610 --> 00:19.140
over a pretty good amount of time.

00:19.140 --> 00:21.240
And to be honest, right before I record this video,

00:21.240 --> 00:24.090
I was actually running version 022

00:24.090 --> 00:25.590
and I went through the process

00:25.590 --> 00:27.360
that we're about to go through for our application

00:27.360 --> 00:29.130
and everything still worked fine.

00:29.130 --> 00:31.740
So it's a relatively stable API.

00:31.740 --> 00:33.930
All right, so now that we've got Scaffold up and running,

00:33.930 --> 00:36.420
we're going to provide some configuration to Scaffold

00:36.420 --> 00:39.090
so that it knows how to handle our project.

00:39.090 --> 00:40.980
As you might guess, this is gonna take the form

00:40.980 --> 00:42.843
of creating a YAML file.

00:43.710 --> 00:45.690
So here's my complex application

00:45.690 --> 00:47.940
open inside of my code editor.

00:47.940 --> 00:49.830
Inside of my root project directory,

00:49.830 --> 00:51.720
I'm gonna create a very special file

00:51.720 --> 00:54.450
to configure how Scaffold works.

00:54.450 --> 00:55.753
So inside of my root project,

00:55.753 --> 00:59.793
I will create a file called Scaffold.yaml, like so.

01:01.980 --> 01:04.350
So we're going to put together a YAML file very similar

01:04.350 --> 01:07.170
to many other that we've put together inside this course.

01:07.170 --> 01:08.610
This file in general is gonna look a lot

01:08.610 --> 01:10.500
like a Docker composed file,

01:10.500 --> 01:13.650
but with a couple extra settings here and there.

01:13.650 --> 01:15.210
I'm going to tell you about all the different

01:15.210 --> 01:17.010
important settings you need to be aware of.

01:17.010 --> 01:17.843
But if you want to,

01:17.843 --> 01:20.310
you can always go back over to the Scaffold page,

01:20.310 --> 01:23.250
check out concepts, tutorials, and references.

01:23.250 --> 01:25.470
If you look at references in particular,

01:25.470 --> 01:28.110
there's a section on Scaffold.yaml,

01:28.110 --> 01:31.230
and it's essentially a annotated YAML file that will appear

01:31.230 --> 01:32.670
and it will tell you about the meaning

01:32.670 --> 01:34.950
of all the different options we can set.

01:34.950 --> 01:36.420
It looks like my browser's having a little bit

01:36.420 --> 01:39.600
of trouble actually, oh, okay, there it is, finally.

01:39.600 --> 01:41.880
Just going a little bit slow here.

01:41.880 --> 01:43.260
Eventually I will see a big list

01:43.260 --> 01:45.090
of all the different, there we go, finally.

01:45.090 --> 01:46.680
So here's all the different configuration

01:46.680 --> 01:49.050
options we can provide, but I'm gonna tell you

01:49.050 --> 01:51.900
all the different options you need to be aware of.

01:51.900 --> 01:53.730
All right, so back inside my code editor,

01:53.730 --> 01:54.660
we're gonna first start off

01:54.660 --> 01:56.490
with a little bit of boiler plate.

01:56.490 --> 02:01.490
So I'll say API version Scaffold/V1beta2, like so.

02:04.350 --> 02:05.940
Notice the capital V on here.

02:05.940 --> 02:07.590
As usual inside of our YAML file,

02:07.590 --> 02:09.570
if you make any typo inside of here,

02:09.570 --> 02:11.673
stuff is not going to work as expected.

02:12.780 --> 02:14.160
Next up we're gonna specify,

02:14.160 --> 02:18.303
specify a kind of config with a capital C, like so.

02:19.890 --> 02:21.960
And then here's where things finally get interesting.

02:21.960 --> 02:24.720
We're gonna specify a section called Build.

02:24.720 --> 02:27.000
So inside of Build, we're going to essentially list out

02:27.000 --> 02:30.120
all the different images or different deployments

02:30.120 --> 02:32.583
that we want Scaffold to manage.

02:33.600 --> 02:34.890
Inside the build section,

02:34.890 --> 02:36.600
the first option we're going to specify

02:36.600 --> 02:38.160
is something called local.

02:38.160 --> 02:40.953
And then inside there we'll do a push of false.

02:42.150 --> 02:44.790
So by default Scaffold, whenever it builds an image

02:44.790 --> 02:47.730
is going to try to push the built image off to,

02:47.730 --> 02:50.400
say Docker hub, or whatever your default

02:50.400 --> 02:52.740
Docker repository is.

02:52.740 --> 02:55.260
For local development, it's extremely likely

02:55.260 --> 02:57.840
that you probably don't want to push these images

02:57.840 --> 03:00.360
off to some hub or repository.

03:00.360 --> 03:02.070
You probably just want to make a change

03:02.070 --> 03:05.010
on your local machine, and test it out yourself.

03:05.010 --> 03:06.870
So you're almost always, in my opinion,

03:06.870 --> 03:08.550
you might have a very different workflow.

03:08.550 --> 03:11.280
You're very likely going to have local push false,

03:11.280 --> 03:14.250
which just means every time that Scaffold builds an image,

03:14.250 --> 03:15.813
we're not gonna do that push.

03:17.160 --> 03:21.390
All right, so next up we're going to define a new image,

03:21.390 --> 03:24.033
or a new container that we want Scaffold to manage.

03:25.980 --> 03:28.380
Scaffold refers to these as artifacts,

03:28.380 --> 03:30.690
so we'll define artifacts, like so.

03:30.690 --> 03:33.480
And this is going to be an array of different images

03:33.480 --> 03:36.300
or essentially containers we want Scaffold to manage.

03:36.300 --> 03:37.950
So I'm gonna put in that little dash right there.

03:37.950 --> 03:40.323
Remember in YAML that indicates an array.

03:42.090 --> 03:43.950
I'll then provide the name of the first image

03:43.950 --> 03:46.170
that I want Scaffold to manage.

03:46.170 --> 03:47.670
So for me, it's going to be

03:47.670 --> 03:51.243
Steven Griter/multidashclient, like so.

03:53.220 --> 03:55.710
After that we're going to specify the folder

03:55.710 --> 03:57.753
where we are building this image from.

03:58.620 --> 04:01.290
So for you and me, it's going to be the client directory.

04:01.290 --> 04:05.130
So I will say context is client.

04:05.130 --> 04:07.740
Remember, context in the world of Docker usually refers

04:07.740 --> 04:10.803
to a folder or something like that.

04:12.120 --> 04:15.240
After that, we are going to tell Scaffold exactly

04:15.240 --> 04:17.400
what Docker file we wanted to use

04:17.400 --> 04:19.500
when building our client image.

04:19.500 --> 04:20.333
So for you and me,

04:20.333 --> 04:23.490
it's going to be that Dockerfile.devfile right here.

04:23.490 --> 04:25.920
Remember that is the Docker file we use

04:25.920 --> 04:27.900
when we are trying to run a React application

04:27.900 --> 04:29.313
in a development mode.

04:30.390 --> 04:35.390
So I will say Docker, Docker file, Docker file.dev.

04:42.330 --> 04:45.330
And then finally, this is the really meaningful option.

04:45.330 --> 04:48.000
Remember I just told you that Scaffold operates

04:48.000 --> 04:49.410
in two separate modes.

04:49.410 --> 04:52.230
It has Mode 1 where anytime it detects a change,

04:52.230 --> 04:53.760
it's going to attempt to rebuild

04:53.760 --> 04:55.530
the entire image from scratch.

04:55.530 --> 04:57.870
And with Mode 2, it's going to just try to take

04:57.870 --> 05:01.560
updated files and eject them into the client pod.

05:01.560 --> 05:03.810
So in the case of our multi-client application,

05:03.810 --> 05:06.960
we want to use Mode number 2 because our client pod,

05:06.960 --> 05:09.840
our React application, is set up to automatically see

05:09.840 --> 05:12.423
changes to files and update itself.

05:13.350 --> 05:16.380
So in order to tell Scaffold to use mode number two

05:16.380 --> 05:19.263
we're gonna set another property here called Sync.

05:20.940 --> 05:23.610
Sync is going to be a listing right here,

05:23.610 --> 05:25.150
so a couple of key value pairs.

05:25.150 --> 05:28.350
We're going to provide file paths right here

05:28.350 --> 05:30.390
that can be kind of glob matchers,

05:30.390 --> 05:32.430
and this is going to tell what files

05:32.430 --> 05:34.440
we want Scaffold to use when attempting

05:34.440 --> 05:36.630
to use mode number two.

05:36.630 --> 05:38.945
So in our case, we're gonna put in here

05:38.945 --> 05:43.803
**/*.js., like so.

05:44.730 --> 05:47.640
So this right here essentially means anytime Scaffold

05:47.640 --> 05:50.250
sees a JavaScript file change,

05:50.250 --> 05:52.500
just take that JavaScript file

05:52.500 --> 05:54.303
and throw it into the container.

05:55.680 --> 05:59.640
We're gonna do that same thing for CSS

05:59.640 --> 06:01.980
and HTML files, as well.

06:01.980 --> 06:03.330
So once again, this section right here

06:03.330 --> 06:06.720
is essentially what enables Mode two of Scaffold.

06:06.720 --> 06:10.350
Anytime it sees a change to a JavaScript file, a CSS file,

06:10.350 --> 06:13.050
or an HTML file, take that updated file

06:13.050 --> 06:16.170
and just inject it into our running pod,

06:16.170 --> 06:17.613
or container in this case.

06:20.160 --> 06:24.090
Okay, so that's kind of part one of our Scaffold.yaml file.

06:24.090 --> 06:26.760
Right now we are telling Scaffold only to manage

06:26.760 --> 06:30.030
our multi-line image, but eventually we will also add in

06:30.030 --> 06:32.310
some instructions on how Scaffold should manage

06:32.310 --> 06:35.073
say our API server, and the worker as well.

06:35.940 --> 06:37.470
All right, so I'm gonna save this file right here.

06:37.470 --> 06:38.820
We're gonna take a quick pause,

06:38.820 --> 06:40.320
and when we come back we're gonna finish off

06:40.320 --> 06:42.420
a little bit more config inside this file.
