This section provides all the necessary information to get the Digital Library application up and running on your local machine using Docker.
Before you begin, ensure you have the following installed on your system:
- Docker: Installation Guide
- Docker Compose: Installation Guide (Docker Compose is included with Docker Desktop for Windows and macOS).
-
Clone the Repository: If you haven't already, clone the project repository to your local machine.
-
Navigate to the Project Directory: Open a terminal or command prompt and change your directory to the root of the project folder where the
docker-compose.ymlfile is located.cd path/to/IMSE/Group38_Project_M2 -
Build and Run the Application: Execute the following command to build the Docker images and start all the services (the web application, MariaDB, MongoDB, Adminer, and Mongo Express).
docker-compose up --build
- The
--buildflag ensures that the Docker images are rebuilt if there are any changes to theDockerfileor the application code. - This command will display logs from all running services in your terminal. Wait for the services to initialize. You will see output indicating that the databases are ready and the Flask server has started.
- The
-
Access the Application: Once the containers are running, you can access the different parts of the application via your web browser:
-
Main Web Application: http://localhost:5001
- From the main page, you can initialize the relational database, populate it with data, and then migrate that data to the NoSQL database.
-
Adminer (for MariaDB): http://localhost:8080
- System:
MariaDB - Server:
mariadb_db - Username:
user - Password:
123 - Database:
DigitalLibrary
- System:
-
Mongo Express (for MongoDB): http://localhost:8081
- You can directly access the interface to view and manage the
users,documents,reviews, andborrowing_recordscollections in the NoSQL database.
- You can directly access the interface to view and manage the
-
- Initialize the Database: On the main application page (
http://localhost:5001), click the "Initialize and Populate SQL Database" button. This will create the schema in MariaDB and fill it with sample data. - Migrate to NoSQL: After initialization, click the "Migrate Data & Switch to NoSQL Mode" button. This transfers the data from MariaDB to MongoDB according to the defined NoSQL schema.
- Use the Application: You can now use the features for both "Student 1" (Reader use cases) and "Student 2" (Employee use cases), which will be operating on the MongoDB database.
To stop all the running services, press Ctrl + C in the terminal where docker-compose is running. To remove the containers, you can run:
docker-compose downIf you also want to delete the persistent data volumes (which will delete your databases), use:
docker-compose down -v