1
00:00:04,290 --> 00:00:09,300
Before going on with modifications of the Docker compose file and the addition of the Mongo and Mongo

2
00:00:09,300 --> 00:00:10,710
Express services there.

3
00:00:10,740 --> 00:00:17,640
Let me explain to you why we actually require a database in our image gallery project because now it

4
00:00:17,640 --> 00:00:22,710
consists only of two services front end and API without any database.

5
00:00:22,980 --> 00:00:30,870
The moment front end is written in React talks to Flask API service that is written in Python and this

6
00:00:30,900 --> 00:00:37,050
API service requests photos from the Unsplash API using Unsplash authorization key.

7
00:00:37,670 --> 00:00:44,090
Now images are stored in the front end only temporarily, and each time when application in the front

8
00:00:44,090 --> 00:00:47,810
end is reloaded, we start from empty list of images.

9
00:00:47,810 --> 00:00:53,900
There are no images at that moment of time and we want to store actual images, actually information

10
00:00:53,900 --> 00:01:01,340
about those images in the database in such way that after reload of the front end application, some

11
00:01:01,340 --> 00:01:07,910
images that are already present in the database will be retrieved from it via Flask API service to the

12
00:01:07,910 --> 00:01:08,810
front end.

13
00:01:09,110 --> 00:01:16,370
It means that first we want to be able to store images in the MongoDB database and also we want to read

14
00:01:16,370 --> 00:01:19,250
existing records from the MongoDB database.

15
00:01:19,460 --> 00:01:23,660
And all of that will happen through Flask API service.

16
00:01:23,660 --> 00:01:24,950
Not directly.

17
00:01:24,950 --> 00:01:28,370
Front end will not talk directly to the MongoDB database.

18
00:01:28,730 --> 00:01:29,330
Why?

19
00:01:29,330 --> 00:01:32,150
I've chosen MongoDB database for this task.

20
00:01:32,150 --> 00:01:38,520
It is NoSQL database and it is very very easy to use document schema is flexible.

21
00:01:38,520 --> 00:01:46,290
This database is fast and also there are several very nice clients for Python and using such clients,

22
00:01:46,290 --> 00:01:53,640
it is possible to perform all sorts of Crud operations on MongoDB database, but unfortunately MongoDB

23
00:01:53,640 --> 00:01:57,330
database itself doesn't have any graphical user interface.

24
00:01:57,330 --> 00:01:59,580
It has only CLI tool.

25
00:01:59,730 --> 00:02:06,000
And for instance, if you want to test something and insert records directly inside of the MongoDB database

26
00:02:06,000 --> 00:02:11,340
without any external client you could use for that mongo CLI utility.

27
00:02:11,550 --> 00:02:17,100
Also, if you want to read existing records from the MongoDB database, you could use the same Mongo

28
00:02:17,100 --> 00:02:23,850
utility as well, but it's not really convenient to use a command line utility and that's why we will

29
00:02:23,850 --> 00:02:29,580
add another graphical user interface application and with help of such application we will be able to

30
00:02:29,580 --> 00:02:35,880
perform different Crud operations directly on the MongoDB database using GUI web browser application

31
00:02:35,880 --> 00:02:37,740
instead of command line utility.

32
00:02:37,980 --> 00:02:45,600
That's why we will add two additional services to our Docker compose configuration, namely Mongo and

33
00:02:45,600 --> 00:02:46,830
Mongo Express.

34
00:02:47,010 --> 00:02:53,460
Luckily there are already corresponding images available at Docker Hub and we don't require to build

35
00:02:53,460 --> 00:02:58,260
our own services like we did for API and front end service.

36
00:02:58,260 --> 00:03:03,120
That's why addition of those two new services will be pretty straightforward.

37
00:03:03,270 --> 00:03:10,500
Also, please notice that we want to keep data that we will write to the MongoDB database even when

38
00:03:10,500 --> 00:03:14,010
we bring down all containers and afterwards bring them up again.

39
00:03:14,010 --> 00:03:20,220
We want to restore data that was previously stored in the MongoDB database and we will be able to achieve

40
00:03:20,220 --> 00:03:21,840
that with help of volumes.

41
00:03:21,990 --> 00:03:27,600
Please note that integration of the database into the Image Gallery project is out of the scope of this

42
00:03:27,600 --> 00:03:33,480
Docker course and we will stop here after creation of the infrastructure for further development.

43
00:03:33,480 --> 00:03:39,390
But if you want to learn how to build such application with database, with all Crud operations, I

44
00:03:39,390 --> 00:03:42,540
welcome you again to my full Stack Web Development Bootcamp.

45
00:03:42,540 --> 00:03:45,450
All right, that's a review of what we will do next.

46
00:03:45,450 --> 00:03:50,820
And let's get started with addition of Mongo and Mongo Express services into the Docker compose file

47
00:03:50,820 --> 00:03:52,290
after the small pause.

