Deploy Orchard.Source to Azure via GIT
Asked Answered
E

3

6

UPDATE this question has evolved and was expanded, based on the answers given so far.

I want two things: (1) Visual Studio as my Orchard development environment and (2) GIT as my means to push to Azure. To achieve this, I downloaded the Orchard.Source distro instead of the Orchard.Web distro.

So, I used GIT to publish the Orchard.Source.1.5.1 distro from a repository on my local machine to an Azure web site (preview technology). The deployment worked, but the subsequent build on Azure failed because it could not determine which solution was "the one" it should build:

remote: Unable to determine which solution file to build. C:\DWASFiles\Sites\MySite\VirtualDirectory0\site\repository\src\Orchard.sln, C:\DWASFiles\Sites\MySite\VirtualDirectory0\site\repository\src\Orchard.Azure\Orchard.Azure.sln, C:\DWASFiles\Sites\MySite\VirtualDirectory0\site\repository\src\Orchard.Azure\Orchard.Azure.Web\Modules\Orchard.ContentTypes\Orchard.ContentTypes.sln, C:\DWASFiles\Sites\MySite\VirtualDirectory0\site\repository\src\Orchard.Azure.Tests\Orchard.Azure.Tests.sln, C:\DWASFiles\Sites\MySite\VirtualDirectory0\site\repository\src\Orchard.Web\Modules\Orchard.ContentTypes\Orchard.ContentTypes.sln. remote: Error - Changes committed to remote repository but your website not updated.

The first solution Azure listed in that dump is the one it should be using. How do I tell that to Azure?

With help from David Ebbo, I now understand that I was asking the wrong question:

  1. the problem is solved with a '.deployment' configuration file and
  2. pointing to the "correct" Visual Stuio solution is incorrect! To deploy to Azure through GIT, I must point to a project file (in this case, Orchard.Web.csproj):

    [config]
    project = src/Orchard.Web/Orchard.Web.csproj

This gets me further along, but my next problem is that I intentionally omitted the 'lib' folder of Orchard.Source from my GIT repository. I figured, wrongly, that if I enabled "nuget restore" for the Orchard.sln, the build of the project files in Azure would fetch needed dependencies.

With the help of Sebastien, I now understand enabling nuget may be an uphill battle because some number of Orchard 3rd party dependencies have had source-level customizations by the Orchard team. In short, if I want to get up and running quickly with the Orchard.Source distro - then I need to simply commit the 'lib' folder into my GIT repository (darn!).

When I did my next push to Azure through GIT, my compilation still failed - but at least the number of errors were reduced dramatically. I think the only thing it is upset with now is this:

For OrchardFramework.csproj:
   Could not find assemblies: Castle.Core, Casstle.DynamicProxy2
   Missing type or namespace: Castle, AbstractLoggerFactory, DefaultProxyBuilder

If I can overcome this issue, I might finally have the best of boths worlds: a Visual Studio development environment (due to the Orchard.Source distro) and a GIT-enabled push to Azure. Anyone know what this last issue might be?

p.s. there is a "ClickToBuildAzurePackage.cmd" file in the Orchard.Source distro, which was created before the "GIT push to Azure" was created. That little batch file attempts to duplicate much of the work that a GIT push to Azure now offers. I may explore that option more, but of course the ideal situation would be to rely on the new Azure built-in capabilities.

