Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Deploy to Azure Button #4929

Open
ubidev opened this issue Dec 19, 2024 · 25 comments
Open

[BUG] Deploy to Azure Button #4929

ubidev opened this issue Dec 19, 2024 · 25 comments

Comments

@ubidev
Copy link

ubidev commented Dec 19, 2024

Oqtane Info

Version - 6.0.0
Render Mode - Static
Interactivity - Server
Database - SQL Server

Describe the bug

I just successfully ran the "deploy to azure" button BUT when I go to the https://websitename.azurewebsites.net URL I get a default azure website status page instead of the oqtane initialization wizard

image

Expected Behavior

once deployed I should get the oqtane initialize wizard

Steps To Reproduce

click the "deploy to azure" button
fill the form with acceptable values
create
wait for success
clic the website provided address

Anything else?

I know there is a manuall way to do this documented here: https://blazorhelpwebsite.com/ViewBlogPost/1 but I really need that wizard to work because I plan to demonstrate/use oqtane during classes to noobs

Thanks in advance for taking the time. This project is simply Amazing

@sbwalker
Copy link
Member

@vnetonline I believe you were able to resolve the issues in the Deploy to Azure functionality in the past... are you able to investigate the latest issues?

@vnetonline
Copy link
Contributor

Yup I will have a look and investigate and fix

@vnetonline
Copy link
Contributor

I have recorded a FREE course on how to setup Oqtane on Local IIS

https://learnoqtane.com/course-page/!/4/how-to-setup-oqtane-on-local-iis

If you are not a member of LearnOqtane.com .. you can Join Now for FREE

@vnetonline
Copy link
Contributor

The Button to deploy to Azure is working properly, however when it has finished getting the source files from the master it fails because of a Build error see below

Could not load file or assembly 'System.Text.Json, Version=8.0.0.4, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. [C:\home\site\repository\Oqtane.Server\Oqtane.Server.csproj]

NuGet Config files used:
      D:\DWASFiles\Sites\#120241221-1542-amazing\AppData\NuGet\NuGet.Config
  
  Feeds used:
      https://api.nuget.org/v3/index.json
  
  Installed:
      15 package(s) to C:\home\site\repository\Oqtane.Shared\Oqtane.Shared.csproj
      125 package(s) to C:\home\site\repository\Oqtane.Server\Oqtane.Server.csproj
      40 package(s) to C:\home\site\repository\Oqtane.Client\Oqtane.Client.csproj
Done Building Project "C:\home\site\repository\Oqtane.Server\Oqtane.Server.csproj" (Restore target(s)).
Project "C:\home\site\repository\Oqtane.Server\Oqtane.Server.csproj" on node 1 (default targets).
C:\Program Files (x86)\dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(135,5): warning NETSDK1223: Targeting .NET 9.0 or higher in Visual Studio 2022 17.11 is not supported. [C:\home\site\repository\Oqtane.Server\Oqtane.Server.csproj]
PrepareForBuild:
  Creating directory "bin\Release\net9.0\".
  Creating directory "obj\Release\net9.0\".
  Creating directory "C:\home\site\repository\Oqtane.Server\obj\Release\net9.0\refint\".
  Creating directory "obj\Release\net9.0\ref".
C:\Program Files (x86)\dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1060: Error reading assets file: Error loading lock file 'C:\home\site\repository\Oqtane.Server\obj\project.assets.json' : Could not load file or assembly 'System.Text.Json, Version=8.0.0.4, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. [C:\home\site\repository\Oqtane.Server\Oqtane.Server.csproj]

Done Building Project "C:\home\site\repository\Oqtane.Server\Oqtane.Server.csproj" (default targets) -- FAILED.

Build FAILED.

