Improve Database Documentation
This commit is contained in:
		| @@ -1,52 +1,68 @@ | |||||||
| <p> | <p> | ||||||
|   The used database instance is a MongoDB instance running on the BIC, storing all application data. The admin database |   The used database instance is a MongoDB instance running on the BIC, storing all application data. | ||||||
|   management page can be accessed |   The admin database management page can be accessed <a href="https://definma-db.apps.de1.bosch-iot-cloud.com/api-doc/">here</a>. | ||||||
|   <a href="https://definma-db.apps.de1.bosch-iot-cloud.com/api-doc/"> |   However, it is recommended to use a dedicated MongoDB application for anything apart from a quick look. | ||||||
|     https://definma-db.apps.de1.bosch-iot-cloud.com/api-doc/ |   The two tested applications are <a href="https://www.mongodb.com/products/compass">MongoDB Compass</a> and | ||||||
|   </a>. |   <a href="https://robomongo.org/s">Robo 3T</a> (recommended for trying queries). | ||||||
|   However, it is recommended to use a dedicated MongoDB application for anything apart from a quick look. The two tested | </p> | ||||||
|   applications are <a href="https://www.mongodb.com/products/compass">MongoDB Compass</a> and | <p> | ||||||
|   <a href="https://robomongo.org/s">Robo 3T</a> (recommended for trying queries).<br> |  | ||||||
|   To connect to the BIC instance from your local application follow the |   To connect to the BIC instance from your local application follow the | ||||||
|   <a href="https://inside-docupedia.bosch.com/confluence/display/BICI/MongoDB+Client+Tool+via+SSH+Tunnel">BIC guide</a>. |   <a href="https://inside-docupedia.bosch.com/confluence/display/BICI/MongoDB+Client+Tool+via+SSH+Tunnel">BIC guide</a>. | ||||||
|   <br>TLDR: |   <br> | ||||||
|  |   TL;DR: | ||||||
| </p> | </p> | ||||||
| For the first time: |  | ||||||
|  | <p>For the first time:</p> | ||||||
| <ul> | <ul> | ||||||
|   <li>cf login</li> |   <li>cf login</li> | ||||||
|   <li>cf enable-ssh <app-name, probably definma-api></li> |   <li>cf enable-ssh definma-api</li> | ||||||
|   <li>cf create-service-key <service-name, probably definmadb> <key-name, can be whatever></li> |   <li>cf create-service-key definmadb <key name, can be whatever></li> | ||||||
| </ul> | </ul> | ||||||
| Every time: | <p>Every time:</p> | ||||||
| <ul> | <ul> | ||||||
|   <li>cf ssh -L 1120:st0cvm200118.internal-mongodb.de1.bosch-iot-cloud.com:30000 definma-api</li> |   <li>cf ssh -L 1120:st0cvm200118.internal-mongodb.de1.bosch-iot-cloud.com:30000 definma-api</li> | ||||||
|   <li> |   <li> | ||||||
|     Login into your application with localhost:1120 and use credentials and Authentication Database from the BIC |     Login into your application with localhost:1120 and use credentials and authentication database from the BIC | ||||||
|     (Data can be found at Home > DeFinMa > production > definma-api > Services > dots on the right of definmadb > View Credentials) |     (Data can be found at Home > DeFinMa > production > definma-api > Services > dots on the right of definmadb > View Credentials) | ||||||
|   </li> |   </li> | ||||||
| </ul> | </ul> | ||||||
|  |  | ||||||
| <h6>Backup</h6> | <h4>Backup Instructions</h4> | ||||||
|  |  | ||||||
| <p> | <p> | ||||||
|   For creating a database backup, you must follow the same steps from above (except the last one). Additionally you need |   For creating a database backup, you must follow the same steps from above (except the last one). | ||||||
|   the <a href="https://docs.mongodb.com/database-tools/installation/#install-tools">mongodump</a> installed. |   Additionally you need the <a href="https://www.mongodb.com/try/download/database-tools">MongoDB Tools</a> installed. | ||||||
|   Open the MongoDB bin folder |   Extract the ZIP file to a location on your hard drive and launch a Git Bash in that directory. | ||||||
|   (normally at C:\Program Files\MongoDB\Server\4.2\bin) in a PowerShell and execute following command for backup, | </p> | ||||||
|   adjust parameters and credentials as needed: <br><br> |  | ||||||
|   .\mongodump.exe /port:1120 /db:"6ebe4c5d-0da3-4347-b484-66894dcf3f27" /username:"<username>" | <p>To back up the database from the BIC:</p> | ||||||
|   /password:"<username>" /out:"C:\Path\to\backup\folder"<br><br> | <pre> | ||||||
|   Restoring the database from a backup is done with mongorestore.exe, more information can be found at the | ./mongodump --port 1120 -d <database> -u <username> -p <password> --gzip -o 'C:\path\to\backup\folder' | ||||||
|  | </pre> | ||||||
|  |  | ||||||
|  | <p>To restore the database to the BIC:</p> | ||||||
|  | <pre> | ||||||
|  | ./mongorestore --port 1120 -d <database> -u <username> -p <password> --gzip --drop 'C:\path\to\backup\folder' | ||||||
|  | </pre | ||||||
|  |  | ||||||
|  | <p>To restore the database to your local MongoDB instance:</p> | ||||||
|  | <pre> | ||||||
|  | ./mongorestore -d dfopdb --gzip --drop 'C:\path\to\backup\folder\<database>' | ||||||
|  | </pre> | ||||||
|  |  | ||||||
|  | <p> | ||||||
|  |   More information can be found inside the | ||||||
|   <a href="https://docs.mongodb.com/database-tools/">documentation</a>. <br> |   <a href="https://docs.mongodb.com/database-tools/">documentation</a>. <br> | ||||||
|   The BIC service also creates internal backup, which can be requested to restore, see |   The BIC service also creates an internal backup, which can be requested to restore, see | ||||||
|   <a href="https://inside-docupedia.bosch.com/confluence/pages/viewpage.action?pageId=565402281">MongoDB FAQ</a> |   <a href="https://inside-docupedia.bosch.com/confluence/pages/viewpage.action?pageId=565402281">MongoDB FAQ</a> | ||||||
| </p> | </p> | ||||||
|  |  | ||||||
| <h4>Database model</h4> | <h4>Database Model</h4> | ||||||
|  |  | ||||||
| <app-img-magnifier src="assets/imgs/db_structure_latest.svg" zoom="2" [magnifierSize]="{width: 400, height: 300}" | <app-img-magnifier src="assets/imgs/db_structure_latest.svg" zoom="2" [magnifierSize]="{width: 400, height: 300}" | ||||||
|                    id="db-structure"></app-img-magnifier> |                    id="db-structure"></app-img-magnifier> | ||||||
|  |  | ||||||
| <h4>Field reference</h4> | <h4>Field Reference</h4> | ||||||
|  |  | ||||||
| <rb-table class="field-reference"> | <rb-table class="field-reference"> | ||||||
|   <tr><th>samples</th><th></th><th>Example</th></tr> |   <tr><th>samples</th><th></th><th>Example</th></tr> | ||||||
|   | |||||||
| @@ -5,3 +5,10 @@ | |||||||
| span.name { | span.name { | ||||||
|   font-style: italic; |   font-style: italic; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | pre { | ||||||
|  |   padding: 1rem; | ||||||
|  |   color: #212529; | ||||||
|  |   background: #e6e6e6; | ||||||
|  |   white-space: pre-wrap; | ||||||
|  | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user