1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-05 13:08:17 -05:00

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>
This commit is contained in:
Joseph Flinn 2021-08-10 11:15:16 -07:00 committed by GitHub
parent 842a1c2e37
commit 2e1df91232
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 60 additions and 147 deletions

View File

@ -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:
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:
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

View File

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

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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" />

View File

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

View File

@ -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>

View File

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

View File

@ -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>