Skip to content

Commit

Permalink
JK's improvements to F5 experience (#1128)
Browse files Browse the repository at this point in the history
* Changed default startup project from Domain to WebAPI

* AdminUI uses Kestrel instead of IIS by default (consistent with Docker)

* Updated gitignore to ignore generate .env file

* Added multi-startup config for VS extensions

* Simplified global.json so that we don't need to update it every couple of weeks

* Fixed a few parts in the compile instructions

* global.json - set workloadVersion to 8.0.404

* - revert global.json changes

- update F5 experience on why versions must be 8.0.402

* - added global-ci.json for github workflows

- add rollForward to global.json
- update documentation

---------

Co-authored-by: vladk <[email protected]>
  • Loading branch information
jernejk and vladislav-kir authored Jan 10, 2025
1 parent 8bdb688 commit f8a5610
Show file tree
Hide file tree
Showing 13 changed files with 89 additions and 26 deletions.
6 changes: 6 additions & 0 deletions .github/global-ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "8.0.404",
"rollForward": "minor"
}
}
2 changes: 1 addition & 1 deletion .github/workflows/admin-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
global-json-file: .github/global-ci.json

- name: Install Workload
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/android-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Setup DotNet Environment
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
global-json-file: .github/global-ci.json

- name: Install MAUI Workload
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/api-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
global-json-file: .github/global-ci.json

- name: Install Workload
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
global-json-file: .github/global-ci.json

- name: Install Workload
run: |
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
- name: Setup DotNet Environment
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
global-json-file: .github/global-ci.json

- name: Install MAUI Workload
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ios-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Setup DotNet Environment
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
global-json-file: .github/global-ci.json

- name: Install MAUI Workload
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -552,3 +552,6 @@ $RECYCLE.BIN/
/.mfractor
src/WebAPI/ClientApp/package-lock.json
.vscode/settings.json