"C:\home\site\repository\Oqtane.Server\Oqtane.Server.csproj" (default target) (1:7) ->
(_WarnWhenUsingNET9AndVSPriorTo1712 target) -> 
  C:\Program Files (x86)\dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(135,5): warning NETSDK1223: Targeting .NET 9.0 or higher in Visual Studio 2022 17.11 is not supported. [C:\home\site\repository\Oqtane.Server\Oqtane.Server.csproj]


"C:\home\site\repository\Oqtane.Server\Oqtane.Server.csproj" (default target) (1:7) ->
(ResolvePackageAssets target) -> 
  C:\Program Files (x86)\dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1060: Error reading assets file: Error loading lock file 'C:\home\site\repository\Oqtane.Server\obj\project.assets.json' : Could not load file or assembly 'System.Text.Json, Version=8.0.0.4, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. [C:\home\site\repository\Oqtane.Server\Oqtane.Server.csproj]

    1 Warning(s)
    1 Error(s)

Time Elapsed 00:04:03.79
Failed exitCode=1, command="C:\Program Files (x86)\MSBuilds\17.11.2\MSBuild\Current\Bin\MSBuild.exe" /restore "C:\home\site\repository\Oqtane.Server\Oqtane.Server.csproj" /p:DeployOnBuild=true /p:configuration=Release /p:publishurl="C:\local\Temp\8dd217a36b6dc47"
An error has occurred during web site deployment.
\r\nC:\Program Files (x86)\SiteExtensions\Kudu\103.100930.002\bin\Scripts\starter.cmd "C:\home\site\deployments\tools\deploy.cmd"

@ubidev
Copy link
Author

ubidev commented Dec 21, 2024

I understand.
Is this fixable?

@vnetonline
Copy link
Contributor

This related to dotnet/sdk#44197 (comment) i have made a comment that this hasn't been resolved

@richlander
Copy link

Can you share your project file? It isn't obvious to me how this behavior is related to that other issue.

@vnetonline
Copy link
Contributor

vnetonline commented Dec 23, 2024

The project file is from git repo Oqtane Framework

Oqtane.Server.csproj

@richlander
Copy link

C:\Program Files (x86)\dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(135,5): warning NETSDK1223: Targeting .NET 9.0 or higher in Visual Studio 2022 17.11 is not supported. [C:\home\site\repository\Oqtane.Server\Oqtane.Server.csproj]

That warning seems pretty important.

I just built the code w/o issue.

@richlander
Copy link

FYI for @sbwalker

There should be no need for this reference if .NET and STJ version match. You should be able to remove it.

<PackageReference Include="System.Text.Json" Version="9.0.0" />

@sbwalker
Copy link
Member

@richlander removing the reference to System.Text.Json 9.0 from the Oqtane.Shared project results in a compilation warning in a different project within the solution:

7>C:\Source\Projects\oqtane.framework\Oqtane.Database.MySQL\Oqtane.Database.MySQL.csproj : warning NU1903: Package 'System.Text.Json' 8.0.4 has a known high severity vulnerability, GHSA-8g4q-xg66-9fp4

The Oqtane.Database.MySQL.csproj project is targeted at .NET 9 and references:

    <PackageReference Include="MySql.EntityFrameworkCore" Version="9.0.0-preview" />
    <PackageReference Include="MySql.Data" Version="9.1.0" />

These are the latest versions of these packages. I assume that the System.Text.Json is a transitive dependency of one of these 2 packages. I could add a reference to System.Text.Json 9.0 in the Oqtane.Database.MySQL.csproj which would eliminate the compilation warning... however this is essentially the same solution as including the reference to System.Text.Json 9.0 in Oqtane.Shared.csproj.

Suggestions?

@sbwalker
Copy link
Member

@vnetonline do you have any idea why you have this warning message:

C:\Program Files (x86)\dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(135,5): warning NETSDK1223: Targeting .NET 9.0 or higher in Visual Studio 2022 17.11 is not supported. [C:\home\site\repository\Oqtane.Server\Oqtane.Server.csproj]

The Oqtane solution is being built within the Azure environment during Deploy To Azure, correct?

