我需要设置一个持续集成流程,以使用Octopus Deploy将我们的应用程序作为Azure云服务进行部署。这个过程包括一个步骤,用于对我们的Azure SQL数据库执行Entity Framework 6.1迁移(通过从本地八爪鱼触手运行migrate.exe
)。但是,需要在Octopus机器上打开1433端口才能正常工作,而我们的管理员不会那样做。在Octopus期间运行实体框架迁移将CI部署到Azure
在自动部署过程中执行Entity Framework迁移有什么不同的建议吗?
我需要设置一个持续集成流程,以使用Octopus Deploy将我们的应用程序作为Azure云服务进行部署。这个过程包括一个步骤,用于对我们的Azure SQL数据库执行Entity Framework 6.1迁移(通过从本地八爪鱼触手运行migrate.exe
)。但是,需要在Octopus机器上打开1433端口才能正常工作,而我们的管理员不会那样做。在Octopus期间运行实体框架迁移将CI部署到Azure
在自动部署过程中执行Entity Framework迁移有什么不同的建议吗?
我们最终打开了该端口,因为我们找不到任何其他解决方案。作为参考,这里是我们正在运行的脚本(我们的Deploy.ps1脚本,由NuGet在每个部署中执行)。
# SOURCE: http://danpiessens.com/blog/2014/06/10/deploying-databases-with-octopus-deploy-part-2/
# Get the exe name based on the directory
$contentPath = (Join-Path $OctopusOriginalPackageDirectoryPath "content")
$fullPath = (Join-Path $OctopusOriginalPackageDirectoryPath "content\migrate.exe")
Write-Host "Content Path:" $contentPath
Write-Host "Migrate Path:" $fullPath
cd $contentPath
write-host "Working Dir: "$(get-location)
# Run the migration utility
& "$fullPath" MyApp.Data.dll /startUpConfigurationFile=MyApp.Web.dll.config /connectionString=$ApplicationConnectionString /connectionProviderName="System.Data.SqlClient" /verbose | Write-Host
我上运行的应用程序的迁移开始使用此代码:
class ApplicationDataContext : DbContext
{
internal static void UpdateDatabase()
{
Database.SetInitializer<ApplicationDataContext>(null);
var settings = new Migrations.Configuration();
var migrator = new DbMigrator(settings);
migrator.Update();
}
}
你为什么不能打开端口?你决定做什么? – 2015-08-25 21:17:17