以编程方式将 Umbraco 数据从开发站点迁移到实时站点

发布于 2024-11-03 11:30:43 字数 870 浏览 2 评论 0原文

我面临的情况是,我负责向 Umbraco 制作应用程序或扩展,使后端用户能够将开发站点上的更改迁移到实时站点。这种迁移应该每天发生一次,或者当后端用户按下后端的按钮时发生。

我知道 Umbraco 在 Courier 包中提供了此功能,但显然它对于这种情况来说效果不够好。

更多细节:

开发站点和实时站点都驻留在同一服务器上,它们的数据库也是如此。只需将数据从一个文件夹传输到另一个文件夹,并且与数据库中的表相同。

正如我所看到的,有两种方法可以解决这个问题。

1) 进行完整迁移,基本上是对实时数据库进行拆卸并将其更新到新版本。然后您还可以复制所需的所有文件。

2) 您创建一个包,其中包含您在开发人员站点上更改的文档类型等内容,并将该包加载到实时站点上。

第 1 点的问题是,在完成传输后,您似乎必须重新发布整个站点。据我所知,您可以使用网络服务来完成此操作,但如果我可以使用控制台应用程序,我会更喜欢它。

我的问题是:

有没有一种方法可以以编程方式创建包并以相同的方式加载它们,或者以编程方式实现此迁移的最佳方法是什么?

任何建议将不胜感激,因为我有点不知所措:)

编辑

我最终实际上做了一个完整的镜像,因为我使用 Robocopy 传输所有文件文件夹中的内容已更改,然后我使用 SQL 命令对开发站点进行了备份,然后使用 RESTORE SQL 命令将其恢复到实时数据库上。

需要在 SQL 命令中完成一些设置,但它运行平稳,完整的传输只需 10 秒,具体取决于已更改的文件数量。

最后一件事。如果您希望更改可见,您需要重新加载 Umbraco。您可以通过手动修改 web.config 文件或以编程方式设置其 LastWriteTime 来完成此操作。

I am in the situation where I have been charged with making an application or extension to Umbraco that makes the backend users able to do a migration of their changes on the development site to the live site. This migration is supposed to happen once a day, or when the backend users press a button in the backend.

I am aware that Umbraco offers this in the Courier package, but apparently it doesn't work well enough for this case.

A few more details:

The development and live site both reside on the same server and so do their databases. The data will simply need to be transferred from one folder to another and the same with the tables in the database.

As I can see there are two methods of going about this.

1) You do a full migration, where you basically do a teardown of the live database and update it to the new version. You then copy over all the files you need as well.

2) You create a package containing the document types and so on you have changed on your developer site and load that package on the live site.

The problem with number 1 is that it seems you have to republish the entire site when you have done the transfer. As far as I have understood you can do this with a webservice, but I would prefer it if I could use a console app instead.

My question is then:

Is there a way to create packages programmatically and load them in the same way or what would be the best way to achieve this migration programmatically?

Any suggestions would be much appreciated as I am kind of at a loss for a way to do this :)

EDIT

I ended up actually doing a complete mirroring in the sense that I used Robocopy to transfer all the files that had been changed in the folders, and then I did a backup of the development site with a SQL command, and then I restored it on the live database using the RESTORE SQL command.

A few settings needed to be done in the SQL commands, but it runs smoothly and a complete transfer takes down to 10 seconds depending on the number of files that have been changed.

One last thing. If you want the changes to be visible you need Umbraco to be reloaded. This you can do by modifying the web.config file, either manually or by setting it's LastWriteTime programmatically.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

扶醉桌前 2024-11-10 11:30:43

您始终可以创建一个用户控件来为您处理整个站点的重新发布,您可以从控制台应用程序调用它。

您还可以加入Courier 2 测试版 程序,确实足够好(反正功能我自己还没测试过)。

另一种途径可能是将所有节点作为 xml feed 提供,并使用 CMSImport 的调度功能来迁移节点自动地。

这是一个艰难的选择,有很多选择,但还没有灵丹妙药。我非常希望《信使 2》能够完美地实现这一点,并热切地等待它的发布。

You can always create a usercontrol that will handle the republishing of the entire site for you, this you can call from your console app.

You could also join the Courier 2 beta program, which is indeed good enough (for features anyway, I haven't tested it myself).

Another route could be to offer all of the nodes as a xml feed and use the scheduling feature of CMSImport to migrate nodes automatically.

This is a tough one, there's a lot of options an no silver bullet yet. I have good hopes that Courier 2 will be perfect for this and am eagerly awaiting its release.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文