1
00:00:00,790 --> 00:00:05,560
In this video we're going to add in some artifact sections for our worker and our server so we can get

2
00:00:05,560 --> 00:00:09,010
some automatic code reload with those two things as well.

3
00:00:09,160 --> 00:00:15,010
So inside of my scaffold Dev file I'm gonna find my artifact section and I'll add in another array entry

4
00:00:15,760 --> 00:00:21,240
as usual please make sure that you've got that dash on the same tab line as the one right above it.

5
00:00:21,430 --> 00:00:25,910
If you indent that thing you're going to very quickly see an error message all right.

6
00:00:25,910 --> 00:00:30,090
So we'll add in an artifact section for how about our server first.

7
00:00:30,140 --> 00:00:36,860
It's all first specify make my image which is going to have a name for me of Steven Greider multi dash

8
00:00:37,010 --> 00:00:38,460
server I think is what we called it.

9
00:00:38,480 --> 00:00:39,920
I was gonna do a quick check here.

10
00:00:39,950 --> 00:00:44,670
Here's my server deployment called it multi server okay.

11
00:00:44,670 --> 00:00:50,120
Very good I'll then specify the context which is essentially just the directory for that.

12
00:00:50,140 --> 00:00:56,620
So in this case server I'll then specify the docker file that I want to use which is going to be darker

13
00:00:56,620 --> 00:01:02,750
file not Dev then we can list out all the different things that we want to have S..

14
00:01:02,810 --> 00:01:06,500
So in this case we're not going to have any assess or HMO files.

15
00:01:06,500 --> 00:01:09,390
We really just have JavaScript files inside of our server.

16
00:01:09,440 --> 00:01:18,320
So I'll do star star star J.S. colon dot like so now we can repeat that same process or worker as well.

17
00:01:19,370 --> 00:01:28,060
So once again add in a dash image of Steven writer multi worker the context is the worker directory

18
00:01:29,820 --> 00:01:37,780
or Docker we want to tell it to use the docker file of Docker file dot dev and once again we only really

19
00:01:37,780 --> 00:01:46,720
want to sync star star star J.S. like so now I want to repeat one more time because this is a little

20
00:01:46,720 --> 00:01:47,950
tricky thing.

21
00:01:47,980 --> 00:01:53,370
The only time that you're going to want this to use this mode to method of sinking files is when your

22
00:01:53,380 --> 00:01:59,340
different sub projects have some ability to detect changes and automatically reload themselves.

23
00:01:59,350 --> 00:02:03,190
So we built that into our server and our worker projects as well.

24
00:02:03,250 --> 00:02:11,050
Remember the darker file dev for each of those starts up those projects using the dev script and that

25
00:02:11,050 --> 00:02:15,310
Dev script runs node 1 which watches for changes in the local project directory.

26
00:02:15,310 --> 00:02:19,650
In this case inside the container and automatically restarts the project.

27
00:02:19,750 --> 00:02:25,600
So if our sub projects hear of server and worker do not make use of newly sync files coming in from

28
00:02:25,600 --> 00:02:29,640
scaffold then it's pointless to try to use scaffold to sync those files instead.

29
00:02:29,680 --> 00:02:35,170
If we don't have that ability we would want scaffold to operate in mode one which is to say automatically

30
00:02:35,200 --> 00:02:36,640
rebuild the entire image.

31
00:02:36,730 --> 00:02:40,050
Anytime we make a change.

32
00:02:40,280 --> 00:02:41,590
All right so now we've added those in.

33
00:02:41,660 --> 00:02:43,230
Let's do a quick test.

34
00:02:43,240 --> 00:02:47,700
It's going to flip back over to my terminal I'll do a scaffold Dev.

35
00:02:47,700 --> 00:02:55,440
Once again and now we're going to see that we are building those three separate images those things

36
00:02:55,470 --> 00:02:56,310
all got deployed.

37
00:02:56,310 --> 00:02:58,910
We'll see some startup information here really quickly.

