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 can deploy an app in a Space, you must:
Follow the steps in Create an application environment using Spaces to create a Space in which to deploy your application.
Set up the Tanzu CLI:
Install the Tanzu CLI app-developer
plug-in group by running:
tanzu plugin install --group vmware-tanzu/app-developer
Log in to Tanzu CLI by running:
tanzu login
Clone the Git repository containing the Where for Dinner?
application:
Clone the the repository by running:
git clone https://github.com/vmware-tanzu/application-accelerator-samples
Go to the repository directory by running:
cd application-accelerator-samples
Check out the wfd-spaces-ga
branch by running:
git checkout wfd-spaces-ga
Go to the directory that contains the application resources by running:
cd where-for-dinner
Where for Dinner?
example application in your SpaceTo deploy the pre-built Where for Dinner
application to the Space:
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
Set your active Space to the Space to use for your deployment by running:
tanzu space use
Deploy all of the application’s resources by running:
tanzu deploy --from-build demo-prebuilt
NoteThe
--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 thewhere-for-dinner
repository instead.
Access the Where for Dinner?
example application in a browser:
Where for Dinner?
application.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.
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.
where-for-dinner-availability
, to view a detailed dashboard with information about application build information, replicas, tags, and bound service instances.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 --
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
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
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
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.