Skip to content

sbarquero/MyRoutes.Docker

Repository files navigation

MyRoutes.Docker

Translations

Introduction

This project allows to launch the backend and the frontend of the web application MyRouter using Docker containers, in a fast way and with demo data.

Requirements

Steps

Start up

The way to start the application is very simple. First we go to the directory where the docker-compose.yml file is located and then we start the containers.

The commands are:

cd <repository-directory>
docker compose up -d

This will start several containers for us:

Docker containers

Started containers

Containers Description Port Repository link
myroutes.front Aplication Frontend 8080 sbarquero/myroutes.front
myroutes.back API Backend of the app 3000 sbarquero/myroutes.back
mongodb MongoDB Server 27018 mongo
mongo-express Web based MongoDB administration interface 8081 mongo-express

Insertion of the demo data to the database

If it is the first time we start the database will be without content. We can copy a backup that exists in the mongobackups directory.

The steps to follow are:

Change to the directory where docker-compose.yml is

cd <repository-directory>

Copy backup files to the mongodb container

Command:

docker container cp .\mongobackups\ mongodb:/var/backups/mongobackups

Open terminal in mongodb container.

Command:

docker exec -it mongodb bash

Restore backup to database.

In the terminal run the following command:

mongorestore --uri="mongodb://myUserAdmin:Mongo1234@localhost:27017/?authSource=admin&readPreference=primary&directConnection=true&ssl=false" --nsInclude=myroutes.* --drop /var/backups/mongobackups/

Database check

We can check the creation of the database by opening the mongo-express page in the browser with the following address:

http://localhost:8081

Start the web application

http://localhost:8080

To log in we can use the data that appears in the following screenshot:

User login