3.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 parksmap front-end application.

Procedure

  • Create the nationalparks back-end application by running the following command:

    $ 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

    --> Found image 9531750 (2 weeks old) in image stream "openshift/python" under tag "3.11-ubi8" for "python"
    
        Python 3.11
        -----------
    ...
    
    --> 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
        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.

3.5.1. Exposing the back-end service

To expose the back-end service so that it is accessible externally, create a route.

Prerequisites

  • You have deployed the nationalparks back-end application.
  • You have cluster-admin or project-level admin privileges.

Procedure

  1. Create a route to expose the nationalparks back-end application by running the following command:

    $ oc create route edge nationalparks --service=nationalparks
  2. Label the nationalparks route by running the following command:

    $ oc label route nationalparks type=parksmap-backend

    The application code expects the nationalparks route to be labeled with type=parksmap-backend.

Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동