Orchard Source -> Git Repo -> Azure Website

Topics: Administration, General
Developer
Jan 29, 2013 at 11:42 PM

Hello,

I'm trying to wrap my head around deploying Orchard as an Azure Website from my source control.

I recently copied Orchard1.6 from source and added it in its entirety to my source control.

From there we've added a series of modules and a theme, tied in the end via a custom recipe that builds our site.

So a developer in my team has to checkout source, run the solution in visual studio, and initialize with our recipe.

I'm just starting to figure out how to deploy this to Azure as a website.

http://stackoverflow.com/questions/12677574/deploy-orchard-source-to-azure-via-git

Out of the all the googling I've done what I'm trying to do matches closest to this person.

One difference between he and I is that I have the lib folder in my source control.

My first attempt landed me with a 500 Error. Before I had the chance to disable custom errors, I noticed that the Modules and Themes folders were not present.

I followed steps contained in these two links:

https://github.com/projectkudu/kudu/wiki/Customizing-deployments

http://blog.amitapple.com/post/38417491924/azurewebsitecustomdeploymentpart1

To build by own deploy.cmd which takes care of that aspect.

The nuts of it is as follows...

:: Deployment
:: ----------

echo Handling .NET Web Application deployment.

:: 1. Build to the temporary path
%MSBUILD_PATH% "%DEPLOYMENT_SOURCE%\src\Orchard.Web\Orchard.Web.csproj" /nologo /verbosity:m /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="%DEPLOYMENT_TEMP%";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="%DEPLOYMENT_SOURCE%\src"
IF !ERRORLEVEL! NEQ 0 goto error

:: 2. KuduSync
echo Kudu Sync from "%DEPLOYMENT_TEMP%" to "%DEPLOYMENT_TARGET%"
call %KUDU_SYNC_COMMAND% -q -f "%DEPLOYMENT_TEMP%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.deployment;deploy.cmd" 2>nul
IF !ERRORLEVEL! NEQ 0 goto error

:: 3. KuduSync Modules
echo Kudu Sync from "%DEPLOYMENT_SOURCE%\src\Orchard.Web\Modules" to "%DEPLOYMENT_TARGET%\Modules"
call %KUDU_SYNC_COMMAND% -q -f "%DEPLOYMENT_SOURCE%\src\Orchard.Web\Modules" -t "%DEPLOYMENT_TARGET%\Modules" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.deployment;deploy.cmd" 2>nul
IF !ERRORLEVEL! NEQ 0 goto error

:: 4. KuduSync Themes
echo Kudu Sync from "%DEPLOYMENT_SOURCE%\src\Orchard.Web\Themes" to "%DEPLOYMENT_TARGET%\Themes"
call %KUDU_SYNC_COMMAND% -q -f "%DEPLOYMENT_SOURCE%\src\Orchard.Web\Themes" -t "%DEPLOYMENT_TARGET%\Themes" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.deployment;deploy.cmd" 2>nul
IF !ERRORLEVEL! NEQ 0 goto error

This has allowed my deployment to copy these two folders.

Now I have disabled CustomErrors and I see my current error is this.

