-: In the last video,
we started working on our Scaffold config file.
So we've added in an artifact here.
Remember, that is telling Scaffold
that we want it to manage our client project.
All right, so now the next thing we're going to do,
is go down to the very base layer of indentation here,
so notice how I'm all the way back out.
We're gonna set up a section called Deploy.
We're gonna pass in a couple nested properties here,
so we're gonna say deploy kubectl manifests,
and then we're gonna list out all the different config files
that we want Scaffold to manage for us.
When I say config files,
I'm talking about Kubernetes YAML files.
So essentially, in this case,
we're going to attempt to tell Scaffold
that we want it to manage our multi-client deployment
using the client-deployment YAML file.
So as a array entry right here,
I'll say K8s/client-deployment.yaml.
All right, and that's pretty much it.
So now, anytime we start up Scaffold,
it's going to attempt to apply that config file
to our Kubernetes cluster.
Scaffold simultaneously is going to start watching
our client project directory for changes.
If we make any changes to a JavaScript file, CSS or HTML,
it's going to inject those changed files
into our multi-client pod or container.
One quick thing I wanna mention is that
if we make any changes to a file besides a JavaScript, CSS
or HTML file, then Scaffold is gonna fall back to mode one.
So if we change anything besides CSS, HTML, or JavaScript,
it's going to fall back to just rebuilding that client image
from scratch and using it to update our Kubernetes cluster.
Okay, so that's it for our config,
or just the client deployment.
So I'm now gonna save this file,
then we will do a quick test.
So I'm gonna flip back over to my terminal.
Inside of my complex project directory,
I'm gonna start up Scaffold
by running Scaffold Dev, like so.
All right, there we go.
So you're gonna see that Scaffold's going to immediately
try to build our client image.
It's then going to take that built image and throw it
into our Kubernetes cluster, so you can see
that it created that client deployment right here.
We'll then start to see some logs coming out
of that client image that Scaffold is now,
excuse me, client container that Scaffold is now managing,
let me zoom out here just so we can see those logs
more easily.
And so we can see the message that the React application
has started up successfully in development mode.
We're seeing all this output three times because remember,
our deployment file specifies that we should run
three instances of the client pod.
So now we can flip back over to our browser
and test this out.
I'm going to go to K8smulti.com, remember that is
the host alias I set up on my local machine,
and I'll see the app appear.
And we already really had our application appearing,
so what's different here?
Well remember, anytime we now change a project file,
we should automatically see our React application
get the update.
So to test that out, I'll go back over to my code editor.
In my client directory, I'll find the SRC folder
and then inside there I'll find the app.js file.
Remember, inside of here is that H1 tag
that has that big header at the top,
so I'll just make some change to that text,
I'll say like, "Updated."
So Fib calculator updated.
So I can now save this file.
As soon as I do, I'm gonna change back over to my terminal
and we're going to see how Scaffold responds to that.
So right here it says, "Syncing one file
for Steven Greider multi-client."
So Scaffold has seen that I changed the JavaScript file,
it's gonna take that file and try to inject it
into that multi-client image container.
And we can then see some update messages right here
from those three separate pods
that are running multi-client telling us,
"Hey, all right, we got that update successfully."
The Compiled Successfully message is coming
from Create React app,
so this is essentially Create React app saying,
"Hey, we see a change to a file,
we're going to try to rebuild our client project."
When I say client project,
I'm talking about, like, our client JavaScript code,
not rebuilding an image or anything like that.
So if I now flip back over to my browser,
I'll see Updated appear.
If you do not see the live update right here,
it's totally fine.
I have noticed that Scaffold with injecting stuff
is sometimes a little bit finicky.
You will just about always see the files injected
into the container.
Maybe it's not Scaffold that's finicky,
but rather Create React app is.
So sometimes Create React app
will not automatically update the page.
If it doesn't, just do a manual refresh
and you should then see the update appear.
Okay, so clearly we made a change
and we did not have to rebuild an image manually
or anything like that, we just saw the change appear.
So as you might guess, this is an amazing tool
for local development with Kubernetes,
and there's still a couple more things
I wanna tell you about Scaffold,
so let's take a quick pause right here
and continue in the next video.