Giter VIP home page Giter VIP logo

asae-demo's Introduction

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

1. Pre-requisites

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 |

2. Install the Azure CLI extension

Install the Azure Spring Apps extension for the Azure CLI using the following command

az extension add --name spring

3. Prepare your environment for deployments

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

4. Login to Azure

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

5. Create Azure Spring Apps service instance

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}

Create App

az spring app create -n ${APP_NAME} -s ${SPRING_APPS_SERVICE} -g ${RESOURCE_GROUP} --assign-endpoint true

Test hello-world app locally

Perform the below steps to build the app locally

cd hello-world
./mvnw clean install
./mvnw spring-boot:run &
cd ..
curl http://127.0.0.1:8080/hello

Finally, kill running app:

fg
kill %1

Deploy App

az spring app deploy -n ${APP_NAME} --artifact-path ./target/demo-0.0.1-SNAPSHOT.jar -s ${SPRING_APPS_SERVICE} -g ${RESOURCE_GROUP}

Test App

Please add /hello at the end of test endpoint to see the greeting message

Delete App

az spring app delete -n ${APP_NAME} -s ${SPRING_APPS_SERVICE} -g ${RESOURCE_GROUP}

Delete Spring Apps Instance

az spring delete -n ${SPRING_APPS_SERVICE} -g ${RESOURCE_GROUP}

Delete Resource Group

az group delete --name ${RESOURCE_GROUP}

asae-demo's People

Contributors

mnenad avatar murthy-vmware avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.