This project is read-only.

Repeating changes between development/production

Topics: General
Apr 6, 2011 at 6:41 PM

I'm trying to get my head around the best way to make steps repeatable between a development environment and a production environment? For example, lets say I want to create a layer and add some widgets to it. I can go to the admin screens in my development envionment and add the layer and add the widgets to it, but then I would have to go and do the same manual steps in my production environment.

Should I instead figure out how to do this in code and add it to a module so I can package and deploy it wherever I need it? or since this all ends up in the database should I be thinking of moving data?

I guess part of the problem I'm having is that everything ends up in the database but adding a layer of widgets to my site is more like development while a visitor adding a comment to a blog post is not.

Any help in clarifying my thinking on this would be appreciated.

Apr 6, 2011 at 6:45 PM

You could do that, or you could use the command line and build batch files for that sort of thing.

Apr 6, 2011 at 6:59 PM

You might also want to look at the Recipes feature coming in 1.1 - it lets you describe a complete deployment such as the scenario you described.

Apr 6, 2011 at 7:22 PM

Thanks for the quick responses.

I had thought at first glance that recipies were only for setup but since you can import and export them and add them to modules I assume that means they can also be used to make changes to an existing deployment. Please correct me if I'm wrong. 

That's exactly the type of thing I'm looking for. You can even execute commands, that's really nice.

Apr 6, 2011 at 7:34 PM

Recipes can now also be included in a module and be executed at the time the module is setup.

Aug 18, 2011 at 8:20 PM

In an answer to a different question ( I've read:

sebastienros wrote:

Everything which is done in the UI can be done as a module, or during any event in this module. And everything which is persistent, is in the database, yes.

This is good news! We're trying to build a fairly large web application (actually: rewrite it using Orchard) and the whole manual administration paradigm doesn't really fit into our development process.

Where can we find more guidance on how to do all the stuff that we can do manually in the admin area using code or some other way of automization? This includes e.g.

  1. Installing modules from the gallery, and activating features (the latter of which I've already done from the orchard cmd).
  2. adding ContentParts to ContentTypes (using ContentDefinitionManager.AlterTypeDefinition)
  3. adding ContentFields to ContentParts (using ContentDefinitionManager.AlterPartDefinition)
  4. adding Widgets to Zones
  5. customizing Widgets
  6. how to use recipes (for complex scenarios)
  7. and much, much more

I've also seen the empty documentation page - do you plan to update it anytime soon? I'd really appreciate it :-)

Regards, Oliver

Aug 18, 2011 at 8:27 PM

Maybe you would like to learn more about commands. There is a console administration application where you can run commands, provided by modules. So for instance, you can install a module using a command, enable it using another command ... And if you don't find all the commands you need, you can create a module with more commands. Then those commands can be executed through command lines or recipes. You can find examples of recipes in the Orchard.Setup/Recipes folder.

As for the empty documentation page ... sorry. We have a PM though, let's bother him ;)

Aug 20, 2011 at 12:57 PM
Edited Aug 20, 2011 at 12:59 PM

Thanks Sebastien!

I've already used the console application to add modules and such (as stated under 1.) but I wasn't aware of the fact that it's so easy to add my own. I've also already found the Widgets commands and will look for more when needed.
What we are keenest on learning right now is how a code-only approach to application development (and deployment) using Orchard can be made work and what difficulties people have encountered on their way. But I'll post that to a new question.
Aug 20, 2011 at 1:37 PM
Edited Aug 20, 2011 at 1:37 PM
bertrandleroy wrote:

Recipes can now also be included in a module and be executed at the time the module is setup.

I guess the question iamegghead and I really have/had is whether I can execute them once the module is already deployed, e.g. from the Migrations.cs.

I found a MigrationsRecipeHandler which by its name sounds like it should help in doing that - but how do you use it? Found this code in ModuleRecipeHandlerTest.cs:

    ModuleRecipeHandler moduleRecipeHandler = _container.Resolve<ModuleRecipeHandler>();

    RecipeContext recipeContext = new RecipeContext { RecipeStep = new RecipeStep { Name = "Module", Step = new XElement("SuperWiki") } };

Should I use something like that, parsing the Recipe file from disk to execute it when updating a module? How do I update a module e.g. from the Orchard command line? Found only

    "feature enable/disable"

in the Modules module.


Somehow the whole process still seems awkward to me - nothing like coding -> staging ->deploying. Is this just how Orchard was designed and how it works?

Aug 22, 2011 at 8:39 PM

If all you need is to enable a feature, you should not use a recipe. You can look at the code for the feature enable recipe command and replicate what it is doing.

Sep 14, 2011 at 8:23 AM

Is it possible to change settings with recipes? For example you can install and enable Orchard.Email feature for Orchard.Email module, can you also provide Sender email address, Host name, port number... that are located under Dashboard/Settings/Email?



Sep 14, 2011 at 8:25 AM

Yes. You can even see how that would look by exporting after setting up.

Sep 14, 2011 at 8:29 AM

Ok I figured it out.

Just install import/export module and export "Site Settings" under Dashboard/Import Export/Export generate export.xml and copy stuff to you recipe!