我需要設置一個持續集成流程,以使用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