# Ignore .env file that is generated by up.ps1
.env
4 changes: 2 additions & 2 deletions SSW.Rewards.sln
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAPI", "src\WebAPI\WebAPI.csproj", "{22454EE9-16B3-4B7A-8352-37E59B858155}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SSW.Rewards.Domain", "src\Domain\SSW.Rewards.Domain.csproj", "{C7E89A3E-A631-4760-8D61-BD1EAB1C4E69}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SSW.Rewards.Application", "src\Application\SSW.Rewards.Application.csproj", "{34C0FACD-F3D9-400C-8945-554DD6B0819A}"
Expand All @@ -18,8 +20,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Domain.UnitTests", "tests\D
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Application.IntegrationTests", "tests\Application.IntegrationTests\Application.IntegrationTests.csproj", "{277029AF-D9E1-4B75-9F11-48FEA7345AD7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAPI", "src\WebAPI\WebAPI.csproj", "{22454EE9-16B3-4B7A-8352-37E59B858155}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{A87BBE09-C548-459A-92E6-2304EAE3A54D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{A00FFB8A-A8B6-42F0-A934-6A69A9C2BD3B}"
Expand Down
42 changes: 42 additions & 0 deletions SSW.Rewards.sln.startup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
This is a configuration file for the SwitchStartupProject Visual Studio Extension
See https://heptapod.host/thirteen/switchstartupproject/blob/branch/current/Configuration.md
*/
{
/* Configuration File Version */
"Version": 3,

/* Create an item in the dropdown list for each project in the solution? */
"ListAllProjects": false,

"MultiProjectConfigurations": {
"Run All": {
"Projects": {
"WebAPI": {},
"AdminUI": {},
"MobileUI": {}
}
},
"AdminUI + WebAPI": {
"Projects": {
"WebAPI": {},
"AdminUI": {}
}
},
"MobileUI": {
"Projects": {
"MobileUI": {}
}
},
"AdminUI": {
"Projects": {
"AdminUI": {}
}
},
"WebAPI": {
"Projects": {
"WebAPI": {}
}
}
}
}
17 changes: 11 additions & 6 deletions _docs/Instructions-Compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,24 @@
2. Get the Secrets from Keeper
1. **Client Secrets | SSW | SSW.Rewards | Developer Secrets**
2. Add them as .NET User Secrets for `WebAPI.csproj`
3. Create a Developer Certificate https://learn.microsoft.com/en-us/aspnet/core/security/docker-https?view=aspnetcore-8.0#certificates
1. Create `WebAPI.pfx` with a password of `ThisPassword` (You can change change this, but the `docker-compose.yml` should be updated appropriately)
3. Create a Developer Certificate with command below
1. Make sure you have folder `.aspnet\https` in your home directory
1. Run the script below (You can change change this, but the `docker-compose.yml` should be updated appropriately)

**Windows**
**Windows Terminal**
```bash
dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\WebAPI.pfx -p ThisPassword
dotnet dev-certs https -ep $env:USERPROFILE\.aspnet\https\WebAPI.pfx -p ThisPassword
dotnet dev-certs https --trust
```

**Mac**
```bash
dotnet dev-certs https -ep ${HOME}/.aspnet/https/WebAPI.pfx -p ThisPassword
dotnet dev-certs https --trust
dotnet dev-certs https -ep ${HOME}/.aspnet/https/WebAPI.pfx -p ThisPassword
dotnet dev-certs https --trust
```

**NOTE:** If when creating WebAPI.pfx you get "A valid HTTPS certificate is already present." use `dotnet dev-certs https --clean` to remove the existing certificate.
**NOTE:** See https://learn.microsoft.com/en-us/aspnet/core/security/docker-https?view=aspnetcore-8.0#certificates if there are any issues.

4. Cd into the Repo
5. Run the Docker Containers
Expand All @@ -54,6 +57,8 @@ dotnet dev-certs https --trust
```bash
pwsh ./up.ps1
```

**Note:** We are using a separate `global-ci.json` to ensure simple F5 experince and successful CI builds. There are issues with certain .net sdk workload versions, but current solution is stable.

You should now be able to access the AdminUI hosted locally at https://localhost:7137

Expand Down
5 changes: 2 additions & 3 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"sdk": {
"version": "8.0.402",
"workloadVersion": "8.0.402",
"rollForward": "disable"
"rollForward": "minor"
}
}
}
12 changes: 6 additions & 6 deletions src/AdminUI/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"SSW.Rewards.Admin": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7137;http://localhost:5137",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"SSW.Rewards.Admin": {
"commandName": "Project",
"dotnetRunMessages": true,
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7137;http://localhost:5137",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down
14 changes: 11 additions & 3 deletions up.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,26 @@ if (-not(Test-Path "./.env")) {
$devCertPath = "$certsPath/WebAPI.pfx"

if (-not(Test-Path $devCertPath)) {
Write-Host "Developer certificate not found."
Write-Host "Run the followin commands, then run this script again."
Write-Host "WebApi Developer certificate not found."
Write-Host "Run the following commands, then run this script again."

Write-Host "dotnet dev-certs https --clean"

if ($IsWindows) {
Write-Host "dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\WebAPI.pfx -p ThisPassword"
Write-Host "dotnet dev-certs https -ep $env:USERPROFILE\.aspnet\https\WebAPI.pfx -p ThisPassword"
}
else {
Write-Host "dotnet dev-certs https -ep ${HOME}/.aspnet/https/WebAPI.pfx -p ThisPassword"
}

Write-Host "dotnet dev-certs https --trust"

if ($IsWindows) {
Write-Host ""
Write-Host "⚠️ Check that %USERPROFILE%\.aspnet\https folder exists before running above commands (copy & paste path into File Explorer)"
Write-Host "⚠️ Check that it didn't create cert in {{ GIT_REPO_PATH }}\%USERPROFILE%\.aspnet\https instead of the expected path"
}

exit -1
}

Expand Down

0 comments on commit f8a5610

Please sign in to comment.