38
00:02:58,920 --> 00:03:01,260
There's these server running node man.

39
00:03:01,290 --> 00:03:04,350
We probably can also see the worker inside of here as well.

40
00:03:04,350 --> 00:03:07,580
Looks like my server has an air around connecting to post press.

41
00:03:07,680 --> 00:03:08,400
That's really fine.

42
00:03:08,400 --> 00:03:10,610
Kind of outside the realm of what we're doing right now.

43
00:03:10,800 --> 00:03:12,820
And eventually it looks like everything is started up.

44
00:03:13,750 --> 00:03:17,110
It's going to very quickly test this inside of my browser.

45
00:03:17,110 --> 00:03:21,230
I'll do a refresh here and yep still got this running.

46
00:03:21,270 --> 00:03:26,160
Now let's try making a change to our server project and just make sure that the files get sync and that

47
00:03:26,160 --> 00:03:28,830
the server automatically restarts.

48
00:03:28,830 --> 00:03:35,910
So for that I'll find my server index J.S. file and to test out a change maybe.

49
00:03:36,160 --> 00:03:40,360
Let's try to like hard code some value that we're sending back.

50
00:03:40,380 --> 00:03:42,410
So right now notice how values all.

51
00:03:42,460 --> 00:03:45,460
Remember we're trying to get that information coming from post grass.

52
00:03:45,700 --> 00:03:52,300
So rather than sending back some information coming from post guess I'm going to instead comment out

53
00:03:52,300 --> 00:03:56,170
the values line and then send back some hard coded values.

54
00:03:56,170 --> 00:03:59,420
So I'll just say always send one to three like so.

55
00:03:59,710 --> 00:04:04,950
Again I'm just doing this to have some change that we can actually detect inside of application so now

56
00:04:04,950 --> 00:04:12,370
save this file if I flip back over to my terminal I'll see that scaffold has seen that we made a change

57
00:04:12,460 --> 00:04:18,550
and sync that file and then we can see that node man inside of our server pods has automatically restarted

58
00:04:19,640 --> 00:04:25,390
so now we can flip back over to our browser do a refresh and I'll see OK I probably put in the incorrect

59
00:04:25,390 --> 00:04:26,110
format of data.

60
00:04:26,140 --> 00:04:28,500
I think that's probably supposed to be an array of arrays.

61
00:04:28,540 --> 00:04:29,770
So my mistake there.

62
00:04:29,770 --> 00:04:35,440
However if we open up our network request log and we look at all we will see that we did receive an

63
00:04:35,440 --> 00:04:36,890
array of 1 2 3.

64
00:04:36,910 --> 00:04:42,100
So we definitely successfully saw that change sink to our server and the server automatically restarted

65
00:04:43,350 --> 00:04:43,700
all right.

66
00:04:44,030 --> 00:04:48,720
So now last thing we can do once we're all done with development we can't stop scaffold by hitting control

67
00:04:48,720 --> 00:04:57,040
see and all those different deployments and services everything automatically get cleaned up after us.

68
00:04:57,090 --> 00:04:57,810
All right that's it.

69
00:04:57,840 --> 00:05:00,300
That's pretty much scaffold in a nutshell.

70
00:05:00,300 --> 00:05:05,490
Personally I use scaffold on every Cuban 80s project I work on because it makes it incredibly simple

71
00:05:05,490 --> 00:05:11,460
to first off work on different projects on your local machine and it also makes it really easy and straightforward

72
00:05:11,610 --> 00:05:13,330
to do local development environments.

73
00:05:13,330 --> 00:05:19,170
So like work on a react application or an API without having to constantly rebuild all these images

74
00:05:19,200 --> 00:05:22,520
and manually redeploy them every time as well.

75
00:05:22,530 --> 00:05:22,740
All right.

76
00:05:22,740 --> 00:05:25,570
So I hope you enjoy this and we'll take a pause right here.

77
00:05:25,620 --> 00:05:27,200
And that's pretty much it for now.

78
00:05:27,200 --> 00:05:28,080
So a calculator.
