In this video we're going to add in some artifact sections for our worker and our server so we can get
some automatic code reload with those two things as well.
So inside of my scaffold Dev file I'm gonna find my artifact section and I'll add in another array entry
as usual please make sure that you've got that dash on the same tab line as the one right above it.
If you indent that thing you're going to very quickly see an error message all right.
So we'll add in an artifact section for how about our server first.
It's all first specify make my image which is going to have a name for me of Steven Greider multi dash
server I think is what we called it.
I was gonna do a quick check here.
Here's my server deployment called it multi server okay.
Very good I'll then specify the context which is essentially just the directory for that.
So in this case server I'll then specify the docker file that I want to use which is going to be darker
file not Dev then we can list out all the different things that we want to have S..
So in this case we're not going to have any assess or HMO files.
We really just have JavaScript files inside of our server.
So I'll do star star star J.S. colon dot like so now we can repeat that same process or worker as well.
So once again add in a dash image of Steven writer multi worker the context is the worker directory
or Docker we want to tell it to use the docker file of Docker file dot dev and once again we only really
want to sync star star star J.S. like so now I want to repeat one more time because this is a little
tricky thing.
The only time that you're going to want this to use this mode to method of sinking files is when your
different sub projects have some ability to detect changes and automatically reload themselves.
So we built that into our server and our worker projects as well.
Remember the darker file dev for each of those starts up those projects using the dev script and that
Dev script runs node 1 which watches for changes in the local project directory.
In this case inside the container and automatically restarts the project.
So if our sub projects hear of server and worker do not make use of newly sync files coming in from
scaffold then it's pointless to try to use scaffold to sync those files instead.
If we don't have that ability we would want scaffold to operate in mode one which is to say automatically
rebuild the entire image.
Anytime we make a change.
All right so now we've added those in.
Let's do a quick test.
It's going to flip back over to my terminal I'll do a scaffold Dev.
Once again and now we're going to see that we are building those three separate images those things
all got deployed.
We'll see some startup information here really quickly.
There's these server running node man.
We probably can also see the worker inside of here as well.
Looks like my server has an air around connecting to post press.
That's really fine.
Kind of outside the realm of what we're doing right now.
And eventually it looks like everything is started up.
It's going to very quickly test this inside of my browser.
I'll do a refresh here and yep still got this running.
Now let's try making a change to our server project and just make sure that the files get sync and that
the server automatically restarts.
So for that I'll find my server index J.S. file and to test out a change maybe.
Let's try to like hard code some value that we're sending back.
So right now notice how values all.
Remember we're trying to get that information coming from post grass.
So rather than sending back some information coming from post guess I'm going to instead comment out
the values line and then send back some hard coded values.
So I'll just say always send one to three like so.
Again I'm just doing this to have some change that we can actually detect inside of application so now
save this file if I flip back over to my terminal I'll see that scaffold has seen that we made a change
and sync that file and then we can see that node man inside of our server pods has automatically restarted
so now we can flip back over to our browser do a refresh and I'll see OK I probably put in the incorrect
format of data.
I think that's probably supposed to be an array of arrays.
So my mistake there.
However if we open up our network request log and we look at all we will see that we did receive an
array of 1 2 3.
So we definitely successfully saw that change sink to our server and the server automatically restarted
all right.
So now last thing we can do once we're all done with development we can't stop scaffold by hitting control
see and all those different deployments and services everything automatically get cleaned up after us.
All right that's it.
That's pretty much scaffold in a nutshell.
Personally I use scaffold on every Cuban 80s project I work on because it makes it incredibly simple
to first off work on different projects on your local machine and it also makes it really easy and straightforward
to do local development environments.
So like work on a react application or an API without having to constantly rebuild all these images
and manually redeploy them every time as well.
All right.
So I hope you enjoy this and we'll take a pause right here.
And that's pretty much it for now.
So a calculator.