-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adds logic required to deploy to Azure using Continuous Deployment or manual release pipeline
- Loading branch information
Showing
13 changed files
with
177 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using ServerCore.DataModel; | ||
|
||
namespace ServerCore.Areas.Deployment | ||
{ | ||
public class DeploymentConfiguration | ||
{ | ||
internal static void ConfigureDatabase(IConfiguration configuration, IServiceCollection services, IHostingEnvironment env) | ||
{ | ||
// Use SQL Database if in Azure, otherwise, use localdb | ||
if (env.IsStaging() && Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME") == "PuzzleServerTestDeploy") | ||
{ | ||
services.AddDbContext<PuzzleServerContext> | ||
(options => options.UseLazyLoadingProxies() | ||
.UseSqlServer(configuration.GetConnectionString("PuzzleServerSQLConnectionString"))); | ||
} | ||
else if (env.IsProduction() && (Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME") == "puzzlehunt" || Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME") == "puzzleday")) | ||
{ | ||
services.AddDbContext<PuzzleServerContext> | ||
(options => options.UseLazyLoadingProxies() | ||
.UseSqlServer(configuration.GetConnectionString("PuzzleServerSQLConnectionString"))); | ||
} | ||
else | ||
{ | ||
services.AddDbContext<PuzzleServerContext> | ||
(options => options.UseLazyLoadingProxies() | ||
.UseSqlServer(configuration.GetConnectionString("PuzzleServerContextLocal"))); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
ServerCore/Properties/PublishProfiles/PuzzleServerTestDeploy - Web Deploy.pubxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
This file is used by the publish/package process of your Web project. You can customize the behavior of this process | ||
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<WebPublishMethod>MSDeploy</WebPublishMethod> | ||
<ResourceId>/subscriptions/3ffc52f4-eed1-4312-8170-9caf82ff0949/resourcegroups/PuzzleServerTestDeploy/providers/Microsoft.Web/sites/PuzzleServerTestDeploy</ResourceId> | ||
<ResourceGroup>PuzzleServerTestDeploy</ResourceGroup> | ||
<PublishProvider>AzureWebSite</PublishProvider> | ||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> | ||
<LastUsedPlatform>Any CPU</LastUsedPlatform> | ||
<SiteUrlToLaunchAfterPublish>https://puzzleservertestdeploy.azurewebsites.net</SiteUrlToLaunchAfterPublish> | ||
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish> | ||
<ExcludeApp_Data>False</ExcludeApp_Data> | ||
<ProjectGuid>67b91cce-4e3d-4f0f-8a76-eafd37c5f949</ProjectGuid> | ||
<MSDeployServiceURL>puzzleservertestdeploy.scm.azurewebsites.net:443</MSDeployServiceURL> | ||
<DeployIisAppPath>PuzzleServerTestDeploy</DeployIisAppPath> | ||
<RemoteSitePhysicalPath /> | ||
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer> | ||
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod> | ||
<EnableMSDeployBackup>True</EnableMSDeployBackup> | ||
<UserName>$PuzzleServerTestDeploy</UserName> | ||
<_SavePWD>True</_SavePWD> | ||
<_DestinationType>AzureWebSite</_DestinationType> | ||
<InstallAspNetCoreSiteExtension>False</InstallAspNetCoreSiteExtension> | ||
<TargetFramework>netcoreapp2.1</TargetFramework> | ||
<SelfContained>false</SelfContained> | ||
<_IsPortable>true</_IsPortable> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,22 @@ | ||
{ | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:44319/", | ||
"sslPort": 0 | ||
} | ||
}, | ||
"Logging": { | ||
"IncludeScopes": false, | ||
"LogLevel": { | ||
"Default": "Debug", | ||
"System": "Information", | ||
"Microsoft": "Information" | ||
} | ||
}, | ||
"ConnectionStrings": { | ||
"PuzzleServerContextLocal": "Server=(localdb)\\MSSQLLocalDB;Database=PuzzleServer;Trusted_Connection=True;MultipleActiveResultSets=true", | ||
"AzureStorageConnectionString": "UseDevelopmentStorage=true" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "https://puzzlehunt.azurewebsites.net", | ||
"sslPort": 0 | ||
} | ||
}, | ||
"ConnectionStrings": { | ||
"PuzzleServerContext": "", | ||
"AzureStorageConnectionString": "", | ||
"PuzzleServerSQLConnectionString": "" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "https://puzzleservertestdeploy.azurewebsites.net", | ||
"sslPort": 0 | ||
} | ||
}, | ||
"ConnectionStrings": { | ||
"PuzzleServerContext": "", | ||
"AzureStorageConnectionString": "", | ||
"PuzzleServerSQLConnectionString": "" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters