Browse Source

Update qa env (#1504)

* deploying directly to the production slot of the App Service

* Update Azure Service Bus package

* adding a app service shutdown to qa

* reverting QA env deploy change

* Update qa-deploy workflow with debugging statement

* Disable start/stop in QA deploy workflow

* Fix UserKdf and UserApiKey migrations to only update null values (#1494)

* Add proper New Relic NuGet package for .NET 5

* Test NewRelic changes

Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com>
pull/1506/head
Joseph Flinn 4 years ago committed by GitHub
parent
commit
2e1df91232
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 150
      .github/workflows/qa-deploy.yml
  2. 4
      bitwarden_license/src/Portal/Portal.csproj
  3. 6
      bitwarden_license/src/Portal/newrelic.config
  4. 1
      bitwarden_license/src/Sso/Sso.csproj
  5. 6
      bitwarden_license/src/Sso/newrelic.config
  6. 1
      src/Admin/Admin.csproj
  7. 6
      src/Admin/newrelic.config
  8. 2
      src/Api/Api.csproj
  9. 2
      src/Api/newrelic.config
  10. 1
      src/Billing/Billing.csproj
  11. 6
      src/Billing/newrelic.config
  12. 2
      src/Core/Core.csproj
  13. 4
      src/Events/Events.csproj
  14. 6
      src/Events/newrelic.config
  15. 4
      src/Identity/Identity.csproj
  16. 2
      src/Identity/newrelic.config

150
.github/workflows/qa-deploy.yml

@ -152,6 +152,7 @@ jobs: @@ -152,6 +152,7 @@ jobs:
run: |
echo "Running database migrations..."
for f in `ls -v ./*.sql`; do
echo "Executing file: ${f}..."
sqlcmd -S $MSSQL_HOST -d vault -U $MSSQL_USER -P $MSSQL_PASS -I -i $f
done;
@ -201,6 +202,12 @@ jobs: @@ -201,6 +202,12 @@ jobs:
echo "::add-mask::$webapp_name"
echo "::set-output name=webapp-name::$webapp_name"
- name: Stop App Service
if: false
env:
AZURE_RESOURCE_GROUP: "bw-qa-env"
run: az webapp stop --name ${{ steps.retrieve-secrets.outputs.webapp-name }} --resource-group $AZURE_RESOURCE_GROUP
- name: Deploy App
uses: azure/webapps-deploy@798e43877120eda6a2a690a4f212c545e586ae31
with:
@ -208,143 +215,8 @@ jobs: @@ -208,143 +215,8 @@ jobs:
slot-name: "staging"
package: ./${{ matrix.name }}.zip
swap-identity:
runs-on: ubuntu-latest
needs: deploy
steps:
- name: Login to Azure
uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a
with:
creds: ${{ secrets.AZURE_QA_KV_CREDENTIALS }}
- name: Retrieve secrets
id: retrieve-secrets
- name: Start App Service
if: false
env:
VAULT_NAME: "bitwarden-qa-kv"
run: |
identity_webapp_name=$(az keyvault secret show --vault-name $VAULT_NAME --name appservices-identity-webapp-name --query value --output tsv)
echo "::add-mask::$identity_webapp_name"
echo "::set-output name=identity-webapp-name::$identity_webapp_name"
- name: Start staging slot
run: az webapp start --name ${{ steps.retrieve-secrets.outputs.identity-webapp-name }} --resource-group bitwarden-qa --slot staging
- name: Make sure staging endpoint is alive
run: |
SUCCESS="no"
while read OUTPUT
do
STATUS=$( curl -is https://${{ steps.retrieve-secrets.outputs.identity-webapp-name }}-staging.azurewebsites.net/.well-known/openid-configuration/jwks | head -1 )
if [[ "$STATUS" == *"200 OK"* ]]; then
echo "It is live!"
SUCCESS="yes"
break
fi
echo -e "STAUS=$STATUS\nRetrying: $OUTPUT"
sleep 4;
done < <(seq 15)
if [[ "$SUCCESS" == "no" ]]; then
exit 1
fi
- name: Swap Identity
run: az webapp deployment slot swap -g bitwarden-qa -n ${{ steps.retrieve-secrets.outputs.identity-webapp-name }} --slot staging --target-slot production
- name: Stop staging slot
run: az webapp stop --name ${{ steps.retrieve-secrets.outputs.identity-webapp-name }} --resource-group bitwarden-qa --slot staging
swap-slots:
runs-on: ubuntu-latest
needs: swap-identity
strategy:
fail-fast: false
matrix:
include:
- name: Api
- name: Billing
- name: Events
- name: Sso
- name: Portal
steps:
- name: Setup
id: setup
run: |
NAME_LOWER=$(echo "${{ matrix.name }}" | awk '{print tolower($0)}')
echo "::set-output name=name_lower::$NAME_LOWER"
- name: Login to Azure
uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a
with:
creds: ${{ secrets.AZURE_QA_KV_CREDENTIALS }}
- name: Retrieve secrets
id: retrieve-secrets
env:
VAULT_NAME: "bitwarden-qa-kv"
run: |
webapp_name=$(az keyvault secret show --vault-name $VAULT_NAME --name appservices-${{ steps.setup.outputs.name_lower }}-webapp-name --query value --output tsv)
echo "::add-mask::$webapp_name"
echo "::set-output name=webapp-name::$webapp_name"
- name: Start staging slot
run: az webapp start --name ${{ steps.retrieve-secrets.outputs.webapp-name }} --resource-group bitwarden-qa --slot staging
- name: Make sure staging endpoint is alive
run: |
SUCCESS="no"
while read OUTPUT
do
STATUS=$( curl -is https://${{ steps.retrieve-secrets.outputs.webapp-name }}-staging.azurewebsites.net/alive | head -1 )
if [[ "$STATUS" == *"200 OK"* ]]; then
echo "It is live!"
SUCCESS="yes"
break
fi
echo -e "STAUS=$STATUS\nRetrying: $OUTPUT"
sleep 4;
done < <(seq 15)
if [[ "$SUCCESS" == "no" ]]; then
exit 1
fi
- name: Swap slots
run: az webapp deployment slot swap -g bitwarden-qa -n ${{ steps.retrieve-secrets.outputs.webapp-name }} --slot staging --target-slot production
- name: Stop staging slot
run: az webapp stop --name ${{ steps.retrieve-secrets.outputs.webapp-name }} --resource-group bitwarden-qa --slot staging
swap-admin:
runs-on: ubuntu-latest
needs: swap-slots
steps:
- name: Login to Azure
uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a
with:
creds: ${{ secrets.AZURE_QA_KV_CREDENTIALS }}
- name: Retrieve secrets
id: retrieve-secrets
env:
VAULT_NAME: "bitwarden-qa-kv"
run: |
admin_webapp_name=$(az keyvault secret show --vault-name $VAULT_NAME --name appservices-admin-webapp-name --query value --output tsv)
echo "::add-mask::$admin_webapp_name"
echo "::set-output name=admin-webapp-name::$admin_webapp_name"
- name: Start staging slot
run: az webapp start --name ${{ steps.retrieve-secrets.outputs.admin-webapp-name }} --resource-group bitwarden-qa --slot staging
- name: Make sure staging endpoint is alive
run: |
sleep 60 # I don't think the admin portal has an alive endpoint
- name: Swap Admin
run: az webapp deployment slot swap -g bitwarden-qa -n ${{ steps.retrieve-secrets.outputs.admin-webapp-name }} --slot staging --target-slot production
- name: Stop staging slot
run: az webapp stop --name ${{ steps.retrieve-secrets.outputs.admin-webapp-name }} --resource-group bitwarden-qa --slot staging
AZURE_RESOURCE_GROUP: "bw-qa-env"
run: az webapp start --name ${{ steps.retrieve-secrets.outputs.webapp-name }} --resource-group $AZURE_RESOURCE_GROUP

4
bitwarden_license/src/Portal/Portal.csproj

@ -8,4 +8,8 @@ @@ -8,4 +8,8 @@
<ProjectReference Include="..\..\..\src\Core\Core.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NewRelic.Agent" Version="8.41.0" />
</ItemGroup>
</Project>

6
bitwarden_license/src/Portal/newrelic.config

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
<?xml version="1.0"?>
<configuration xmlns="urn:newrelic-config">
<application></application>
<service licenseKey="SECRET"></service>
<log directory="/home/LogFiles/NewRelic" level="info"></log>
</configuration>

1
bitwarden_license/src/Sso/Sso.csproj

@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
<PropertyGroup Condition=" '$(RunConfiguration)' == 'Sso' " />
<ItemGroup>
<PackageReference Include="NewRelic.Agent" Version="8.41.0" />
<PackageReference Include="Sustainsys.Saml2.AspNetCore2" Version="2.7.0" />
</ItemGroup>

6
bitwarden_license/src/Sso/newrelic.config

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
<?xml version="1.0"?>
<configuration xmlns="urn:newrelic-config">
<application></application>
<service licenseKey="SECRET"></service>
<log directory="/home/LogFiles/NewRelic" level="info"></log>
</configuration>

1
src/Admin/Admin.csproj

@ -19,6 +19,7 @@ @@ -19,6 +19,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.3" />
<PackageReference Include="NewRelic.Agent" Version="8.41.0" />
</ItemGroup>
</Project>

6
src/Admin/newrelic.config

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
<?xml version="1.0"?>
<configuration xmlns="urn:newrelic-config">
<application></application>
<service licenseKey="SECRET"></service>
<log directory="/home/LogFiles/NewRelic" level="info"></log>
</configuration>

2
src/Api/Api.csproj

@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.2" />
<PackageReference Include="NewRelic.Agent" Version="8.30.0" />
<PackageReference Include="NewRelic.Agent" Version="8.41.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.5.1" />
<PackageReference Include="Microsoft.Azure.EventGrid" Version="3.2.0" />
</ItemGroup>

2
src/Api/newrelic.config

@ -2,5 +2,5 @@ @@ -2,5 +2,5 @@
<configuration xmlns="urn:newrelic-config">
<application></application>
<service licenseKey="SECRET"></service>
<log directory="D:\Home\LogFiles\NewRelic" level="info"></log>
<log directory="/home/LogFiles/NewRelic" level="info"></log>
</configuration>

1
src/Billing/Billing.csproj

@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.3" />
<PackageReference Include="NewRelic.Agent" Version="8.41.0" />
</ItemGroup>
</Project>

6
src/Billing/newrelic.config

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
<?xml version="1.0"?>
<configuration xmlns="urn:newrelic-config">
<application></application>
<service licenseKey="SECRET"></service>
<log directory="/home/LogFiles/NewRelic" level="info"></log>
</configuration>

2
src/Core/Core.csproj

@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.2" />
<PackageReference Include="Microsoft.Azure.Cosmos.Table" Version="1.0.7" />
<PackageReference Include="Microsoft.Azure.NotificationHubs" Version="3.3.0" />
<PackageReference Include="Microsoft.Azure.ServiceBus" Version="4.1.3" />
<PackageReference Include="Microsoft.Azure.ServiceBus" Version="5.1.3" />
<PackageReference Include="Microsoft.Azure.Storage.Blob" Version="11.1.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.5" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="5.0.0" />

4
src/Events/Events.csproj

@ -9,4 +9,8 @@ @@ -9,4 +9,8 @@
<ProjectReference Include="..\Core\Core.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NewRelic.Agent" Version="8.41.0" />
</ItemGroup>
</Project>

6
src/Events/newrelic.config

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
<?xml version="1.0"?>
<configuration xmlns="urn:newrelic-config">
<application></application>
<service licenseKey="SECRET"></service>
<log directory="/home/LogFiles/NewRelic" level="info"></log>
</configuration>

4
src/Identity/Identity.csproj

@ -6,11 +6,11 @@ @@ -6,11 +6,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NewRelic.Agent" Version="8.30.0" />
<ProjectReference Include="..\Core\Core.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Core\Core.csproj" />
<PackageReference Include="NewRelic.Agent" Version="8.41.0" />
</ItemGroup>
</Project>

2
src/Identity/newrelic.config

@ -2,5 +2,5 @@ @@ -2,5 +2,5 @@
<configuration xmlns="urn:newrelic-config">
<application></application>
<service licenseKey="SECRET"></service>
<log directory="D:\Home\LogFiles\NewRelic" level="info"></log>
<log directory="/home/LogFiles/NewRelic" level="info"></log>
</configuration>

Loading…
Cancel
Save