Deploy your first application using Spaces

In the previous 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.

The procedures in this topic deploy a ready-made Where for Dinner? example application into the Space.

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 the 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 the 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 view a detailed dashboard with information about application build information, replicas, tags, and bound service instances.
  5. Click the Service Instances tab to view a list of all the service instances for the application and what they are bound to.
  6. Click the Ingress & Egress tab to view the ingress and egress rules associated with the application.
  7. Click the Network Topology tab for a visualization of the network topology that traffic generates in the application.
  8. Click the Space Configuration tab to view and edit the configuration of the Space.
Using the Tanzu CLI
Do the following to use the Tanzu CLI to install packages in the cluster group:
  1. List all applications deployed to your Space by running:

    tanzu app list
    

    Example output:

    NAME                           CONTENT                             REPLICAS  BINDINGS  BUILT-AT
    where-for-dinner-search        git:f4672da @ 2024-05-10T12:34:21Z  0         db,rmq    --
    where-for-dinner-ui            git:f4672da @ 2024-05-10T12:34:21Z  0         --        --
    where-for-dinner-notify        git:f4672da @ 2024-05-10T12:34:21Z  0         rmq       --
    where-for-dinner-crawler       git:f4672da @ 2024-05-10T12:34:21Z  0         --        --
    where-for-dinner-search-proc   git:f4672da @ 2024-05-10T12:34:21Z  0         rmq       --
    where-for-dinner-availability  git:f4672da @ 2024-05-10T12:34:21Z  0         db,rmq    --
    
  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:
    
    Contact
    
    Source
    Image:       projects.registry.vmware.com/tanzu_application_platform/where-for-dinner/where-for-dinner-crawler@sha256:85cd45991d2319dac4f81df06f1baf4fad30b779cac6377e548e5a5c41db3752
    
    Resources
    cpu:         300m
    memory:      1Gi
    
    Availability Targets
    Name:        all-regions.tanzu.vmware.com
    Replicas:    <not set>
    
    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:

  • 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