通过Octopus和TeamCity将数据库包部署到SQL Server

jeetdeveloper

我正在通过Redgate软件和TeamCity为SQL Server数据库实现CI / CD。我设法构建并将NuGet数据库包推送到Octopus。我可以在Octopus的“库”部分中看到NuGet包。但是我在将该程序包部署到SQL Server时遇到了问题。我无法在Octopus进程部分中找到内置步骤模板“部署NuGet程序包”我还尝试了“部署软件包”步骤模板,但没有成功。我正在遵循本指南。

https://documentation.red-gate.com/sr1/worked-examples/deploying-a-database-package-using-octopus-deploy-step-templates

任何帮助将受到高度赞赏。

鲍勃·沃克

很好的问题,要将Redgate的工具与Octopus Deploy一起使用,您将需要安装它们提供的步骤模板。我建议创建数据库发行版部署数据库发行版当浏览步骤模板时,您可能会注意到该步骤模板可以直接从程序包中进行部署SQL Change Automation的基于状态的功能通过将存储在NuGet包中的数据库的状态与目标数据库进行比较来工作。每次运行时,它都会创建一组新的增量脚本来应用。因此,建议的过程是:

  1. 将数据库包下载到跳转框中。
  2. 通过将跳转框上的包与SQL Server上的数据库进行比较来创建增量脚本。
  3. 查看增量脚本(可以在开发和测试中跳过)。
  4. 使用跳转框上的触手在SQL Server上运行脚本。

基本数据库部署过程

让我们继续前进,逐一进行。下载软件包步骤非常简单,除了选择软件包名称外,没有其他自定义设置。

下载包步骤

Redgate-创建数据库发布步骤更加有趣。这是生成将在数据库上运行的实际增量脚本的步骤。让大多数人绊倒的是出口之路。导出路径是增量脚本将导出到的路径。该目录必须是Octopus Deploy tentacle文件夹之外的目录。这是因为“ Redgate-从数据库发布部署”步骤需要访问该路径,并且每个步骤的Tentacle文件夹都不同。

Redgate创建发布

我想做的是使用项目变量。

项目变量

变量的完整值为:

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.

SQL Server的虚拟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).

Jumpbox和章鱼部署

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] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

将SQL数据库部署到与SQL Server不同的资源组中

如何将 SQL Function 部署到目标 SQL Server 2016 数据库

SQL Server 数据库的版本和部署

将数据从本地数据库同步到在线数据库SQL Server和VB.Net

无法将C#SQL CLR数据库项目从Visual Studio 2010部署到SQL Server 2014

如何将SSIS包构建为从Salesforce到SQL Server数据库的UPSERT / DELETE数据?

SQL Server数据库项目部署前和部署后脚本

如何将数据库从SQL Server导入到Azure数据库?

Powershell将SQL Server数据库还原到新数据库

哪个映像用于通过位桶云自动将SSIS包部署到SQL Server?

将数据库部署到Docker容器microsoft / mssql-server-linux

避免通过 Node 中的 `mssql` 包多次访问 SQL Server 数据库

将SSIS包部署到SQL Server 2016

SQL Server报告数据库目录和Reporting Server

通过SQL Server中的SQL将数据库名称分配给变量

将SQL Server备份还原到Azure SQL数据库

如何使用 sql server 2008 R2 将数据库从现有数据库复制到新数据库 sql 脚本?

IN SQL Server数据库

通过Microsoft SQL Server Management Studio编写查询以将数据库导出到csv文件

通过将新行插入(添加)表(SQL Server数据库)来触发Azure函数

是否可以将SQL Server数据库(或单个表)从备份还原到Databricks Delta表?

如何将远程SQL Server数据库备份到本地驱动器?

无法将数据库还原到SQL Server中的快照

如何从 Visual Studio / SQL Server Data Tools 部署包含的 SQL Server 数据库?

我们是否可以将数据库还原到从SQL Server 2012获取的SQL Server 2017中?

SQL Server:通过查询创建数据库图

SQL Server数据库未通过查询更新

无法通过Docker连接到SQL Server数据库

链接到Skyward数据库到MS SQL Server