UPDATE 2: It turns out this is simply because lib/*/Castle Windsor 2.0/bin/* is being ignored by .gitignore. Having forced those files in as well, the whole thing now builds and deploys! Only issue now is the site does not give a response when I visit it. I'll turn that into a seperate question if necessary. As is, I consider this particular question answered.

Epitomize answered 1/10, 2012 at 16:50 Comment(0)
G
5

Orchard is not using Nuget for its dependencies, which means the libraries are checked in into the source control system, and you need them if you deploy by source.

There is a very good tutorial on installing Orchard on Windows Azure Web Sites using Git Publishing by David Hayden: http://www.davidhayden.me/blog/git-publishing-orchard-cms-to-windows-azure

Garlandgarlanda answered 2/10, 2012 at 16:39 Comment(4)
David's instructions apply "if you download Orchard.Web from CodePlex", but instead I want Orchard.Source from codeplex because I intend on doing development from Visual Studio. In that case, his instructions do not apply. But as it is, you have already given me the best insight yet: the Orchard.sln does not use nuget (doh!). So that I can avoid placing those dependencies into GIT, perhaps then I should convert the Orchard.sln and projects to use nuget. Yes? Would I encounter any big hurdles with converting the Orchard solution that way?Epitomize
You can't use Nuget for every library as we may apply custom patches to open source libraries. But you should be able to do so for most of them.Loyalist
I don't like it, but to avoid the nuget issue for now, I've simply chosen to add the 'lib' folder of the Orchard.Source distro into my GIT repository. I then published, and found that the compilation on Azure still didn't work, but produced far less errors. I think it is merely because OrchardFramework.csproj cannot find dependant assemblies Castle.Core and DynamicProxy2. If those are normally built/supplied by the Orchard.sln build, then I can understand what happened. Otherwise, why do you suppose there is trouble in that one spot?Epitomize
I've updated my question to reflect the final fix necessary. It now works. Well, at least it builds and deploys successfully. When I visit the site the browser waits endlessly for a response. I'll turn that into a new question if necessary.Epitomize
D
6

You can specify a project to deploy using a .deployment file at the root of your repo. See https://github.com/projectkudu/kudu/wiki/Customizing-deployments for more info.

Also, see https://github.com/AzureWebSites/OrchardCMS for an example of an Orchard repo that works in an Azure Web Site (but it's a bit outdated).

Duomo answered 1/10, 2012 at 18:18 Comment(5)
I just watched your video (youtube.com/watch?v=72SAHWUHnzA), which implies that I can safely omit the Orchard lib folder, because Azure should be able to pull all those dependencies via nuget by itself. Yes? When it pulls those via nuget, does it count against my network band-width consumption?Epitomize
Ok, the .deployment file with src/Orchard.sln failed because it thinks Orchard.sln is a path rather than a file. But the problem was solved by specifying only src. My next problem is that Azure cannot launch the site. The file structure of the Orchard-source distro doesn't work on Azure. I don't understand why not; if Azure can build the Orchard.sln file, it assuredly can create the virtual folders or move files into position, yes? If not, does this mean I must use the Orchard-Azure distro? I thought that was only for non-coders who wish to use the Azure Gallery?Epitomize
Did you try the repo I pointed to above? I should just work as is. I'm not an Orchard expert, so you might need @sebastien-ros's help if you get stuck.Duomo
that particular repo "hands me a fish" rather than "teaching me how to fish." So yes, hopefully sebastien will divulge not just the repo, but what makes that repo useable by Azure. See my question here: social.msdn.microsoft.com/Forums/en-US/…Epitomize
Brent - did you ever figure this out? I too am trying to convert my production Orchard instance > Git deployment in WAWS. I have a source enlistment that I branch from locally to add my tweaks. Currently I then run the local build scripts to build everything, but would ideally love to PUSH my updates > a WAWS instance.Pepsinogen
G
5

Orchard is not using Nuget for its dependencies, which means the libraries are checked in into the source control system, and you need them if you deploy by source.

There is a very good tutorial on installing Orchard on Windows Azure Web Sites using Git Publishing by David Hayden: http://www.davidhayden.me/blog/git-publishing-orchard-cms-to-windows-azure

Garlandgarlanda answered 2/10, 2012 at 16:39 Comment(4)
David's instructions apply "if you download Orchard.Web from CodePlex", but instead I want Orchard.Source from codeplex because I intend on doing development from Visual Studio. In that case, his instructions do not apply. But as it is, you have already given me the best insight yet: the Orchard.sln does not use nuget (doh!). So that I can avoid placing those dependencies into GIT, perhaps then I should convert the Orchard.sln and projects to use nuget. Yes? Would I encounter any big hurdles with converting the Orchard solution that way?Epitomize
You can't use Nuget for every library as we may apply custom patches to open source libraries. But you should be able to do so for most of them.Loyalist
I don't like it, but to avoid the nuget issue for now, I've simply chosen to add the 'lib' folder of the Orchard.Source distro into my GIT repository. I then published, and found that the compilation on Azure still didn't work, but produced far less errors. I think it is merely because OrchardFramework.csproj cannot find dependant assemblies Castle.Core and DynamicProxy2. If those are normally built/supplied by the Orchard.sln build, then I can understand what happened. Otherwise, why do you suppose there is trouble in that one spot?Epitomize
I've updated my question to reflect the final fix necessary. It now works. Well, at least it builds and deploys successfully. When I visit the site the browser waits endlessly for a response. I'll turn that into a new question if necessary.Epitomize
I
2

The following are our high level steps and common gotchas.

High Level Steps

  1. Clone the Orchard Source into SomeDirectory
  2. Add a .deployment file to SomeDirectory (e.g. from PowerShell, ni –t f .deployment)

Checkpoint: SomeDirectory will now contain:

.git
.deployment 
lib 
src 
.gitignore 
build.cmd 
ClickToBuild.cmd 
ClickToBuildAzurePackage.cmd 
CREDITS.txt 
DeleteModuleBinaries.cmd 
LICENSE.txt 
Orchard.proj
  1. Next, open a Developer Command Prompt at SomeDirectory.
  2. Run build precompiled.

Checkpoint: SomeDirectory will now contain two more sub-directories:

build 
buildtasks
  1. Next, open your .deployment file...

...and add the following:

[config] 
project = build/precompiled
  1. Add, commit, and push your files to GitHub (or wherever).
  2. Create a new Windows Azure website.
  3. Select deployment from version control > GitHub > etc.
  4. Wait for deployment to complete.
  5. Test...

Viewing Your Azure Website through FTP will display the following:

ftp

Viewing Your Site through the Browser will display this:

web

Common Gotchas

  1. If you have a .gitignore file that ignores the build/ directory, you must ask git to force add everything from the precompiled folder (except App_Data and Media, because they will contain live stuff that we add from the Orchard UI).

Example:

git add –-f  bin/*
git add –-f Config/*
git add –-f Core/*
git add –-f Modules/*
git add –-f Themes/*
git add –-f CREDITS.txt
git add –-f Global.asax
git add –-f LICENSE.txt
git add –-f Refresh.html
git add –-f Web.config
(Yes. Git is case sensitive).
  1. If you have forgotten to save your .csproj file after adding, removing, excluding, or including new files, then the Git Deploy will complain that it cannot find certain files.
Immoral answered 13/11, 2014 at 20:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.