Merge pull request #46 in DEFINMA/definma-ui from improved-documentation to master

* commit 'fe9a43851d28e605d9e0fc27f63ea658cd189811':
  Improve Database Documentation
This commit is contained in:
Hartenstein Ruben (PEA4-Fe) 2021-01-18 14:00:43 +01:00 committed by Engelbart Kai Sven (PEA4-Fe)
commit a7f4d42834
2 changed files with 50 additions and 27 deletions

View File

@ -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 &lt;app-name, probably definma-api&gt;</li> <li>cf enable-ssh definma-api</li>
<li>cf create-service-key &lt;service-name, probably definmadb&gt; &lt;key-name, can be whatever&gt;</li> <li>cf create-service-key definmadb &lt;key name, can be whatever&gt;</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&gt;DeFinMa&gt;production&gt;definma-api&gt;Services&gt;dots on the right of definmadb&gt;View Credentials) (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> </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:&quot;6ebe4c5d-0da3-4347-b484-66894dcf3f27&quot; /username:&quot;&lt;username&gt;&quot; <p>To back up the database from the BIC:</p>
/password:&quot;&lt;username&gt;&quot; /out:&quot;C:\Path\to\backup\folder&quot;<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 &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> <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>

View File

@ -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;
}