2021-10-27 12:56:29 -04:00
// Module included in the following assemblies:
//
2025-03-05 12:04:17 -05:00
// * tutorials/dev-app-cli.adoc
2021-10-27 12:56:29 -04:00
2023-10-30 10:13:25 -04:00
:_mod-docs-content-type: PROCEDURE
2021-10-27 12:56:29 -04:00
[id="getting-started-cli-deploying-python-app_{context}"]
2025-03-05 12:04:17 -05:00
= Deploying the back-end application
2021-10-27 12:56:29 -04:00
2025-12-09 16:38:41 -05:00
[role="_abstract"]
Deploy the back-end application that provides the service that queries the database to return the national park data required for your application.
2025-03-05 12:04:17 -05:00
The following procedure deploys `nationalparks`, which is the back-end component for the `national-parks-app` application. The Python application performs 2D geo-spatial queries against a MongoDB database to locate and return map coordinates of all national parks in the world.
2021-10-27 12:56:29 -04:00
.Prerequisites
2025-03-05 12:04:17 -05:00
* You have deployed the `parksmap` front-end application.
2021-10-27 12:56:29 -04:00
.Procedure
2025-03-05 12:04:17 -05:00
* Create the `nationalparks` back-end application by running the following command:
2021-10-27 12:56:29 -04:00
+
[source,terminal]
----
$ oc new-app python~https://github.com/openshift-roadshow/nationalparks-py.git --name nationalparks -l 'app=national-parks-app,component=nationalparks,role=backend,app.kubernetes.io/part-of=national-parks-app,app.kubernetes.io/name=python' --allow-missing-images=true
----
+
.Example output
[source,text]
----
2025-03-05 12:04:17 -05:00
--> Found image 9531750 (2 weeks old) in image stream "openshift/python" under tag "3.11-ubi8" for "python"
2021-10-27 12:56:29 -04:00
2025-03-05 12:04:17 -05:00
Python 3.11
-----------
...
2021-10-27 12:56:29 -04:00
--> Creating resources with label app=national-parks-app,app.kubernetes.io/name=python,app.kubernetes.io/part-of=national-parks-app,component=nationalparks,role=backend ...
imagestream.image.openshift.io "nationalparks" created
buildconfig.build.openshift.io "nationalparks" created
deployment.apps "nationalparks" created
service "nationalparks" created
--> Success
2025-03-05 12:04:17 -05:00
Build scheduled, use 'oc logs -f buildconfig/nationalparks' to track its progress.
Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:
'oc expose service/nationalparks'
Run 'oc status' to view your app.
2021-10-27 12:56:29 -04:00
----