-
-
Notifications
You must be signed in to change notification settings - Fork 202
Demo Database
- Download and install MongoDB Command Line Database Tools.
- On Windows, add MongoDB Command Line Database Tools folder to
Path
environment variable. - Download bookcars-db.zip down to your machine, unzip it and go to the unzipped folder from a terminal.
- Restore BookCars demo db by using the following command:
mongorestore --verbose --drop --gzip --host=127.0.0.1 --port=27017 --username=admin --password=$PASSWORD --authenticationDatabase=admin --nsInclude="bookcars.*" --archive=bookcars.gz
Replace $PASSWORD with your MongoDB password.
If you are using MongoDB Atlas, put your MongoDB Atlas URI in --uri=
command line argument:
mongorestore --verbose --drop --gzip --uri="mongodb://admin:$PASSWORD@127.0.0.1:27017/bookcars?authSource=admin&appName=bookcars" --nsInclude="bookcars.*" --nsFrom="bookcars.*" --nsTo="bookcars.*" --archive=bookcars.gz
Copy the content of cdn
folder on your web server so that the files will be accessible through http://localhost/cdn/bookcars/
cdn
folder contains the following folders:
-
users
: This folder contains users’ avatars and suppliers’ images. -
cars
: This folder contains cars’ images. -
temp
: This folder contains temporay files.
If you want to run BookCars from the source code or install it on Windows or Linux without using Docker, proceed as follow:
-
On Windows, install IIS and copy the content of
cdn
folder inC:\inetpub\wwwroot\cdn\bookcars
. Finally, add full access permissions to the user who is running BookCars API onC:\inetpub\wwwroot\cdn\bookcars
. -
On Linux, install NGINX and copy content of
cdn
folder in/var/www/cdn/bookcars
. Then, update/etc/nginx/sites-enabled/default
as follows:
server {
listen 80 default_server;
server_name _;
...
location /cdn {
alias /var/www/cdn;
}
}
Finally, add full access permissions to the user who is running BookCars API on /var/www/cdn/bookcars
.
Backend credentials:
-
Username: admin@bookcars.ma
-
Password: B00kC4r5
Frontend and mobile app credentials:
-
Username: jdoe@bookcars.ma
-
Password: B00kC4r5
To restore BookCars demo database in Docker containers, proceed as follow:
-
Make sure that the ports 80, 3001, 4002 and 27017 are not used by any application.
-
Download and install MongoDB Command Line Database Tools on your local machine.
-
Add MongoDB Command Line Database Tools folder to
Path
environment variable in your local machine. -
Download bookcars-db.zip down to your local machine and unzip it.
-
Run the compose:
docker compose up
-
Go to bookcars-db folder and restore the demo database with the following command:
mongorestore --verbose --drop --gzip --host=127.0.0.1 --port=27017 --username=admin --password=$PASSWORD --authenticationDatabase=admin --nsInclude="bookcars.*" --archive=bookcars.gz
Replace
$PASSWORD
with your MongoDB password set in your docker-compose.yml -
Get API Docker container name with the following command:
The name should be something like this:docker container ls
src-api-1
-
Go to bookcars-db/cdn folder and copy the content of the folder in API container with the following commands:
Replacedocker cp ./cdn/users src-api-1:/var/www/cdn/bookcars docker cp ./cdn/cars src-api-1:/var/www/cdn/bookcars
src-api-1
with your API container name. -
Go to the backend http://localhost:3001 and login with the following credentials:
Username: admin@bookcars.ma
Password: B00kC4r5 -
Go to the frontend http://localhost and login with the following credentials:
Username: jdoe@bookcars.ma
Password: B00kC4r5
Copyright © 2024 Akram El Assas. All rights reserved.