How to deploy an Orchard CMS site, including all settings and content from development environment?
Asked Answered
T

3

30

I've been trying to build and deploy a website running on Orchard CMS. I've previously downloaded Orchard, set up a development environment, made a few modifications to the source, added and modified a theme, added some content and so forth. I've been using the SQL CE as database. Now I want to build and deploy the complete website. I've built a deployment package by running the build script, as described here. It's easy to simply ftp the built package to the hosting server. However, when visiting the site I now get the install a new site procedure. Apparently, the cms settings and content from my development environment have not been reflected in the deployment package. Thus, I need to copy all the content and re-do all the settings, including creating all widgets etc. again.

Does anyone have any good ideas on how to publish an Orchard site from a development to a production environment, including the cms settings, widget settings, content, etc? All guides I've found on the web describe how to use WebMatrix to deploy an Orchard site to shared hosting or Azure, but all of those guides end up with having a clean Orchard installation. What I would like to achieve is to develop the site locally, and then push the entire site to the hosting server.

Tetter answered 19/6, 2011 at 18:30 Comment(0)
P
21

If you have built a deployment package and transferred it to your server (via FTP), you are almost done. There are two things you have to do after that. Remember, do not run the first-time setup.

  1. Copy the ~/App_Data folder from development to production. If transferring the files with ftp, make sure to transfer in binary mode. Make sure that the account, under which the AppPool runs has read/write permissions to that folder.
  2. If you use SQL Server Compact. Do nothing - the database has already been copied in 1.
  3. If you use SQL Server 2005/2008 database. Migrate your db to production environment. Next, change the connection string to point to the new database inside Settings.txt file located under ~/App_Data/Sites/Default.

After that, you can run your site and everything should be ok. So in your scenario, you can only copy the folder from 1. and you'd be set.

Psychopathy answered 19/6, 2011 at 19:29 Comment(11)
I tried that exact method, but when I go to the site I get the an "Illegal characters in path." error. The strange thing is that the erranous path is a path at my local filesystem: Orchard.WarmupStarter.Starter.OnBeginRequest(HttpContext context, Action`1 registrations) in c:\Projects\Site\src\Orchard.Startup\Starter.cs:20 - This baffles me a bit since I have a hard time understanding why there is a hard reference to a file at a local filesystem. Got any ideas?Tetter
Found the reason for this error here: orchard.codeplex.com/discussions/252775 Apparantly it's very important that settings.txt in App_Data is transfered as binary and not ascii. However, the settings for all my added modules seems to be lost. Are not these persisted in the database?Tetter
All module settings are persisted in the DB. I forgot to add one thing - you should enable all modules you had enabled in production env - from Dashboard/Modules panel. Clean install has all custom modules turned off by default.Psychopathy
Thanks for all your help. I tried to enable them from Dashboard/Modules, but they were not even there. So I had to go to the gallery and install them again. During the installation Orchard backed up the old version - so even tho the modules existed they were not shown on the Dashboard/Modules panel. Possible bug perhaps?Tetter
Don't install those modules directly from the Gallery, as all related data is in the db and installation of some modules may fail (trying to create existing tables). Just copy the modules you had in Orchard.Web/Modules directory on your dev env to ~/Modules folder on production. Everything should work ootb.Psychopathy
They were probably not showing because the system could not load them. And it could not load them because of that bad setting you had in FTP. You should never use ascii when transmitting over FTP. I would just delete everything and start over, if I were you.Chapell
Don't forget the Media folder.Poppy
@ShaunLuttin Could you please be more precise? Is there anything specific in your scenario? This solution is only about transferring an already working, compiled site between envs. Are you 100% sure that it works in exactly the same setup somewhere else? Most importantly - have you tried running it under the same version of IIS (not Express) locally?Psychopathy
@PiotrSzmyd I was trying to deploy to a Windows Azure Web Site from a source drop. I have since figured out how to do this and am submitting my solution as a pull-request to the OrchardDocs on GitHub.Glaab
To get the dev modules enabled in the production environment use a orchard recipe docs.orchardproject.net/Documentation/Making-a-Web-Site-RecipeTrichite
When I run msbuild using the Precompiled target as described here: docs.orchardproject.net/Documentation/… I get two subfolders in the build directory: precompiled and stage. According to the docs I should FTP the 'precompiled' folder to my shared hosting, but I see a lot of comments specifying that the 'Stage' folder should be used instead. So which one is it? What is the difference?Superhuman
S
14

I really appreciate the answer from Piotr first of all. I also like to add here what I've found based on Piotr's answer. Here are my steps to deploy Orchard project after spend few days to figure it out what the easiest way to deploy. [Overall concept and requirement to deploy] 1. Using Visual Study 2010 (or equivalent tool) and compile all the projects. In this stage, there is no hidden or complicate process for compile all the code, right?

  1. Run "ClickToBuild.cmd" to build from the command console. Here is the tricky steps here. You can get lots of help from http://stefantsov.com/msbuild-and-msdeploy-for-orchard in order to edit Orchard.proj file. You may facing lots of errors, which is red colored, that you have to remove by comment out in Orchard.prof file. Don't forget to run command window as an administrator mode. Once you successfully compile and build by ClickToBuild.cmd, you are ready to move to next step. Don't border to build for test project. I just commented out all the test projects to build.

  2. If you have missing media files, copy files from ~\src\Orchard.Web\Media*.* to ~\build\Stage\Media\ folder.

  3. Copy all files from ~\src\Orchard.Web\App_Data folder to ~\build\Stage\App_Data except log folder. If you want to change the default URL which is "OrchardLocal", you could edit from either admin page or manually change on the code. (or just keep the same name of app when you insert new app on IIS).

  4. Create (or Add) new application on IIS server. Make sure your application pool sets to "integrate mode" rather than classic.

  5. If you have broken links of pages, you should go to admin page. And make sure the base url is matched with your default url from /admin/settings/Index page. Go to Naviation menu in admin page and validate all the Urls as well.

Even though I have some bugs, which I cannot see Bing-map/facebook windows yet, every thing works fine now. Hope this help.

Spatula answered 18/8, 2012 at 17:20 Comment(0)
T
0

In addition to copying the app_data folder approach, you can use a concept called Orchard recipe that allows you to export and import content/modules so when you install it in live environment all you need to do is to select the recipe and everything get enabled as needed. Read more on http://docs.orchardproject.net/Documentation/Making-a-Web-Site-Recipe

Trichite answered 3/4, 2014 at 8:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.