-: Hopefully you've now got Scaffold installed
on your local system.
To make sure that everything is working correctly,
you should be able to run Scaffold version
at the terminal and see a version print up like so.
If you are running a version newer than me,
that's totally fine.
Scaffold has remained relatively unchanged
over a pretty good amount of time.
And to be honest, right before I record this video,
I was actually running version 022
and I went through the process
that we're about to go through for our application
and everything still worked fine.
So it's a relatively stable API.
All right, so now that we've got Scaffold up and running,
we're going to provide some configuration to Scaffold
so that it knows how to handle our project.
As you might guess, this is gonna take the form
of creating a YAML file.
So here's my complex application
open inside of my code editor.
Inside of my root project directory,
I'm gonna create a very special file
to configure how Scaffold works.
So inside of my root project,
I will create a file called Scaffold.yaml, like so.
So we're going to put together a YAML file very similar
to many other that we've put together inside this course.
This file in general is gonna look a lot
like a Docker composed file,
but with a couple extra settings here and there.
I'm going to tell you about all the different
important settings you need to be aware of.
But if you want to,
you can always go back over to the Scaffold page,
check out concepts, tutorials, and references.
If you look at references in particular,
there's a section on Scaffold.yaml,
and it's essentially a annotated YAML file that will appear
and it will tell you about the meaning
of all the different options we can set.
It looks like my browser's having a little bit
of trouble actually, oh, okay, there it is, finally.
Just going a little bit slow here.
Eventually I will see a big list
of all the different, there we go, finally.
So here's all the different configuration
options we can provide, but I'm gonna tell you
all the different options you need to be aware of.
All right, so back inside my code editor,
we're gonna first start off
with a little bit of boiler plate.
So I'll say API version Scaffold/V1beta2, like so.
Notice the capital V on here.
As usual inside of our YAML file,
if you make any typo inside of here,
stuff is not going to work as expected.
Next up we're gonna specify,
specify a kind of config with a capital C, like so.
And then here's where things finally get interesting.
We're gonna specify a section called Build.
So inside of Build, we're going to essentially list out
all the different images or different deployments
that we want Scaffold to manage.
Inside the build section,
the first option we're going to specify
is something called local.
And then inside there we'll do a push of false.
So by default Scaffold, whenever it builds an image
is going to try to push the built image off to,
say Docker hub, or whatever your default
Docker repository is.
For local development, it's extremely likely
that you probably don't want to push these images
off to some hub or repository.
You probably just want to make a change
on your local machine, and test it out yourself.
So you're almost always, in my opinion,
you might have a very different workflow.
You're very likely going to have local push false,
which just means every time that Scaffold builds an image,
we're not gonna do that push.
All right, so next up we're going to define a new image,
or a new container that we want Scaffold to manage.
Scaffold refers to these as artifacts,
so we'll define artifacts, like so.
And this is going to be an array of different images
or essentially containers we want Scaffold to manage.
So I'm gonna put in that little dash right there.
Remember in YAML that indicates an array.
I'll then provide the name of the first image
that I want Scaffold to manage.
So for me, it's going to be
Steven Griter/multidashclient, like so.
After that we're going to specify the folder
where we are building this image from.
So for you and me, it's going to be the client directory.
So I will say context is client.
Remember, context in the world of Docker usually refers
to a folder or something like that.
After that, we are going to tell Scaffold exactly
what Docker file we wanted to use
when building our client image.
So for you and me,
it's going to be that Dockerfile.devfile right here.
Remember that is the Docker file we use
when we are trying to run a React application
in a development mode.
So I will say Docker, Docker file, Docker file.dev.
And then finally, this is the really meaningful option.
Remember I just told you that Scaffold operates
in two separate modes.
It has Mode 1 where anytime it detects a change,
it's going to attempt to rebuild
the entire image from scratch.
And with Mode 2, it's going to just try to take
updated files and eject them into the client pod.
So in the case of our multi-client application,
we want to use Mode number 2 because our client pod,
our React application, is set up to automatically see
changes to files and update itself.
So in order to tell Scaffold to use mode number two
we're gonna set another property here called Sync.
Sync is going to be a listing right here,
so a couple of key value pairs.
We're going to provide file paths right here
that can be kind of glob matchers,
and this is going to tell what files
we want Scaffold to use when attempting
to use mode number two.
So in our case, we're gonna put in here
**/*.js., like so.
So this right here essentially means anytime Scaffold
sees a JavaScript file change,
just take that JavaScript file
and throw it into the container.
We're gonna do that same thing for CSS
and HTML files, as well.
So once again, this section right here
is essentially what enables Mode two of Scaffold.
Anytime it sees a change to a JavaScript file, a CSS file,
or an HTML file, take that updated file
and just inject it into our running pod,
or container in this case.
Okay, so that's kind of part one of our Scaffold.yaml file.
Right now we are telling Scaffold only to manage
our multi-line image, but eventually we will also add in
some instructions on how Scaffold should manage
say our API server, and the worker as well.
All right, so I'm gonna save this file right here.
We're gonna take a quick pause,
and when we come back we're gonna finish off
a little bit more config inside this file.