简体   繁体   English

如何将 angular/springboot 部署到 azure?

[英]How to deploy angular/springboot to azure?

I have an app that uses angular for the front end and spring boot/postgres for the back.我有一个应用程序使用 angular 作为前端,spring boot/postgres 作为后端。 It all builds to a single jar file.这一切都建立在一个 jar 文件中。 It works fine locally but now I want to deploy it to Azure.它在本地运行良好,但现在我想将它部署到 Azure。 I have googled for hours on this topic but very little out there.我已经在这个主题上搜索了几个小时,但很少。 I can deploy front and back separately but can't find any info on how to connect them.我可以分别部署前后,但找不到有关如何连接它们的任何信息。 The closest thing I can find it this: https://medium.com/@raviraj199602/azure-app-services-deploy-spring-boot-backend-in-azure-cloud-470f28b88864 But it fails to show how the front and back are connected.我能找到的最接近的东西是: https://medium.com/@raviraj199602/azure-app-services-deploy-spring-boot-backend-in-azure-cloud-470f28b88864但它没有显示前面和背部相连。 There must be a simple example somewhere since there are probably thousands of angular/spring apps deployed on azure.一定有一个简单的例子,因为在 azure 上可能部署了数千个 angular/spring 应用程序。 Can someone point me to a good reference?有人可以指点我一个好的参考吗?

Create Angular App创建 Angular 应用程序

  1. Install Node.js https://nodejs.org/en/download/] ( https://nodejs.org/en/download/ )安装 Node.js https://nodejs.org/en/download/] ( https://nodejs.org/en/download/ )
  2. Open Command Prompt > Run npm install -g @angular/cli打开命令提示符 > 运行npm install -g @angular/cli
  3. Create Project ng new AngularAAD创建项目ng new AngularAAD
  4. Go inside folder & Run command ng serve Go 文件夹内 & 运行命令ng serve
  5. Browse the URL http://localhost:4200浏览 URL http://localhost:4200

Build the Angular App using command: ng build –prod Now you should get the dist folder which we need for deployment.使用命令构建 Angular 应用程序: ng build –prod现在您应该获得部署所需的dist文件夹。

Create Azure App Service创建 Azure 应用服务

Go to Azure Portal > App Services > Create New > Choose the version depending on the Node Version. Go 到 Azure 门户 > 应用程序服务 > 新建 > 根据节点版本选择版本。

Run command node to get the version运行命令节点获取版本

Choose OS > Windows > Create button.选择操作系统 > Windows >创建按钮。 In the Index Menu of App Service > Advanced Services (KUDU Console) of the App Service在 App Service 的 Index Menu > App Service 的 Advanced Services (KUDU Console)

在此处输入图像描述

Open Command Prompt > wwwroot folder.打开命令提示符 > wwwroot文件夹。 Copy the dist folder contents to it.dist文件夹内容复制到其中。

在此处输入图像描述

Test Deployment测试部署

From the main page, browse the App Service.从主页,浏览应用服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM