SteeltoeOSS / MainSite

This repository is used for building the steeltoe.io website, along with the Getting Started guides. The docs portion is in the Documentation repository.
https://steeltoe.io
Apache License 2.0
8 stars 6 forks source link

Error Publishing Steeltoe Web App to Azure Spring App Service #115

Closed kzawad1 closed 2 years ago

kzawad1 commented 2 years ago

Describe the bug

Following example located on Steeltoe website under the Steeltoe Workshop to create a Steeltoe project: https://docs.steeltoe.io/guides/get-to-know-steeltoe/index.html

Now, I want to publish this simple project to Azure Spring Apps, but running an issue doing it.

Steps to reproduce

Steps to reproduce the behavior:

  1. From Visual Studio 2022 select Build -> Publish SteeltoeWebApplication
  2. The remaining steps are shown in the PDF: Steeltoe_Publish_App_to_Azure.pdf

Expected behavior

Should be able to follow the dialog and publish the application.

How do I exactly publish one of these Apps to the Azure Springs Apps service that I have setup in the cloud?

Environment (please complete the following information, if applicable):

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context or links

Add any other context about the problem here.

TimHess commented 2 years ago

Hi @kzawad1, that functionality is owned by Microsoft, unfortunately the Steeltoe team does not have any visibility into what might be going wrong there.

TimHess commented 2 years ago

@timheuer what would be the best way to get this issue addressed?

kzawad1 commented 2 years ago

@TimHess is there a way to publish this App to Azure Spring App Enterprise Tier without using Visual Studio? Maybe command line?

I don't see anyway to do it directly on Azure portal because it does not allow me to point to local source code when creating an app. So far the only resource I was able to find is this: https://www.youtube.com/watch?v=_RGvAQXz4-Q . However, the workshop tool is Visual Studio and not Visual Studio Code. The video shows VSCode & shows how to modify the CSPROJ file which VS does not like next time I go to open it. They also show that they upload a ZIP file with build output.

TimHess commented 2 years ago

@kzawad1 It's been a while since I've worked on this, but we do have this sample that did work well in that environment before that might be a useful reference

kzawad1 commented 2 years ago

@TimHess , I reported the Visual Studio publish issue to that team & here is the link: https://developercommunity.visualstudio.com/t/Unable-to-publish-app-to-Azure-Spring-Cl/10140586.

There is some documentation here that shows how to upload the App using AWS CLI here: https://docs.microsoft.com/en-us/azure/spring-apps/quickstart-deploy-apps?tabs=Azure-CLI&pivots=programming-language-csharp

To build on the Steeltoe Workshop and the WeatherForecast example I had to do the following:

  1. Update SteeltoeWebApplication.csproj with (with Visual Studio closed using text editor):

    <Target Name="Build-Zip" AfterTargets="Build">
    <ZipDirectory SourceDirectory="$(OutputPath)" DestinationFile="$(MSBuildProjectDirectory)/steeltoe-web-app.zip" Overwrite="true" />
    </Target>
    
    <Target Name="Publish-Zip" AfterTargets="Publish">
    <ZipDirectory SourceDirectory="$(PublishDir)" DestinationFile="$(MSBuildProjectDirectory)/steeltoe-web-app.zip" Overwrite="true" />
    </Target>
  2. Open Visual Studio and build the application to produce the ZIP file.
  3. Open command prompt and navigate the project folder.
  4. Run the following Azure CLI command to upload the app: az spring app deploy -g asaeSandbox -s asae-enfuse-sandbox -n weatherforecast --disable-validation --main-entry SteeltoeWebApplication.dll --artifact-path ./steeltoe-web-app.zip
  5. The output of the command prompt will display details on what is happening.
  6. Afterwards, check the logs on Azure for errors.

There is two questions I have:

  1. There is a predisposition for Azure Spring App to want a Java JAR file and it will fail the deploy step if "disable-validation" is not included in the command. Why is that? Is this something that can be correct? Who would I need to contact to change this, so Azure knows it can take Java JAR or C# DLL/EXE Do not find any class or jar file, please check if your artifact is a valid fat jar, if you choose to ignore these errors, turn validation off with --disable-validation
  2. Why do I need to specify a "main-entry" in the command line and why does that main entry need to be a DLL versus a EXE?
kzawad1 commented 2 years ago

Switch from using guide "Quickstart: Build and deploy apps to Azure Spring Apps": https://docs.microsoft.com/en-us/azure/spring-apps/quickstart-deploy-apps?tabs=Azure-CLI&pivots=programming-language-csharp

To using "Introduction to the Fitness Store sample app": https://docs.microsoft.com/en-us/azure/spring-apps/quickstart-sample-app-acme-fitness-store-introduction

Using the new steps was able to deploy using Azure CLI on Enterprise Tier.