Skip to content

How to use this template in a new project

KlausEnevoldsen-Abtion edited this page Sep 26, 2023 · 1 revision
  • Create a new project with Muffi.Net as template
    • Set permissions for the Abtion user to Read
    • Set permissions for the project specific user to Admin
  • Rename Solution from "MuffiNet" to [ProjectName]
  • Rename Projects from "MuffiNet" to [ProjectName]
  • Find and Replace from “MuffiNet” to [ProjectName]
  • Close Visual Studio/VS Code
  • Rename project and test folders from File Explorer or similar
  • Replace MuffiNet to [ProjectName] in .sln file
  • Replace MuffiNet to [ProjectName] in .yarnrc file
  • Replace the User Secret Keys in these projects (by deleting the existing keys in the project files and running dotnet user-secrets init in each of the directories):
    • MuffiNet.EndToEnd.Tests
    • MuffiNet.Api
    • MuffiNet.FrontendReact
  • Open Visual Studio/VS Code
  • yarn install
  • dotnet build
  • Provision Azure resources through script 'azure-setup.ps1'
    • Log in to portal.azure.com as [ProjectName]@abtion.com
    • Open cloud shell (Powershell)
    • Fill in azure-setup.ps1 variables at top of script (complex auto-generated password recommended)
    • Paste script in cloud shell to provision Azure resources
  • Application Insights:
    • (Visual Studio only) Manage Connected Services -> Restore on Application Insights
    • Replace Application Insights ConnectionString in both Backend and FrontendReact appsettings.*.json files
  • SQL:
    • Potentially, access from certain IP-numbers in the firewall of GitHub Actions is needed (in some cases "52.170.187.191")
      • Insert these firewall rules through Azure portal yourself
    • Save the SQL database connection string in GitHub Secrets "MSSQL_CONNECTION_STRING"
  • Setup pipeline to deploy application:
    • In the Azure Portal go to App Service and choose "Deployment Center"
      • Select GitHub as source
      • Click "Authorize" and finish wizard (maybe log into GitHub with project-specific-user-name: [email protected]?)
      • Connect the GitHub organisation, project and branch to the deployment slot (production)
      • Save changes and download the publish profile (Manage Publish Profiles)
      • Save the publish profile in GitHub Secrets "AzurePublishProfile" with the content of the downloaded profile.publishsettings
    • In CI pipeline-file
      • Remove " && 'to-enable-azure-deploy' == 'remove-this-after-configuring-github-secrets-and-below-settings'"
      • Replace "MuffiNet" with [ProjectName] in database migration step "dotnet ef database update --project src/MuffiNet.FrontendReact"
      • Replace "MuffiNet" with [ProjectName] twice in publish step "run: dotnet publish src/MuffiNet.FrontendReact/MuffiNet.FrontendReact.csproj -c Release -o ${{env.DOTNET_ROOT}}/myapp"
      • Change the publish-profile line to publish-profile: ${{ secrets.AzurePublishProfile }}
      • Change the name of the Azure App Service in app-name
Clone this wiki locally