Deploy your first application using Spaces

This topic tells you how to deploy a ready-made Where for Dinner? example application into a Space on Tanzu Platform for Kubernetes.

In the Create an application environment using Spaces topic, you instantiated a Space from a Profile and selected where the Space should be enabled. The Space is now ready deploy an application.

Before you begin

Before you can deploy an app in a Space, you must:

Clone the application Git repository

Clone the Git repository containing the Where for Dinner? application:

  1. Clone the the repository by running:

    git clone https://github.com/vmware-tanzu/application-accelerator-samples
    
  2. Go to the repository directory by running:

    cd application-accelerator-samples
    
  3. Check out the wfd-spaces-ga branch by running:

    git checkout wfd-spaces-ga
    
  4. Go to the directory that contains the application resources by running:

    cd where-for-dinner
    

Deploy the Where for Dinner? example application in your Space

To deploy the pre-built Where for Dinner application to the Space:

  1. Set your active project to the project you created in Create a Tanzu CLI context for Tanzu Platform and your project by running:

    tanzu project use
    
  2. Set your active Space to the Space to use for your deployment by running:

    tanzu space use
    
  3. Deploy all of the application’s resources by running:

    tanzu deploy --from-build demo-prebuilt
    
    Note

    The --from-build flag is used to reference prebuilt container images. If you do not pass the --from-build flag then you build new container images for each microservice (ContainerApp) in the where-for-dinner repository instead.

  4. Access the Where for Dinner? example application in a browser:

    1. In Tanzu Platform hub, scroll down to Application Engine in the left navigation.
    2. Click Application Spaces > Spaces.
    3. Click the name of the Space to which you deployed the Where for Dinner? application.
    4. Click the Space URL.

    The topology graph for the application uses the service mesh components to generate the topology. This requires traffic to be generated within the application for the full application topology to appear.

View the application

To view the Where for Dinner? example application and information about the application and Space you can use Tanzu Platform hub or the Tanzu CLI.

Using Tanzu Platform hub
Do the following in Tanzu Platform hub:
  1. In Tanzu Platform hub, go to Application Spaces > Spaces.
  2. Click the name of the Space in which you deployed the application.
  3. Click the Applications tab to view a table of the application components.
  4. Click any application component, such as where-for-dinner-availability, to open a detailed page with information about the status, application build information, running application instances, environment variables, requested resources, and bound services.
  5. Click the Services tab to view a list of all the services for the application and what they are bound to.
  6. Click the Ingress tab to view the ingress rules associated with the application.
  7. Click the Egress tab to view the egress rules associated with the application.
  8. Click the Network Topology tab for a visualization of the network topology that traffic generates in the application.
  9. Click the Space Configuration tab to view and edit the configuration of the Space.
Using the Tanzu CLI
To use the Tanzu CLI to see more details about your application:
  1. List all applications deployed to your Space by running:

    tanzu app list
    

    Example output:

    NAME                           CONTENT                             INSTANCES(RUNNING/REQUESTED)  BINDINGS(BOUND/REQUESTED)  STATUS
    where-for-dinner-search        git:f4672da @ 2024-05-10T12:34:21Z  1/(not requested)*            2/2                        Running
    where-for-dinner-ui            git:f4672da @ 2024-05-10T12:34:21Z  1/(not requested)*            0/0                        Running
    where-for-dinner-notify        git:f4672da @ 2024-05-10T12:34:21Z  1/(not requested)*            1/1                        Running
    where-for-dinner-crawler       git:f4672da @ 2024-05-10T12:34:21Z  1/(not requested)*            0/0                        Running
    where-for-dinner-search-proc   git:f4672da @ 2024-05-10T12:34:21Z  1/(not requested)*            1/1                        Running
    where-for-dinner-availability  git:f4672da @ 2024-05-10T12:34:21Z  1/(not requested)*            2/2                        Running
    
  2. Get details about a specific application deployed to your Space by running:

    tanzu app get where-for-dinner-crawler
    

    Example output:

    Overview
     Name:           where-for-dinner-crawler
     Description:    <empty>
     Status:         Running
     Ports:          <empty>
    
    App Details
     Summary:     git:f4672da @ 2024-05-10T12:34:21Z
     Built At:    2024-05-10T12:34:21Z
     Image:       projects.registry.vmware.com/tanzu_application_platform/where-for-dinner/where-for-dinner-crawler@sha256:85cd45991d2319dac4f81df06f1baf4fad30b779cac6377e548e5a5c41db3752
     Git:         github.com/vmware-tanzu/application-accelerator-samples.git@8f364e93a29eeb9d17e5682119de617b9fde32f0
     Version:     20240717.1459.59814
    
    Contact
    
    Resources
     RESOURCE  PER-APP-INSTANCE  TOTAL(CONSUMED)
     cpu       300m              600m
     memory    1Gi               2Gi
    
    Availability Targets
     Name:        all-regions.tanzu.vmware.com
    
    App instances
     Requested instances:    not set (2 running)*
    
    Configuration
     Environment Variables:  JAVA_TOOL_OPTIONS=-Dmanagement.endpoint.health.probes.add-additional-paths=true -Dmanagement.health.probes.enabled=true -Dserver.port=8080
    
  3. List all services in your Space by running:

    tanzu service list
    

    Example output:

    In space:
    
    NAME                                       CONNECTOR  BINDING TYPE  BOUND TO
    MySQLInstance/where-for-dinner-mysql       main       mysql         2 apps
    RabbitmqCluster/where-for-dinner-rabbitmq  main       rabbitmq      4 apps
    
  4. Get details about a specific service in your Space by running:

    tanzu service get MySQLInstance/where-for-dinner-mysql
    

    Example output:

    Name: MySQLInstance/where-for-dinner-mysql
    
    Binding Connectors:
    main:
       Type: mysql
    
    MySQLInstance type spec:
    KEY                    VALUE
    compositeDeletePolicy  Background
    storageGB              1
    
    Bound Apps:
    NAME                                        CONNECTOR  ALIAS
    ContainerApp/where-for-dinner-search        main       db
    ContainerApp/where-for-dinner-availability  main       db
    

What you can do now

You can now:

  • Learn more about the ContainerApp:

    Learn more about the ContainerApp by reading What is a ContainerApp?.

  • Increase application resilience:

    Deploying an application to a single Availability Target and replica doesn’t provide production-level resilience to failures. You can add redundancy to your application by increasing replicas or spanning across regions. For more information, see increasing application resilience.

  • Clean up the environment:

    If you want to stop here, you can clean up the environment by following the steps in Cleaning up the application environment resources.

check-circle-line exclamation-circle-line close-line
Scroll to top icon