Improve Database Documentation

This commit is contained in:
Kai S. K. Engelbart 2021-01-18 13:53:23 +01:00
parent bdce691210
commit fe9a43851d
2 changed files with 50 additions and 27 deletions

View File

@ -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 &lt;app-name, probably definma-api&gt;</li>
<li>cf create-service-key &lt;service-name, probably definmadb&gt; &lt;key-name, can be whatever&gt;</li>
<li>cf enable-ssh definma-api</li>
<li>cf create-service-key definmadb &lt;key name, can be whatever&gt;</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 &gt; DeFinMa &gt; production &gt; definma-api &gt; Services &gt; dots on the right of definmadb &gt; 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:&quot;6ebe4c5d-0da3-4347-b484-66894dcf3f27&quot; /username:&quot;&lt;username&gt;&quot;
/password:&quot;&lt;username&gt;&quot; /out:&quot;C:\Path\to\backup\folder&quot;<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 &lt;database&gt; -u &lt;username&gt; -p &lt;password&gt; --gzip -o 'C:\path\to\backup\folder'
</pre>
<p>To restore the database to the BIC:</p>
<pre>
./mongorestore --port 1120 -d &lt;database&gt; -u &lt;username&gt; -p &lt;password&gt; --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\&lt;database&gt;'
</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>

View File

@ -5,3 +5,10 @@
span.name {
font-style: italic;
}
pre {
padding: 1rem;
color: #212529;
background: #e6e6e6;
white-space: pre-wrap;
}