Merge pull request #46 in DEFINMA/definma-ui from improved-documentation to master
* commit 'fe9a43851d28e605d9e0fc27f63ea658cd189811': Improve Database Documentation
This commit is contained in:
		@@ -1,52 +1,68 @@
 | 
			
		||||
<p>
 | 
			
		||||
  The used database instance is a MongoDB instance running on the BIC, storing all application data. The admin database
 | 
			
		||||
  management page can be accessed
 | 
			
		||||
  <a href="https://definma-db.apps.de1.bosch-iot-cloud.com/api-doc/">
 | 
			
		||||
    https://definma-db.apps.de1.bosch-iot-cloud.com/api-doc/
 | 
			
		||||
  </a>.
 | 
			
		||||
  However, it is recommended to use a dedicated MongoDB application for anything apart from a quick look. The two tested
 | 
			
		||||
  applications are <a href="https://www.mongodb.com/products/compass">MongoDB Compass</a> and
 | 
			
		||||
  <a href="https://robomongo.org/s">Robo 3T</a> (recommended for trying queries).<br>
 | 
			
		||||
  The used database instance is a MongoDB instance running on the BIC, storing all application data.
 | 
			
		||||
  The admin database management page can be accessed <a href="https://definma-db.apps.de1.bosch-iot-cloud.com/api-doc/">here</a>.
 | 
			
		||||
  However, it is recommended to use a dedicated MongoDB application for anything apart from a quick look.
 | 
			
		||||
  The two tested applications are <a href="https://www.mongodb.com/products/compass">MongoDB Compass</a> and
 | 
			
		||||
  <a href="https://robomongo.org/s">Robo 3T</a> (recommended for trying queries).
 | 
			
		||||
</p>
 | 
			
		||||
<p>
 | 
			
		||||
  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>.
 | 
			
		||||
  <br>TLDR:
 | 
			
		||||
  <br>
 | 
			
		||||
  TL;DR:
 | 
			
		||||
</p>
 | 
			
		||||
For the first time:
 | 
			
		||||
 | 
			
		||||
<p>For the first time:</p>
 | 
			
		||||
<ul>
 | 
			
		||||
  <li>cf login</li>
 | 
			
		||||
  <li>cf enable-ssh <app-name, probably definma-api></li>
 | 
			
		||||
  <li>cf create-service-key <service-name, probably definmadb> <key-name, can be whatever></li>
 | 
			
		||||
  <li>cf enable-ssh definma-api</li>
 | 
			
		||||
  <li>cf create-service-key definmadb <key name, can be whatever></li>
 | 
			
		||||
</ul>
 | 
			
		||||
Every time:
 | 
			
		||||
<p>Every time:</p>
 | 
			
		||||
<ul>
 | 
			
		||||
  <li>cf ssh -L 1120:st0cvm200118.internal-mongodb.de1.bosch-iot-cloud.com:30000 definma-api</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)
 | 
			
		||||
  </li>
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
<h6>Backup</h6>
 | 
			
		||||
<h4>Backup Instructions</h4>
 | 
			
		||||
 | 
			
		||||
<p>
 | 
			
		||||
  For creating a database backup, you must follow the same steps from above (except the last one). Additionally you need
 | 
			
		||||
  the <a href="https://docs.mongodb.com/database-tools/installation/#install-tools">mongodump</a> installed.
 | 
			
		||||
  Open the MongoDB bin folder
 | 
			
		||||
  (normally at C:\Program Files\MongoDB\Server\4.2\bin) in a PowerShell and execute following command for backup,
 | 
			
		||||
  adjust parameters and credentials as needed: <br><br>
 | 
			
		||||
  .\mongodump.exe /port:1120 /db:"6ebe4c5d-0da3-4347-b484-66894dcf3f27" /username:"<username>"
 | 
			
		||||
  /password:"<username>" /out:"C:\Path\to\backup\folder"<br><br>
 | 
			
		||||
  Restoring the database from a backup is done with mongorestore.exe, more information can be found at the
 | 
			
		||||
  For creating a database backup, you must follow the same steps from above (except the last one).
 | 
			
		||||
  Additionally you need the <a href="https://www.mongodb.com/try/download/database-tools">MongoDB Tools</a> installed.
 | 
			
		||||
  Extract the ZIP file to a location on your hard drive and launch a Git Bash in that directory.
 | 
			
		||||
</p>
 | 
			
		||||
 | 
			
		||||
<p>To back up the database from the BIC:</p>
 | 
			
		||||
<pre>
 | 
			
		||||
./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>
 | 
			
		||||
  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>
 | 
			
		||||
</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}"
 | 
			
		||||
                   id="db-structure"></app-img-magnifier>
 | 
			
		||||
 | 
			
		||||
<h4>Field reference</h4>
 | 
			
		||||
<h4>Field Reference</h4>
 | 
			
		||||
 | 
			
		||||
<rb-table class="field-reference">
 | 
			
		||||
  <tr><th>samples</th><th></th><th>Example</th></tr>
 | 
			
		||||
 
 | 
			
		||||
@@ -5,3 +5,10 @@
 | 
			
		||||
span.name {
 | 
			
		||||
  font-style: italic;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pre {
 | 
			
		||||
  padding: 1rem;
 | 
			
		||||
  color: #212529;
 | 
			
		||||
  background: #e6e6e6;
 | 
			
		||||
  white-space: pre-wrap;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user