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.
-
Have Docker Engine installed
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:
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 |
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:
cd <repository-directory>
Command:
docker container cp .\mongobackups\ mongodb:/var/backups/mongobackups
Command:
docker exec -it mongodb bash
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/
We can check the creation of the database by opening the mongo-express
page in the browser with the following address:
http://localhost:8081
http://localhost:8080
To log in we can use the data that appears in the following screenshot: