Skip to content

Commit

Permalink
Merge pull request #86 from pappyangel/MCAPS-Deploy
Browse files Browse the repository at this point in the history
Mcaps deploy
  • Loading branch information
timrobertsusa authored Jul 23, 2024
2 parents 88ecb42 + 1376a2a commit 32be139
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 33 deletions.
18 changes: 5 additions & 13 deletions .github/workflows/BuildDeploy-API.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:

steps:
- name: Check out source code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- name: Restore, Build, Test, Publish
run: |
cd cocktails
Expand All @@ -28,17 +28,9 @@ jobs:
dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp
- name: Deploy App to Azure WebService
uses: Azure/webapps-deploy@v2.2.5
uses: Azure/webapps-deploy@v3.0.1
with:
# Name of the Azure Web App
# app-name: 'APICocktails'
# Applies to Web Apps(Windows and Linux) and Web App Containers(linux). Multi container scenario not supported. Publish profile (*.publishsettings) file contents with Web Deploy secrets
#publish-profile: API_WEBAPP_PUBLISH_PROFILE
#publish-profile: ${{ secrets.API_WEBAPP_PUBLISH_PROFILE }}
#publish-profile: ${{ secrets.COCKTAIL_API_WEBAPP_PUBLISH_PROFILE }}
#publish-profile: ${{ secrets.COCKTAIL_API_PROD2_WEBAPP_PUBLISH_PROFILE }}
publish-profile: ${{ secrets.COCKTAIL_API_MCAPS_PUBLISH_PROFILE }}
#COCKTAIL_API_WEBAPP_PUBLISH_PROFILE
publish-profile: ${{ secrets.COCKTAIL_API_MCAPS_F25_PUBLISH_PROFILE }}
# Enter an existing Slot other than the Production slot
#slot-name: # optional, default is production
# Applies to Web App only: Path to package or folder. *.zip, *.war, *.jar or a folder to deploy
Expand Down
20 changes: 8 additions & 12 deletions .github/workflows/BuildDeploy-Frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,14 @@ jobs:
dotnet restore
dotnet build --no-restore
dotnet test --no-build --verbosity normal
dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp
# - name: Deploy App to Azure WebService
# uses: Azure/[email protected]
# with:
# publish-profile: ${{ secrets.COCKTAIL_FRONTEND_MCAPS_PUBLISH_PROFILE }}
dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp
- name: Deploy App to Azure WebService
uses: Azure/[email protected]
with:
#app-name: 'Cocktail-Frontend'
publish-profile: ${{ secrets.COCKTAIL_FRONTEND_MCAPS_F25_PUBLISH_PROFILE }}
# Enter an existing Slot other than the Production slot
#slot-name: prod2
# Applies to Web App only: Path to package or folder. *.zip, *.war, *.jar or a folder to deploy
# package: ${{env.DOTNET_ROOT}}/myapp





package: ${{env.DOTNET_ROOT}}/myapp
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ CREATE TABLE [dbo].[Items] (
);
```

changes tracked for move to new Azure subscription \
upgrade to .net 8

### App Service process
- create new app services and plan - Free plan should work
- add AppInsights
Expand All @@ -30,12 +27,16 @@ upgrade to .net 8
### Code changes for move to production app service
- In the Frontend
- update appsettings and change to production url of API

- We were using a hard coded url in Program.cs. This was needed during development but will break production if left in.
- Technically, this should not be done in code at all, but rather via the launchSettings.json file in Properties folder.
- In the API
- set the RunAsParm to SMI
- update SQL connection string to use production
- We add a Password paramter to the SQL connection string during development. This will break production which uses SMI. This line of code needs to be commented out.

### Additional notes

- During the process of deploying and verifying success, it was very helpful to use the App Services, Developet Tools, Advanced Tools - specifically Log stream and site wwwroot.

# Release 3.0

Expand Down
2 changes: 1 addition & 1 deletion cocktails/DB/SqlDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public SqlConnection GetSQLCn()

// The below 2 lines are used during development only. SMI is used in Production
var keyVaultSecretLookup = _configuration["AzureKeyVaultSecret:defaultSecret"];
builder.Password = _configuration.GetValue<string>(keyVaultSecretLookup);
// builder.Password = _configuration.GetValue<string>(keyVaultSecretLookup);

SqlConnection sqlDBCn = new SqlConnection(builder.ConnectionString);

Expand Down
4 changes: 2 additions & 2 deletions frontend/Pages/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
}

<div class="text-center">
<h1 class="display-4">Cocktails PROD2 vJ5</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
<h1 class="display-4">Cocktails Application - Production Release July 2024</h1>
<p>Hit the API directly! <a href="https://cocktail-api.azurewebsites.net/cocktails"></a>.</p>
</div>
2 changes: 1 addition & 1 deletion frontend/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseUrls("https://localhost:5200");
//webBuilder.UseUrls("https://localhost:5200");
webBuilder.UseStartup<Startup>();
});
}
Expand Down

0 comments on commit 32be139

Please sign in to comment.