我正在通过Redgate软件和TeamCity为SQL Server数据库实现CI / CD。我设法构建并将NuGet数据库包推送到Octopus。我可以在Octopus的“库”部分中看到NuGet包。但是我在将该程序包部署到SQL Server时遇到了问题。我无法在Octopus进程部分中找到内置步骤模板“部署NuGet程序包”。我还尝试了“部署软件包”步骤模板,但没有成功。我正在遵循本指南。
任何帮助将受到高度赞赏。
很好的问题,要将Redgate的工具与Octopus Deploy一起使用,您将需要安装它们提供的步骤模板。我建议创建数据库发行版并部署数据库发行版。当浏览步骤模板时,您可能会注意到该步骤模板可以直接从程序包中进行部署。SQL Change Automation的基于状态的功能通过将存储在NuGet包中的数据库的状态与目标数据库进行比较来工作。每次运行时,它都会创建一组新的增量脚本来应用。因此,建议的过程是:
让我们继续前进,逐一进行。下载软件包步骤非常简单,除了选择软件包名称外,没有其他自定义设置。
Redgate-创建数据库发布步骤更加有趣。这是生成将在数据库上运行的实际增量脚本的步骤。让大多数人绊倒的是出口之路。导出路径是增量脚本将导出到的路径。该目录必须是Octopus Deploy tentacle文件夹之外的目录。这是因为“ Redgate-从数据库发布部署”步骤需要访问该路径,并且每个步骤的Tentacle文件夹都不同。
我想做的是使用项目变量。
变量的完整值为:
C:\RedGate\#{Octopus.Project.Name}\#{Octopus.Release.Number}\Database\Export
The next step is approving the database release. I recommend creating a custom team to be responsible for this. My preference is to skip this step in Dev and QA.
The create database release step makes use of the artifact functionality built into Octopus Deploy. This allows the approver to download the files and review them.
The final step is deploying the database release. This step takes the delta script in the export data path and runs it on the target server. This is why I recommend putting the export path in a variable.
Some other general items to help get going. First, don't install tentacles directly onto SQL Server instances. In production, the typical SQL Server set up is a cluster or they have multiple nodes with always-on high availability. Access to SQL Server is handled via a virtual IP.
If you were to install tentacles on both nodes, Octopus Deploy would attempt to run the change script on both nodes at the same time (by default). That will cause a lot of drama. I recommend using a jump box because you will need something to sit between Octopus Deploy and SQL Server. When you get comfortable with that I'd recommend using workers (but that is a bit of scope creep, so I won't cover that).
If you would like to know more on how to wire this up, check out the blog post I wrote (and copied from for this answer) here.
I also have written an entire series on database deployments with Octopus Deploy, which you can find here.
最后,我们的文档涵盖了用户进行数据库部署所需的跳转框和权限。
希望有帮助!
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句