Skip to content

Angular 8 version of the Spring Petclinic sample application (frontend)

Notifications You must be signed in to change notification settings

selvasingh/spring-petclinic-angular

 
 

Repository files navigation

Deploying Spring Petclinic Angular on Azure Spring Cloud

Angular frontend for Spring Petclinic on Azure Spring Cloud

Warning: client only. Use REST API from backend deployed on Azure Spring Cloud spring-petclinic-rest project. Following steps need to be done before deploying this project

  1. You need to deploy Spring petclinic rest project on Azure Spring Cloud and assign a public end point.
  2. Copy the Assigned end point and modify the code in environment.ts and environment.prod.ts for production deploy.

Build

git clone https://github.com/selvasingh/spring-petclinic-angular.git
cd spring-petclinic-angular
git checkout azure
ng build 

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the -prod flag for a production build.

You can also build the application in a dedicated docker image using the provided Dockerfile as follows:

docker build -t spring-petclinic-angular:latest .

Then you will be able to use it as follows:

docker run --rm -p 1025:1025 spring-petclinic-angular:latest

After running the docker client locally the application should be able to hit the exposed rest end point of the Spring Petclinic Rest project

Screenshot of SPring Petclinic Angular

Publish container image

  1. Install docker
  2. Open a shell and cd to the same directory as this README.
  3. Export a variable with your registry name:
export REGISTRY=myregistry
  1. Run the following Docker commands to build, tag, and publish the image from the httpapi directory:
docker build -t spring-petclinic-angular -f Dockerfile .
docker tag spring-petclinic-angular $REGISTRY/spring-petclinic-angular:latest
docker push $REGISTRY/spring-petclinic-angular:latest

Deploy to Azure Spring Cloud

After building and testing locally with the Dockerfile, you can now deploy the application to Azure Spring Cloud service. Following are the steps needed to deploy to Azure Spring Cloud.

Install the CLI and extensions

Install the Azure CLI to run CLI reference commands.

  • If you're using a local installation, sign in to the Azure CLI by using the az login command. To finish the authentication process, follow the steps displayed in your terminal. For additional sign-in options, see Sign in with the Azure CLI.

  • Run az version to find the version and dependent libraries that are installed. To upgrade to the latest version, run az upgrade.

Install the Azure Spring Cloud extension

Before installing the Azure Spring Cloud CLI extension, please ensure that an older verison of the extension is not installed:

az extension remove -n spring-cloud

Install the latest version of the extension with the following command:

az extension add -n spring-cloud

For more information about extensions, see Use extensions with the Azure CLI.

Create Azure Spring Cloud service instance

Follow Create Azure Spring Cloud service instance to create an Azure Spring Cloud service instance.

Create microservice applications

Create a microservice app.

az spring-cloud app create --name spring-petclinic-angular --instance-count 1 --assign-endpoint true

Deploy Spring Petclinic Angular application

Deploy Spring Petclinic Angular application to Azure.

Important Note: Application must expose 1025 port for Azure Spring Cloud health probing. Check How does Azure Spring Cloud monitor the health status of my application? for details.

az spring-cloud app deploy --name spring-petclinic-angular --container-image spring-petclinic-angular:latest --container-registry $REGISTRY

or (for the private registry)

az spring-cloud app deploy --name spring-petclinic-angular --container-image spring-petclinic-angular:latest --container-registry $REGISTRY --registry-username $USERNAME --registry-password $PASSWORD

And please check Customize container for Azure Spring Cloud for the full CLI commands list.

Congratulations! You've successfully deployed Spring Petclinic Angular to Azure Spring Cloud.

About

Angular 8 version of the Spring Petclinic sample application (frontend)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • TypeScript 67.9%
  • HTML 22.3%
  • CSS 5.1%
  • Less 3.7%
  • Other 1.0%