@richlander
Copy link

That makes sense @sbwalker. You are right.

Related: dotnet/sdk#44566

@sbwalker
Copy link
Member

@richlander so you are confirming that we should retain the package reference to System.Text.Json 9.0 in Oqtane.Shared.csproj - to ensure that our transitive dependencies do not pull in the vulnerable System.Text.Json 8.0.4 package - correct?

@richlander
Copy link

Yes. Sorry for adding confusion on that.

I think the source of the problem is that the wrong SDK is being used.

@richlander
Copy link

BTW: Hi!

sbwalker added a commit to sbwalker/oqtane.framework that referenced this issue Dec 23, 2024
sbwalker added a commit that referenced this issue Dec 23, 2024
add back System.Text.Json to Shared project (#4929)
@sbwalker
Copy link
Member

@vnetonline the azuredeploy.json file contains a reference to:

netFrameworkVersion": "v5.0"

Is this correct?

@vnetonline
Copy link
Contributor

vnetonline commented Dec 24, 2024

The file which is in master targets v5.0 but when I am testing I have changed it to v9.0

I can successfully build the project locally. But when Azure is building it by getting the source code from GitHub repo master branch the build on azure results in above error.

The error I believe is to do with MSBuild using System.Text.Json 8.0.0.4

I have checked the Oqtane Package it doesn't reference System.Text.Json 8.0.0.4 or any other version of System.Text.Json as a dependency.

@sbwalker
Copy link
Member

@vnetonline if you read the comments above in this thread you will see that System.Text.Json 8.0.4 is referenced by one of the dependencies in the Oqtane.Database.MySQL project.

Perhaps if you add a package reference for System.Text.Json 9.0.0 to the Oqtane.Database.MySQL project it might resolve the build issue in Azure.

@vnetonline
Copy link
Contributor

vnetonline commented Dec 24, 2024

@sbwalker Your latest push in dev branch has resolved the build issue but now I am getting time outs when trying to deploy dev branch

I need to figure out a way of increasing the time out .... I am trying to investigate how we can increase time out via deployment script .... we need to add a environment variable SCM_COMMAND_IDEL_TIMEOUT via deployment script which appears to be challenging.

@vnetonline
Copy link
Contributor

vnetonline commented Dec 24, 2024

I have now managed to add the environment variables here is the latest deployment script which still is timing out

            "SCM_COMMAND_IDLE_TIMEOUT": "3600",
            "WEBJOBS_IDLE_TIMEOUT": "3600"
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.1",
  "parameters": {
    "sqlDatabaseEditionTierDtuCapacity": {
      "type": "string",
      "defaultValue": "Basic-Basic-5-2",
      "allowedValues": [
        "Basic-Basic-5-2",
        "Standard-S0-10-250",
        "Standard-S1-20-250",
        "Standard-S2-50-250",
        "Standard-S3-100-250",
        "Standard-S4-200-250",
        "Standard-S6-400-250",
        "Standard-S7-800-250",
        "Standard-S9-1600-250",
        "Standard-S12-3000-250",
        "Premium-P1-125-500",
        "Premium-P2-250-500",
        "Premium-P4-500-500" ,
        "Premium-P6-1000-500",
        "Premium-P11-1750-500-1024",
        "Premium-P15-4000-1024",
        "GeneralPurpose-GP_Gen5_2-2-250",
        "GeneralPurpose-GP_S_Gen5_2-2-250"
      ],
      "metadata": {
        "description": "Describes the database Edition, Tier, Dtu, Gigabytes (Edition-Tier-Dtu-Gigabytes)"
      }
    },
    "sqlServerName": {
      "type": "string",
      "metadata": {
        "description": "The name of the sql server. It has to be unique."
      }
    },
    "sqlDatabaseName": {
      "type": "string",
      "metadata": {
        "description": "The name of the sql databaseName. It has to be unique."
      }
    },
    "sqlAdministratorLogin": {
      "type": "string",
      "metadata": {
        "description": "The admin user of the SQL Server"
      }
    },
    "sqlAdministratorLoginPassword": {
      "type": "securestring",
      "metadata": {
        "description": "The password of the admin user of the SQL Server"
      }
    },
    "BlazorWebsiteName": {
      "type": "string",
      "metadata": {
        "description": "The name of the website. It has to be unique."
      }
    },
    "BlazorSKU": {
      "type": "string",
      "allowedValues": [
        "F1",
        "D1",
        "B1",
        "B2",
        "B3",
        "S1",
        "S2",
        "S3",
        "P1",
        "P2",
        "P3",
        "P4"
      ],
      "defaultValue": "B1"
    },
    "BlazorSKUCapacity": {
      "type": "int",
      "defaultValue": 1,
      "maxValue": 3,
      "minValue": 1,
      "metadata": {
        "description": "Describes plan's instance count"
      }
    },
    "location": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]",
      "metadata": {
        "description": "Location for all resources."
      }
    }
  },
  "variables": {
    "hostingPlanName": "[concat('Oqtane-hostingplan-', uniqueString(resourceGroup().id))]",
    "databaseCollation": "SQL_Latin1_General_CP1_CI_AS",
    "databaseEditionTierDtuCapacity": "[split(parameters('sqlDatabaseEditionTierDtuCapacity'),'-')]",
    "databaseEdition": "[variables('databaseEditionTierDtuCapacity')[0]]",
    "databaseTier": "[variables('databaseEditionTierDtuCapacity')[1]]",
    "databaseDtu": "[if(greater(length(variables('databaseEditionTierDtuCapacity')), 2), variables('databaseEditionTierDtuCapacity')[2], '')]",
    "databaseMaxSizeGigaBytes":"[if(greater(length(variables('databaseEditionTierDtuCapacity')), 3), variables('databaseEditionTierDtuCapacity')[3], '')]",
    "databaseServerlessTiers": [
            "GP_S_Gen5_2"
        ]
  },
  "resources": [
    {
      "type": "Microsoft.Sql/servers",
      "apiVersion": "2021-11-01",
      "name": "[parameters('sqlServerName')]",
      "location": "[parameters('location')]",
      "tags": {
        "displayName": "SQL Server"
      },
      "properties": {
        "administratorLogin": "[parameters('sqlAdministratorLogin')]",
        "administratorLoginPassword": "[parameters('sqlAdministratorLoginPassword')]",
        "version": "12.0"
      }
    },
    {
      "type": "Microsoft.Sql/servers/databases",
      "apiVersion": "2021-11-01",
      "name": "[format('{0}/{1}', parameters('sqlServerName'), parameters('sqlDatabaseName'))]",
      "location": "[parameters('location')]",
      "tags": {
        "displayName": "Database"
      },
      "sku": {
        "name": "[if(equals(variables('databaseEdition'), 'GeneralPurpose'), variables('databaseTier'), variables('databaseEdition'))]",
        "tier": "[variables('databaseEdition')]",
        "capacity": "[if(equals(variables('databaseDtu'), ''), json('null'), int(variables('databaseDtu')))]" 
      },
      "kind": "[concat('v12.0,user,vcore',if(contains(variables('databaseServerlessTiers'),variables('databaseTier')),',serverless',''))]",
      "properties": {
        "edition": "[variables('databaseEdition')]",
        "collation": "[variables('databaseCollation')]",
        "maxSizeBytes": "[if(equals(variables('databaseMaxSizeGigaBytes'), ''), json('null'), mul(mul(mul(int(variables('databaseMaxSizeGigaBytes')),1024),1024),1024))]",
        "requestedServiceObjectiveName": "[variables('databaseTier')]"
        
      },
      "dependsOn": [
        "[resourceId('Microsoft.Sql/servers', parameters('sqlserverName'))]"
      ]
    },
    {
      "type": "Microsoft.Sql/servers/firewallRules",
      "apiVersion": "2021-11-01",
      "name": "[format('{0}/{1}', parameters('sqlServerName'), 'AllowAllWindowsAzureIps')]",
      "properties": {
        "endIpAddress": "0.0.0.0",
        "startIpAddress": "0.0.0.0"
      },
      "dependsOn": [
        "[resourceId('Microsoft.Sql/servers', parameters('sqlServerName'))]"
      ]
    },
    {
      "name": "[variables('hostingPlanName')]",
      "type": "Microsoft.Web/serverfarms",
      "location": "[resourceGroup().location]",
      "apiVersion": "2024-04-01",
      "dependsOn": [],
      "tags": {
        "displayName": "Blazor"
      },
      "sku": {
        "name": "[parameters('BlazorSKU')]",
        "capacity": "[parameters('BlazorSKUCapacity')]"
      },
      "properties": {
        "name": "[variables('hostingPlanName')]",
        "numberOfWorkers": 1
      }
    },
    {
      "apiVersion": "2024-04-01",
      "name": "[parameters('BlazorWebsiteName')]",
      "type": "Microsoft.Web/sites",
      "location": "[parameters('location')]",
      "dependsOn": [
        "[variables('hostingPlanName')]"
      ],
      "tags": {
        "[concat('hidden-related:', resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName')))]": "empty",
        "displayName": "Website"
      },
      "properties": {
        "name": "[parameters('BlazorWebsiteName')]",
        "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]",
        "siteConfig": {
          "webSocketsEnabled": true,
          "use32BitWorkerProcess": false,
          "netFrameworkVersion": "v9.0",
          "metadata": [
            {
              "name": "CURRENT_STACK",
              "value": "dotnet"
            }
          ]
        }
      },
      "resources": [
        {
          "type": "sourcecontrols",
          "apiVersion": "2024-04-01",
          "name": "web",
          "location": "[parameters('location')]",
          "dependsOn": [
            "[resourceId('Microsoft.Web/sites', parameters('BlazorWebsiteName'))]"
            //"[resourceId('Microsoft.Web/Sites/config', parameters('BlazorWebsiteName'), 'connectionstrings')]"
          ],
          "properties": {
            "RepoUrl": "https://github.com/oqtane/oqtane.framework.git",
            "branch": "dev",
            "IsManualIntegration": true
          }
        },
        {
          "name": "appsettings",
          "type": "config",
          "apiVersion": "2015-08-01",
          "dependsOn": [
            "[resourceId('Microsoft.Web/sites', parameters('BlazorWebsiteName'))]"
          ],
          "tags": {
            "displayName": "appsettings"
          },
          "properties": {
            "SCM_COMMAND_IDLE_TIMEOUT": "3600",
            "WEBJOBS_IDLE_TIMEOUT": "3600"
          }
        }
      ]
    }
  ]
}

@ubidev
Copy link
Author

ubidev commented Dec 25, 2024

You guys are great btw. Thanks for your support and happy Holidays to all of you :)

@ubidev
Copy link
Author

ubidev commented Jan 5, 2025

So is there hope that this nice little button will work again soon? :)
Thanks guys

@ADefWebserver
Copy link
Member

ADefWebserver commented Jan 8, 2025

@ubidev - Can you test the Deploy To Azure button on this project: https://github.com/ADefWebserver/Blazor-Blogs
@sbwalker - If it works, this is the script I worked on for a week: https://github.com/ADefWebserver/Blazor-Blogs/blob/main/azuredeploy.json - The key changes are API version, SKU changes, and changing netFrameworkVersion to 9.0

@ubidev
Copy link
Author

ubidev commented Jan 18, 2025

I can gladly confirm that the button at that project works

So there is hope afterall for Oqtane's button as well :)

Thanks for your collaboration on this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants