2.5. Deploying the back-end application
Deploy the back-end application that provides the service that queries the database to return the national park data required for your application.
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.
Prerequisites
-
You have deployed the
parksmapfront-end application.
Procedure
-
From the Quick create (
) menu in the upper right corner, click Import from Git.
In the Git Repo URL field, enter
https://github.com/openshift-roadshow/nationalparks-py.git.A builder image is automatically detected, but the import strategy defaults to Dockerfile instead of Python.
Change the import strategy:
- Click Edit Import Strategy.
- Select Builder Image.
- Select Python.
- Scroll to the General section.
-
In the Application field, ensure that the value is
national-parks-app. -
In the Name field, enter
nationalparks. - Scroll to the Deploy section.
- In the Resource type field, ensure that Deployment is selected.
In the Advanced options section, ensure that Create a route is selected.
By default, services running on OpenShift Container Platform are not accessible externally. You must select this option to create a route so that external clients can access your service.
Click the Labels hyperlink.
The application code requires certain labels to be set.
Add the following labels to the text area and press Enter after each key/value pair:
-
app=national-parks-app -
component=nationalparks -
role=backend -
type=parksmap-backend
-
Click Create.
You are redirected to the Topology page where you can see the
nationalparksdeployment in thenational-parks-appapplication.
Verification
-
Navigate to Workloads
Topology. -
Click the
nationalparksdeployment in thenational-parks-appapplication. Click the Resources tab.
Wait for the build to complete successfully.