From b7b282a71a21c1bc46565e384ece9e5c4a794eaf Mon Sep 17 00:00:00 2001 From: Jonathan Bourdon Date: Tue, 5 May 2026 22:23:19 -0400 Subject: [PATCH] chore(ci): update configuration --- .github/workflows/backend-ci.yml | 39 ------- .github/workflows/frontend-ci.yml | 38 ------- backend/.github/workflows/build.yml | 82 -------------- backend/.github/workflows/cicd.yml | 42 ------- backend/.github/workflows/deploy.yml | 107 ------------------ backend/src/Socialize.Api/Program.cs | 8 +- .../src/Socialize.Api/Socialize.Api.csproj | 4 +- .../Socialize.Api/appsettings.Production.json | 12 +- frontend/staticwebapp.config.json | 16 --- frontend/swa-cli.config.json | 15 --- frontend/web.config | 10 -- 11 files changed, 12 insertions(+), 361 deletions(-) delete mode 100644 .github/workflows/backend-ci.yml delete mode 100644 .github/workflows/frontend-ci.yml delete mode 100644 backend/.github/workflows/build.yml delete mode 100644 backend/.github/workflows/cicd.yml delete mode 100644 backend/.github/workflows/deploy.yml delete mode 100644 frontend/staticwebapp.config.json delete mode 100644 frontend/swa-cli.config.json delete mode 100644 frontend/web.config diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml deleted file mode 100644 index 7118702..0000000 --- a/.github/workflows/backend-ci.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Backend CI/CD - -on: - push: - branches: - - main - -env: - AZURE_WEBAPP_NAME: hutopy-backend-api - DOTNET_VERSION: '10.0.x' - -jobs: - build_and_deploy: - runs-on: ubuntu-latest - environment: dev - steps: - - # Checkout the repository - - uses: actions/checkout@v2 - - # Setup .NET Core - - name: Setup .NET Core - uses: actions/setup-dotnet@v1 - with: - dotnet-version: ${{ env.DOTNET_VERSION }} - - # Run dotnet publish - - name: dotnet build and publish - run: | - cd backend - dotnet publish --configuration Release --artifacts-path ./publish/ Socialize.slnx - - # Deploy to Azure WebApp - - name: Deploy to Azure WebApp - uses: azure/webapps-deploy@v2 - with: - app-name: ${{ env.AZURE_WEBAPP_NAME }} - publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} - package: './backend/publish/publish/Socialize.Api/release/' diff --git a/.github/workflows/frontend-ci.yml b/.github/workflows/frontend-ci.yml deleted file mode 100644 index bd62026..0000000 --- a/.github/workflows/frontend-ci.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Frontend CI/CD - -on: - push: - branches: - - main - -env: - AZURE_SWA_NAME: hutopy-portal - -jobs: - build_and_deploy: - runs-on: ubuntu-latest - steps: - - # Checkout the repository - - uses: actions/checkout@v2 - - # Npm install - - name: npm install - run: | - cd frontend - npm install - - # Npm run build - - name: npm run build - run: | - cd frontend - npm run build - - # Deploy to Azure SWA - - name: Deploy to Azure SWA - uses: azure/static-web-apps-deploy@v1 - with: - action: "upload" - app_location: 'frontend' - output_location: 'dist' - azure_static_web_apps_api_token: ${{ secrets.AZURE_SWA_TOKEN }} diff --git a/backend/.github/workflows/build.yml b/backend/.github/workflows/build.yml deleted file mode 100644 index ce81956..0000000 --- a/backend/.github/workflows/build.yml +++ /dev/null @@ -1,82 +0,0 @@ -name: Build - -on: - pull_request: - branches: [ main ] - paths-ignore: - - '.scripts/**' - - .gitignore - - CODE_OF_CONDUCT.md - - LICENSE - - README.md - - workflow_call: - inputs: - build-artifacts: - type: boolean - required: true - default: false - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - name: Checkout code - - - name: Cache NuGet packages - uses: actions/cache@v3 - with: - path: ~/.nuget/packages - key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - restore-keys: | - ${{ runner.os }}-nuget- - - - - name: Install .NET - uses: actions/setup-dotnet@v3 - - - name: Restore solution - run: dotnet restore - - - name: Build solution - run: dotnet build --no-restore --configuration Release - - - name: Test solution - run: dotnet test --no-build --configuration Release --filter "FullyQualifiedName!~AcceptanceTests" - - - name: Publish website - if: ${{ inputs.build-artifacts == true }} - run: | - dotnet publish --configuration Release --runtime win-x86 --self-contained --output ./publish - cd publish - zip -r ./publish.zip . - working-directory: ./src/Web/ - - - name: Upload website artifact (website) - if: ${{ inputs.build-artifacts == true }} - uses: actions/upload-artifact@v3 - with: - name: website - path: ./src/Web/publish/publish.zip - if-no-files-found: error - - - name: Create EF Core migrations bundle - if: ${{ inputs.build-artifacts == true }} - run: | - dotnet new tool-manifest - dotnet tool install dotnet-ef - dotnet ef migrations bundle --configuration Release -p ./src/Infrastructure/ -s ./src/Web/ -o efbundle.exe - zip -r ./efbundle.zip efbundle.exe - env: - SkipNSwag: True - - - name: Upload EF Core migrations bundle artifact (efbundle) - if: ${{ inputs.build-artifacts == true }} - uses: actions/upload-artifact@v3 - with: - name: efbundle - path: ./efbundle.zip - if-no-files-found: error diff --git a/backend/.github/workflows/cicd.yml b/backend/.github/workflows/cicd.yml deleted file mode 100644 index ce67ab4..0000000 --- a/backend/.github/workflows/cicd.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: CICD - -on: - push: - branches: [ main ] - paths-ignore: - - .gitignore - - CODE_OF_CONDUCT.md - - LICENSE - - README.md - -permissions: - id-token: write - contents: read - -jobs: - - build: - uses: ./.github/workflows/build.yml - with: - build-artifacts: true - - deploy-development: - uses: ./.github/workflows/deploy.yml - secrets: inherit - needs: [ build ] - with: - environmentName: Development - - deploy-staging: - uses: ./.github/workflows/deploy.yml - secrets: inherit - needs: [ deploy-development ] - with: - environmentName: Staging - - deploy-production: - uses: ./.github/workflows/deploy.yml - secrets: inherit - needs: [ deploy-staging ] - with: - environmentName: Production \ No newline at end of file diff --git a/backend/.github/workflows/deploy.yml b/backend/.github/workflows/deploy.yml deleted file mode 100644 index d9b02a8..0000000 --- a/backend/.github/workflows/deploy.yml +++ /dev/null @@ -1,107 +0,0 @@ -name: Deploy - -on: - workflow_call: - inputs: - environmentName: - required: true - type: string - -permissions: - id-token: write - contents: read - -jobs: - - validate: - runs-on: ubuntu-latest - environment: ${{ inputs.environmentName }} - - steps: - - - uses: actions/checkout@v3 - name: Checkout code - - - uses: azure/login@v1 - name: Login to Azure - with: - client-id: ${{ vars.AZURE_CLIENT_ID }} - tenant-id: ${{ vars.AZURE_TENANT_ID }} - subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }} - - - if: inputs.environmentName == 'Development' - uses: azure/arm-deploy@v1 - name: Run preflight validation - with: - deploymentName: ${{ github.run_number }} - resourceGroupName: ${{ vars.AZURE_RESOURCE_GROUP_NAME }} - template: ./.azure/bicep/main.bicep - parameters: > - environmentName=${{ inputs.environmentName }} - sqlAdministratorUsername=${{ vars.AZURE_SQL_ADMINISTRATOR_USERNAME }} - sqlAdministratorPassword=${{ secrets.AZURE_SQL_ADMINISTRATOR_PASSWORD }} - projectName=${{ vars.PROJECT_NAME }} - deploymentMode: Validate - - - if: inputs.environmentName != 'Development' - uses: azure/arm-deploy@v1 - name: Run what-if - with: - failOnStdErr: false - resourceGroupName: ${{ vars.AZURE_RESOURCE_GROUP_NAME }} - template: ./.azure/bicep/main.bicep - parameters: > - environmentName=${{ inputs.environmentName }} - sqlAdministratorUsername=${{ vars.AZURE_SQL_ADMINISTRATOR_USERNAME }} - sqlAdministratorPassword=${{ secrets.AZURE_SQL_ADMINISTRATOR_PASSWORD }} - projectName=${{ vars.PROJECT_NAME }} - additionalArguments: --what-if - - deploy: - needs: [ validate ] - runs-on: ubuntu-latest - environment: ${{ inputs.environmentName }} - - steps: - - - uses: actions/checkout@v3 - name: Checkout code - - - uses: actions/download-artifact@v3 - name: Download artifacts - - - name: Install .NET - uses: actions/setup-dotnet@v3 - - - uses: azure/login@v1 - name: Login to Azure - with: - client-id: ${{ vars.AZURE_CLIENT_ID }} - tenant-id: ${{ vars.AZURE_TENANT_ID }} - subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }} - - - uses: azure/arm-deploy@v1 - id: deploy - name: Deploy infrastructure - with: - failOnStdErr: false - deploymentName: ${{ github.run_number }} - resourceGroupName: ${{ vars.AZURE_RESOURCE_GROUP_NAME }} - template: ./.azure/bicep/main.bicep - parameters: > - environmentName=${{ inputs.environmentName }} - sqlAdministratorUsername=${{ vars.AZURE_SQL_ADMINISTRATOR_USERNAME }} - sqlAdministratorPassword=${{ secrets.AZURE_SQL_ADMINISTRATOR_PASSWORD }} - projectName=${{ vars.PROJECT_NAME }} - - - name: Initialise database - run: | - unzip -o ./efbundle/efbundle.zip - echo '{ "ConnectionStrings": { "DefaultConnection": "" } }' > appsettings.json - ./efbundle.exe --connection "Server=${{ steps.deploy.outputs.sqlServerFullyQualifiedDomainName }};Initial Catalog=${{ steps.deploy.outputs.sqlDatabaseName }};Persist Security Info=False;User ID=${{ vars.AZURE_SQL_ADMINISTRATOR_USERNAME }};Password=${{ secrets.AZURE_SQL_ADMINISTRATOR_PASSWORD }};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" --verbose - - - uses: azure/webapps-deploy@v2 - name: Deploy website - with: - app-name: ${{ steps.deploy.outputs.appServiceAppName }} - package: website/publish.zip diff --git a/backend/src/Socialize.Api/Program.cs b/backend/src/Socialize.Api/Program.cs index 61939e7..9318838 100644 --- a/backend/src/Socialize.Api/Program.cs +++ b/backend/src/Socialize.Api/Program.cs @@ -1,4 +1,3 @@ -using Azure.Identity; using FastEndpoints; using FastEndpoints.Swagger; using Microsoft.AspNetCore.HttpOverrides; @@ -25,11 +24,10 @@ using Socialize.Api.Modules.Workspaces; var builder = WebApplication.CreateBuilder(args); -if (!builder.Environment.IsDevelopment()) +string? vaultUri = Environment.GetEnvironmentVariable("VaultUri"); +if (!string.IsNullOrWhiteSpace(vaultUri)) { - var vaultUri = Environment.GetEnvironmentVariable("VaultUri") ?? throw new InvalidOperationException("Missing VaultUri configuration setting"); - - builder.Configuration.AddAzureKeyVault(new Uri(vaultUri), new DefaultAzureCredential()); + throw new InvalidOperationException("VaultUri configuration is not supported by this deployment. Move secrets to environment variables."); } builder.Services.AddCors(options => diff --git a/backend/src/Socialize.Api/Socialize.Api.csproj b/backend/src/Socialize.Api/Socialize.Api.csproj index 8147f03..41721a5 100644 --- a/backend/src/Socialize.Api/Socialize.Api.csproj +++ b/backend/src/Socialize.Api/Socialize.Api.csproj @@ -1,4 +1,4 @@ - + net10.0 @@ -15,8 +15,6 @@ - - diff --git a/backend/src/Socialize.Api/appsettings.Production.json b/backend/src/Socialize.Api/appsettings.Production.json index 863b7a1..ca9bc66 100644 --- a/backend/src/Socialize.Api/appsettings.Production.json +++ b/backend/src/Socialize.Api/appsettings.Production.json @@ -1,11 +1,15 @@ { - "ConnectionStrings": { - "PostgresConnection": "Server=hutopypostgress.postgres.database.azure.com,5432;Database=hutopy;User Id=hutopy;Password=General2024!;Ssl Mode=Require;" - }, "Stripe": { "SocializeRate": 0.05 }, "Website": { - "FrontendBaseUrl": "https://hutopy.com" + "FrontendBaseUrl": "https://socialize.mapachotes.com" + }, + "LocalBlobStorage": { + "RootPath": "App_Data/blob-storage", + "RequestPath": "/api/storage" + }, + "DevelopmentSeed": { + "Enabled": false } } diff --git a/frontend/staticwebapp.config.json b/frontend/staticwebapp.config.json deleted file mode 100644 index 6eb0f99..0000000 --- a/frontend/staticwebapp.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "navigationFallback": { - "rewrite": "/index.html", - "exclude": ["/images/*.{png,jpg,gif}", "/css/*"] - }, - "mimeTypes": { - ".json": "application/json", - ".webmanifest": "application/manifest+json" - }, - "responseOverrides": { - "404": { - "rewrite": "/index.html", - "statusCode": 200 - } - } -} diff --git a/frontend/swa-cli.config.json b/frontend/swa-cli.config.json deleted file mode 100644 index ed39941..0000000 --- a/frontend/swa-cli.config.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "https://aka.ms/azure/static-web-apps-cli/schema", - "configurations": { - "taim-ui": { - "appLocation": ".", - "outputLocation": "dist", - "appBuildCommand": "npm run build", - "run": "npm run dev", - "appDevserverUrl": "http://localhost:5173", - "resourceGroup": "Hutopy", - "appName": "hutopy-portal", - "env": "production" - } - } -} \ No newline at end of file diff --git a/frontend/web.config b/frontend/web.config deleted file mode 100644 index a94e109..0000000 --- a/frontend/web.config +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file