Instructions needed to run a simple asa-e hello world application.
These instructions are a subset of the instructions at https://github.com/Azure-Samples/acme-fitness-store
In order to deploy a Java app to cloud, you need an Azure subscription. If you do not already have an Azure subscription, you can activate your MSDN subscriber benefits or sign up for a free Azure account.
In addition, you will need the following:
| Azure CLI version 2.17.1 or higher
| Git
| jq
utility
|
Install the Azure Spring Apps extension for the Azure CLI using the following command
az extension add --name spring
cp ./setup-env-variables-template.sh ./setup-env-variables.sh
Open ./setup-env-variables.sh
and update the following information:
export SUBSCRIPTION=subscription-id # replace it with your subscription-id
export RESOURCE_GROUP=resource-group-name # existing resource group or one that will be created in next steps
export SPRING_APPS_SERVICE=azure-spring-apps-name # name of the service that will be created in the next steps
export REGION=region-name # choose a region with Enterprise tier support
export APP_NAME=app-name
Then, set the environment:
source ./setup-env-variables.sh
Login to the Azure CLI and choose your active subscription.
az login
az account list -o table
az account set --subscription ${SUBSCRIPTION}
Accept the legal terms and privacy statements for the Enterprise tier.
az provider register --namespace Microsoft.SaaS
az term accept --publisher vmware-inc --product azure-spring-cloud-vmware-tanzu-2 --plan asa-ent-hr-mtr
Create a resource group to contain your Azure Spring Apps service.
Note: This step can be skipped if using an existing resource group
az group create --name ${RESOURCE_GROUP} \
--location ${REGION}
Create an instance of Azure Spring Apps Enterprise.
az spring create --name ${SPRING_APPS_SERVICE} \
--resource-group ${RESOURCE_GROUP} \
--location ${REGION} \
--sku Enterprise \
--enable-application-configuration-service \
--enable-service-registry \
--enable-gateway \
--enable-api-portal \
--build-pool-size S2
Note: The service instance will take around 10-15 minutes to deploy.
Set your default resource group name and cluster name using the following commands:
az configure --defaults \
group=${RESOURCE_GROUP} \
location=${REGION} \
spring=${SPRING_APPS_SERVICE}
az spring app create -n ${APP_NAME}
Perform the below steps to build the app locally
cd hello-world
./mvnw spring-boot:run &
cd ..
curl http://127.0.0.1:8080/hello
Finally, kill running app:
fg
kill %1
az spring app deploy -n ${APP_NAME} --artifact-path ./jars/demo-0.0.1-SNAPSHOT.jar
Please add /hello at the end of test endpoint to see the greeting message
az spring app delete -n ${APP_NAME}
az spring delete -n ${SPRING_APPS_SERVICE}
az group delete --name ${RESOURCE_GROUP}