WEBVTT

00:00.350 --> 00:04.900
Now we're going to create the app inside of Heroku.

00:04.910 --> 00:06.980
So it's fairly simple.

00:06.980 --> 00:14.750
You just say new and well, you go into the main page and you say new to create a new app and you give

00:14.750 --> 00:15.290
it a name.

00:15.290 --> 00:22.280
So like Craigslist cars, I will call mine and choose a region.

00:22.310 --> 00:23.780
Choose your United States.

00:23.780 --> 00:32.960
I pick that and then we get some deployment methods created with some deployment method methods.

00:33.260 --> 00:41.870
I will go ahead since we already have a git repository initialized in this which we use git clone from.

00:42.290 --> 00:52.220
I'm going to say I use this git heroku git remote with the Craigslist cars app name so that we create

00:52.220 --> 00:56.930
this remote repository are added to our git repository.

00:57.020 --> 01:04.110
So basically in the terminal, make sure you're on the car scraper folder and paste in this command

01:04.110 --> 01:14.790
with the git remote and the slash A that's going to create this remote Heroku repository or whatever

01:14.790 --> 01:18.150
you call it so we can push something onto Heroku.

01:19.500 --> 01:27.330
And so then, well, we can push to git push Heroku master and.

01:27.970 --> 01:31.090
Dennis should start building onto Heroku.

01:37.590 --> 01:41.940
So the build has succeeded and it's done.

01:42.120 --> 01:44.580
Everything is done and good.

01:44.730 --> 01:48.780
Now we can go ahead, refresh this site.

01:52.560 --> 01:54.270
Inside the overview.

01:55.180 --> 01:58.180
We can see that the build has succeeded.

01:58.480 --> 02:08.020
And if we now we can now go in and add this extra add on to set up some, some sort of scheduling.

02:09.190 --> 02:11.260
So if you go ahead.

02:15.750 --> 02:20.940
Inside of resources and then in here in the resources underneath.

02:21.570 --> 02:27.420
Go ahead and search for scheduler and pick the Heroku scheduler.

02:30.050 --> 02:30.980
And in here?

02:30.980 --> 02:34.820
Well, I only have the free plan, so that's just what I'm going to go with.

02:35.660 --> 02:38.030
And then I'll click on provision.

02:40.040 --> 02:45.290
And then in here you can click on the Heroku scheduler, add on on the link here.

02:46.200 --> 02:54.540
And you're being taken to a next site where you can select, add new job, and then you can enter in

02:54.540 --> 02:57.450
a command that you want to run at this specific interval.

02:57.450 --> 03:03.870
So in my case, it's Node index.js, which I use to start up the script we have in here.

03:04.350 --> 03:07.110
Everything is running from Index.js.

03:08.410 --> 03:12.790
So then I set that up and I said, You can set a frequency.

03:12.790 --> 03:18.430
You can set a daily frequency, a hourly or every ten minutes.

03:18.790 --> 03:24.760
So I'm going to go with every ten minutes for this little test, and then I will say save.

03:27.100 --> 03:31.060
And now it's going to say when the job is next to.

03:31.090 --> 03:34.570
So it says it's next to is 2012.

03:35.370 --> 03:37.200
And that is.

03:38.630 --> 03:40.520
In one minute, I think.

03:41.910 --> 03:45.510
So inside of my database right now.

03:46.800 --> 03:54.360
We have 120 collections, so let me delete all of the collections first so we can see if the scheduler

03:54.360 --> 03:56.340
is actually running this job.

03:59.870 --> 04:06.230
So now all is left is for me to try and wait a little, be a little patient and see if the scheduler

04:06.230 --> 04:08.960
is actually getting the results.

04:11.560 --> 04:17.860
And now I can see that the schedule has run, had a last run at 2012.

04:18.220 --> 04:25.960
And I also could see that it actually had written 120 documents into my M-lab database.

04:26.410 --> 04:30.430
So everything is working as I expected.

04:31.580 --> 04:35.690
And now the next due for this schedule is 2022.

04:35.780 --> 04:39.380
And then I can just wait for a little while for an hour.

04:39.380 --> 04:44.420
And you should see that there's extra cars being written into the database.

04:45.080 --> 04:46.460
So that is it, folks.

04:46.460 --> 04:56.180
That is how you create a new scheduler or create a deployment into Heroku and schedule your scraper

04:56.180 --> 04:58.370
to run at specific intervals.

04:58.700 --> 05:04.640
So I hope you can use this for something and good luck and have fun scraping.