[RuntimeBinderException: 'ClaySharp.Clay' does not contain a definition for 'Add']
   lambda_method(Closure ) +34
   ClaySharp.ClayBehavior.InvokeMemberMissing(Func`1 proceed, Object self, String name, INamedEnumerable`1 args) +9
   ClaySharp.<>c__DisplayClass34.b__31() +32
   ClaySharp.ClayBehavior.InvokeMemberMissing(Func`1 proceed, Object self, String name, INamedEnumerable`1 args) +9
   ClaySharp.<>c__DisplayClass34.b__31() +32
   ClaySharp.ClayBehaviorCollection.Execute(Func`1 proceed, Func`3 linker) +25
   ClaySharp.ClayBehaviorCollection.InvokeMemberMissing(Func`1 proceed, Object self, String name, INamedEnumerable`1 args) +92
   lambda_method(Closure ) +352
   ClaySharp.Behaviors.NilBehavior.InvokeMember(Func`1 proceed, Object self, String name, INamedEnumerable`1 args) +32
   ClaySharp.<>c__DisplayClass16.b__13() +32
   ClaySharp.ClayBehavior.InvokeMember(Func`1 proceed, Object self, String name, INamedEnumerable`1 args) +9
   ClaySharp.<>c__DisplayClass16.b__13() +32
   ClaySharp.ClayBehaviorCollection.Execute(Func`1 proceed, Func`3 linker) +25
   ClaySharp.ClayBehaviorCollection.InvokeMember(Func`1 proceed, Object self, String name, INamedEnumerable`1 args) +92
   CallSite.Target(Closure , CallSite , Object , Object ) +488
   System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2(CallSite site, T0 arg0, T1 arg1) +450
   Orchard.UI.Resources.ResourceFilter.OnResultExecuting(ResultExecutingContext filterContext) +732
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +41
   System.Web.Mvc.<>c__DisplayClass1c.b__19() +22
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +245
   System.Web.Mvc.<>c__DisplayClass1c.b__19() +22
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +245
   System.Web.Mvc.<>c__DisplayClass1c.b__19() +22
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +245
   System.Web.Mvc.<>c__DisplayClass1c.b__19() +22
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +245
   System.Web.Mvc.<>c__DisplayClass1c.b__19() +22
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +176
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +311
   System.Web.Mvc.<>c__DisplayClass1d.b__19() +23
   System.Web.Mvc.Async.<>c__DisplayClass1.b__0() +19
   System.Web.Mvc.Async.<>c__DisplayClass8`1.b__7(IAsyncResult _) +10
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +39
   System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +23
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +29
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
   System.Web.Mvc.<>c__DisplayClass8.b__3(IAsyncResult asyncResult) +25
   System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +23
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +31
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   Orchard.Mvc.Routes.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) +25
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9629708
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

I'm led to believe this is a  result of a dynamic compilation and permissions issue, but I'm not sure.

Any insight would be greatly appreciated.

-Stanley

Coordinator
Jan 30, 2013 at 5:30 PM

Did you try to add this file to your solution before deploying it ?

https://github.com/AzureWebSites/OrchardCMS/blob/master/.deployment

 

Jan 30, 2013 at 10:29 PM
When you build the project locally on your machine does it work properly?

You don't have to do a custom deployment in this case as these folders are supposed to be copied as part of your build, can you verify whether that's happening when you build your site locally?

Thanks,
Amit
Developer
Jan 30, 2013 at 11:54 PM
Edited Jan 31, 2013 at 12:09 AM
@sebastineros,
I had a .deployment file.
I used it to call my deploy.cmd, which I submitted above.

In general though, I realized I was looking at things through the wrong lens.
I'm used to more custom applications, where it makes a lot more sense to deploy the application like this.

[shameless plug]
http://www.justaprogrammer.net/2012/10/18/continuous-integration-with-windows-azure-sdk-1-7-powershell-and-tfs-build-too/
[/shameless plug]

So for my production server I expect to export Orchard Modules which I will upload to my Azure Website.
Which is backed by SqlAzure, pretty standard.

For my development server I have two different recipes, one with the production site configuration and one with test data added.

I wanted to be able to allow a developer to start the development environment from "scratch" with or without test data.
So we agree to set this environment up using SQL Compact.

Using lftp (a windows build of scriptable ftp client) and the following script...
debug 10
set ssl:verify-certificate no
open ftp://[YourAzureWebSiteName]\[YourAzureDeploymentUser]:[YourAzureDeploymentPassword]@[YourAzureFTPHostName].ftp.azurewebsites.windows.net
rm -r site/wwwroot/App_Data
rm -r site/wwwroot/Media/Default
mirror -Re build/Stage site/wwwroot
After developers build the source using ClickToBuild.cmd.
lftp -f developmentdeployment.lftp_script
Developers are able to clear site data and redeploy the environment.

Let me know what you think

-Stan
Coordinator
Jan 31, 2013 at 12:22 AM
Interesting...