You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
= Providing access to the database by creating a secret
8
8
9
-
The `nationalparks` application needs information, such as the database name, username, and passwords, on how to access the MongoDB database. However, because this information is sensitive, you should not store it directly in the pod.
9
+
The `nationalparks` application needs information, such as the database name, username, and passwords, to access the MongoDB database. However, because this information is sensitive, you should not store it directly in the pod.
10
10
11
11
You can use a _secret_ to store sensitive information, and share that secret with workloads.
12
12
13
-
`Secret` objects provide a mechanism to hold sensitive information such as passwords, {product-title} client configuration files, private source repository credentials, and so on. Secrets decouple sensitive content from the pods. You can mount secrets into containers by using a volume plugin, or the system can use secrets to perform actions on behalf of a pod.
13
+
`Secret` objects provide a mechanism to hold sensitive information such as passwords, {product-title} client configuration files, and private source repository credentials. Secrets decouple sensitive content from the pods. You can mount secrets into containers by using a volume plugin or by passing the secret in as an environment variable. The system can then use secrets to provide the pod with the sensitive information.
14
14
15
15
The following procedure creates the `nationalparks-mongodb-parameters` secret and mounts it to the `nationalparks` workload.
. From the above output, copy the value in the `HOST/PORT` column. Because the route is a secured route, you must add `https://` in front to get the application URL.
37
+
. From the above output, copy the value in the `HOST/PORT` column.
38
+
39
+
. Add `https://` in front of the copied value to get the application URL. This is necessary because the route is a secured route.
Deploy and connect a MongoDB database where the `national-parks-app` application stores location information.
10
-
Once you mark the `national-parks-app` application as a backend for the map visualization tool, `parksmap` deployment uses the {product-title} discover mechanism to display the map automatically.
9
+
The following procedure deploys `mongodb-nationalparks`, which is a MongoDB database that will hold the national park location information.
11
10
12
11
.Prerequisites
13
12
14
-
* You are logged in to the {product-title} web console.
15
-
* You are in the *Developer* perspective.
16
-
* You have a deployed image.
13
+
* You have deployed the `parksmap` front-end application.
14
+
* You have deployed the `nationalparks` back-end application.
17
15
18
16
.Procedure
19
17
20
-
. From the *+Add* view in the *Developer* perspective, click *Container images* to open a dialog.
21
-
. In the *Image Name* field, enter `quay.io/centos7/mongodb-36-centos7`.
22
-
. In the *Runtime icon* field, search for `mongodb`.
23
-
. Scroll down to the *General* section.
24
-
. Ensure that you have the current values for the following:
25
-
.. Application: `national-parks-app`
26
-
.. Name: `mongodb-nationalparks`
27
-
. Select *Deployment* as the *Resource*.
28
-
. Unselect the checkbox next to *Create route to the application*.
29
-
. In the *Advanced Options* section, click *Deployment* to add environment variables to add the following environment variables:
18
+
. From the *Quick create* (image:fa-plus-circle.png[title="Quick create menu"]) menu in the upper right corner, click *Container images*.
19
+
. Select *Image name from external registry* and enter `registry.redhat.io/rhmap47/mongodb`.
20
+
. In the *Runtime icon* field, search for and select `mongodb`.
21
+
. Scroll to the *General* section.
22
+
. In the *Application name* field, enter `national-parks-app`.
23
+
. In the *Name* field, enter `mongodb-nationalparks`.
24
+
. Scroll to the *Deploy* section.
25
+
. In the *Resource type* field, ensure that *Deployment* is selected.
26
+
. Click *Show advanced Deployment option*.
27
+
. Under *Environment variables (runtime only)*, add the following names and values:
30
28
+
31
29
.Environment variable names and values
32
30
[cols="1,1"]
@@ -38,5 +36,16 @@ Once you mark the `national-parks-app` application as a backend for the map visu
38
36
|`MONGODB_DATABASE`|`mongodb`
39
37
|`MONGODB_ADMIN_PASSWORD`|`mongodb`
40
38
|===
39
+
+
40
+
[TIP]
41
+
====
42
+
Click *Add value* to add each additional environment variable.
43
+
====
44
+
45
+
. In the *Advanced options* section, clear *Create a route*.
46
+
+
47
+
The database application does not need to be accessed externally, so a route is not required.
41
48
42
49
. Click *Create*.
50
+
51
+
You are redirected to the *Topology* page where you can see the `mongodb-nationalparks` deployment in the `national-parks-app` application.
0 commit comments