orchard文档之更新站点到新的orchard版本

更新站点到新的orchard版本

在站点的生命周期中,新版本的CMS是一个重要事件。并且转换应当是简单的。然而不幸的是,orchard目前并没有一个自动升级的机制。本主题将展示怎样尽量无痛苦的升级到新版本而保证你的数据安全。

一句话警告

不管你采取何种方式升级你的网站,在这过程中你都要重写很多文件, you are going to have to overwrite a lot of files in the process. This should emphasize the requirement to backup first, but it should also call your attention to any modifications you made to common files. For example, if you made any modifications to core modules and/or the framework (something you shouldn't do: custom modules and themes should be used instead), you will loose them, or you will need to re-apply your changes after the upgrade. Any modification you made to web.config or other common files will also need to be re-applied after the process.

If you made modifications to permissions on the files and folders inside your site, they may also get reset in the upgrade and need to be re-applied.

更新运行实例到新版本

下列的指导意见只适用单独的Orchard web站点,如果你是工作在源代码的orchard,请看相关的部分。

强烈建议在整个升级过程中工作在一个本地站点的备份中进行

  • 备份你站点的所有事物,包括数据库。这一点特别重要,以确保在迁移过程中不管发生了任何事情都可以回退到目前运行的站点.
  • 访问你的当前实例的站点设置页面(Settings pages)记录下当前的设置. 这些信息也行在迁移过程中不需要,但如果需要,很难获取这些信息。
  • 访问 你当前实例的Modules/Features 页和 Themes 页 ,记录下所有你已经安装的模块和主题.
  • 从服务器下载站点的备份到你的本地电脑.如果你是定期从模拟环境到发布站点到生产环境,你已经有了本地备份,但数据和媒体也许是过期的。 确保你从服务器下载了.AppData_ 和Media目录.
  • 如果你使用的是 SQL Server Compact 数据库, 你已经通过下载AppData_目录拷贝了站点数据.如果你的站点使用的是SQL Server, 你可以拷贝这些数据到本地服务器,用来处理最新的数据。然而,这对迁移并不是必须的. If you wan如果你想用本地的数据库,,也需要编辑每个租户的settings.txt 文件.  settings.txt文件可以在 can be  AppData\Sites\Default_ 或者 AppData\Sites\[NameOfTheTenant]_的目录下找到。
  • 在一个新的空的目录下,安装最新的orchard版本,但不要安装。
  • 拷贝你原来的站点的 Media 目录到新站点。
  • 拷贝你原来的模块和主题目录到新站点不存在的模块和主题目录下。
  • 拷贝AppData_ 目录到新的站点中.
  • 指向本地web服务到新的目录。你可以使用IIS,在这种情况下,使用IIS Manager来创建一个新的web站点指向新的目录. 或者,你可以使用 WebMatrix 和 IIS Express; 为此,在windows 资源管理器在右键选择 Open as a Web Site with Microsoft WebMatrix然后运行站点. 最后,你可以用vs打开站点运行。
  • Go into the dashboard. You're prompted to upgrade features. Click Modules and upgrade each of the modules one by one until they are all up to date.
  • If you are upgrading from 1.0, the Recipes feature is disabled at this point, and unfortunately it can't be enabled from the admin UI. Open an Orchard command-line and execute the following command:

    feature enable Orchard.Recipes

Alternatively, if you can't run the command-line, you can use the web command-line from the Experimental module. Once the Web Command Line feature has been enabled, the web command-line can be navigated to by going to /Experimental/Commands. A third alternative is to unzip the following archive under a new Upgrade.From.1.0 folder under Modules: Upgrade.From.1.0.zip. Enabling the Upgrade From 1.0 feature will enable the Recipes module. Once this is done and you've verified that Recipes are enabled, you can safely delete the upgrade.from.1.0 folder from Modules. * Go to the Orchard Gallery and get the latest version of all the modules you have on your site.

Publishing the Upgraded Site

You can deploy the locally upgraded site to your production server using your preferred deployment solution. That might be Visual Studio Web deployment, WebMatrix, or even FTP. You again have a choice of wiping out the target directory before you deploy. Make your choice depending on your deployment method, how clean you want the resulting directory to be, and on how long it's acceptable to keep the site down.

As you deploy, make sure that the target settings.txt files aren't overwritten, so that the production site continues to point to the production database.

While you deploy, you might want to shut the site down by dropping an appoffline.htm_ file into the root. Remove that file once you're done.

Upgrading An Orchard Site In-Place

It is possible to upgrade a site in-place, if you can't or don't want to work with a local copy and then publish it. The procedure is less clean but it works.

  • Backup everything (site and database).
  • Download the new version to your local machine.
  • Add App_offline.htm to the root of the site during the upgrade. This effectively tells the web server to return this page for all requests. You should put a message such as "The site is currently being updated. Thank you for your patience. Please try again later." in the file.
  • Delete what's in bin. This ensures that old versions of binaries that won't get replaced will not continue to be picked up by the application.
  • Delete the App_Data\Dependencies folder. Orchard will rebuild this folder on startup. This ensures that old versions of module assemblies will not be picked up by the application.
  • Extract the new version's zip file and copy what's in its Orchard folder over the server's Orchard web directory (answer yes to all prompts to overwrite).
  • Remove the app_offline file.
  • The site should be running now. Log-in and go into admin.
  • Modules need to be updated. Do each of them.
  • If you are upgrading from 1.0, the Recipes feature is disabled at this point, and unfortunately it can't be enabled from the admin UI. Open an Orchard command-line and execute the following command:

    feature enable Orchard.Recipes

Alternatively, if you can't run the command-line, you can use the web command-line from the Experimental module. Once the Web Command Line feature has been enabled, the web command-line can be navigated to by going to /Experimental/Commands. A third alternative is to unzip the following archive under a new Upgrade.From.1.0 folder under Modules: Upgrade.From.1.0.zip. Enabling the Upgrade From 1.0 feature will enable the Recipes module. Once this is done and you've verified that Recipes are enabled, you can safely delete the upgrade.from.1.0 folder from Modules.

You are done.

Upgrading an Azure Instance of Orchard

  • You should already have the full source code, with your modifications if you had any (additional modules or themes). Upgrade that by copying the source of the new version over it (overwrite whenever asked), or by doing a Mercurial update to the desired version. If you do not already have the full source code, then that means you don't have any changes to the default distribution. In that case just get the source code for the new version. In any case, at this point you should have a local directory on your development machine that has the code for the new version, plus any themes and modules you may have added, and no data (be it media or database, as on Azure you are using blob storage for the former, and Sql Azure for the latter). All that remains to be done is to build the new package and deploy it.
  • Run clickToBuildAzurePackage.cmd. This file should be at the root of your source code folder. If it's not there (it was missing from older release files), get it and other root files from the relevant version in http://orchard.codeplex.com/SourceControl/list/changesets
  • Unzip artifacts/Azure/AzurePackage.zip
  • Open ServiceConfiguration.cscfg and replace the value of the DataConnectionString with your DefaultEndpointsProtocol=https;AccountName=your-account-name;AccountKey=your-account-key
  • Open the Azure Management Portal, go to Hosted Services, Storage Accounts & CDN and choose your deployment target. Click Upgrade.
  • Browse to the package and config file, click OK.
  • Log-in and go to admin.
  • Upgrade features.
  • If you are upgrading from 1.0, you need to enable the Recipes module. Enable the Web Command Line feature. Go to /experimental/commands and type "feature enable Orchard.Recipes". Hit return. You may disable the web command line feature.

You're done.

If You Have a Source Code Enlistment

If you are working with a source code enlistment, the update process is going to be extremely simple because you are already going through it every time you sync your source code directory with the repository. When the time comes to upgrade, just get the latest changes and sync to the latest in the default branch.

Import/Export

The Import/Export module can be used to do clean data migrations from one version to another.

Applying a framework patch

Occasionally, we may release small updates in the form of a patch to one or several dlls. These patch files are regular zip files that contain updated dll files.

To install such a patch, first extract the zip, then make a copy of the version of those files that are already in the bin folder of your site. Then, replace the existing copy with the one from the patch file.

原文地址:https://www.cnblogs.com/zsanhong/p/3117173.html