Sitecore best practices [closed]
Asked Answered
B

5

7

We are setting up our first migration to Sitecore. We have multiple multi-lingual sites with content stored in database fields with LCID. User controls make database calls to show different language content. We are migrating our content to Sitecore items and would like to leverage the Sitecore API to get the content from our User Controls to build data structures.

I would like to know how to structure Visual Studio projects for Sitecore development in order to use the existing VS solutions. Do we duplicate Sitecore .dlls and configs to all solutions, or share one Sitecore installation?

Also, how do you install the required files in production to support multiple sites which exist as separate websites in IIS? Do we have to have duplicate copies of all the required .dlls and config files in a seperate /sitecore folder for each website, or we share one folder with a virtual folder in each site pointing to the same physical /sitecore folder?

Borzoi answered 5/8, 2009 at 21:26 Comment(0)
V
6

In my experience, the "everything under 1 IIS Website" for multiple sites with Sitecore only works when you don't have the following:

  1. Different SSL certificates per site: IIS will only allow one SSL certificate per IP address/port combination and only one per Website in IIS. We have 4 different wild card SSL certs (for 4 different base domains) and so we have to have at least 4 separate IIS Websites.
  2. Different Virtual Directories per site: If you want a virtual directory available off one website but not the other, you have to have different websites in IIS.

If you have either of these requirements, they must be different websites in IIS (or the requirements must be handled outside IIS).

As for how do you set this up, one thing to keep in mind is that we were told that having multiple installs of Sitecore on a server requires a different/multiple licenses.

So for us, we had to share the same install with multiple sites in IIS because we had both of these requirements (and only one license). We had all the websites share the same Sitecore install (all files shared, including DLLs and web.config). The draw backs to this are:

  • that any config or DLL changes cause restarts for all websites
  • that each website has its own application domain (so it multiplies the memory requirements, and in-memory cache isn't shared)
  • that application domain is basically a separate process, so any maintenance or scheduled operation (i.e. clearing the media cache) runs on every website and accesses the same files. This can cause performance and concurrency issues. We had to kick off some of these process from externally scheduled tasks and only on our editing website to prevent conflicts.
  • since we only have one config file, we couldn't turn off editing features for the content delivery websites. This means that we had to use IIS's features to prevent editing on the content delivery websites.
  • we had to treat it like a multi-server install of sitecore, meaning we had to setup a stager to clear the cache on publish. we used the stager available in the Shared Source Library.
Valenta answered 3/8, 2011 at 15:41 Comment(0)
F
4

In general we recommend to run everything under 1 IIS website. This saves a lot of configuration and deployment issues. Beside of that, it's not necesarry performance wise to use multiple websites.

Settings up the projects can be done pretty straight forward. Simply make sure the build targets are set towards the /Website/bin-folder of the Sitecore installation. If so, you're able to reuse anything. You can link the Sitecore.Kernel as a Solution Item in Visual Studio.

Overall I think that you should consult your local Sitecore office to think with you setting up this solution. As we're experienced with these kind of migrations, we're happy to give you the right advice and discuss all options.

Farther answered 13/8, 2009 at 9:13 Comment(0)
D
2
  • You should start with a blank web application solution with no /sitecore files at all. If you need to add a file or modify a sitcore file, build the folder structure in your project so on deployment, it will overwrite the existing sitecore file.
  • All Sitecore config changes should be in the solution, in a /App_Confif/Include/z_[Client] folder.
  • All your dlls for Sitecore should come from the official sitecore NuGet feed where you specify the sitecore version, not using "latest" in NuGet.
  • Your web.config should be an out of the box Sitecore web.config and use transforms to make the web.config into what it needs to be on the build.
  • You should develop with in the Helix guidelines for your project structure.
  • All Sitecore item changes should be tracking in your choice of serialization software. Whether its TDS or Unicorn.

My litmus test is if I can create a site with a Sim tool and deploy my project code and items, does my site work? In some situations, we pull production/stage content from Sitecore using PowerShell, copy the package to a Nuget server and deploy it to development/CI with PowerShell.

To create a site, I have used Sim tools with the command line or this Powershell script.

You are not alone in your frustration. I have run into several clients who have the entier Sitecore web site in their solution. Deployments and upgrades are always very difficult. But if you design a solution that includes no actual Sitecore files and can be deployed to a blank site via CI. Then you will be in great shape.

Derry answered 25/11, 2016 at 21:38 Comment(0)
C
1

For question number 2 :

We use Helix guidelines / Habitat, It seems to be the source for Sitecore best practice. All the training of sitecore says to create a project outside of Sitecore and only import things as you need them. For Configuration I would suggest quickly reading this

It's true about SSL and application pools can become an issue. Deploying to one customer's site will bring down all, depending on the setup.

If you go multi-instance you will need to look at your sitecore licensing.

Castroprauxel answered 12/1, 2017 at 3:32 Comment(0)
B
1

For my understanding, I can see that you have two concerns here:

1. How to structure the Sitecore project

I am a sitecore developer for more than 3 years, based on my experience, the best pratice is to create a single Sitecore project that is the highest layer of your solution You dont need to install sitecore dlls to all project, just keep your old code as it was and turn it to the base code. For example, i just finished a project that the customer wants to move to using Sitecore, the solution was already there, it has 4 projects:

  1. ABC.Web ==> highest layer
  2. ABC.Data ==> working with Data layer
  3. ABC.Services => business handling layer
  4. ABC.Domain ==> Common layer

We created a new project that should be install Sitecore dlls, that actually replace the ABC.Web(highest layer)that will contains all the Sitecore MVC code and didn't change any thing to old code. From that point, we can work with with both data from the old system (by referencing the ABC.Services dlls) and from Sitecore as well.

2. How do you install the required files in production to support multiple sites?

Sitecore do support multisite by structurizing the Sitecore content tree and a litte config. You DON"T need to create separeate websites in IIS, they are actually ONE website with different domains.In the config file named SiteDefinition.config (or you can add your own config file), you basically set a domain with a start item. Sitecore recognizes the domain that match with the one in config file and will redirect to the start item correspondingly. Eg. In the image, i created 2 sites (essentially, they are 2 branches of sitecore content tree) with start items are (MySite1 and MySite2)

enter image description here

this is my config

<sites>
      <site name="MySite1" patch:before="site[@name='website']"
            virtualFolder="/"
            physicalFolder="/"
            rootPath="/sitecore/content"
            startItem="/content/MySite1/home"
            database="web"
            domain="extranet"
            allowDebug="true"
            cacheHtml="true"
            htmlCacheSize="50MB"
            enablePreview="true"
            enableWebEdit="true"
            enableDebugger="true"
            disableClientData="false"/>
       <site name="MySite2" patch:before="site[@name='website']"
            virtualFolder="/"
            physicalFolder="/"
            rootPath="/sitecore/content"
            startItem="/content/MySite2/home"
            database="web"
            domain="extranet"
            allowDebug="true"
            cacheHtml="true"
            htmlCacheSize="50MB"
            enablePreview="true"
            enableWebEdit="true"
            enableDebugger="true"
            disableClientData="false"/>
    </sites>

You can reference this tutorial for more details

https://briancaos.wordpress.com/2010/03/01/working-with-multiple-sites-in-sitecore/

Brownfield answered 14/12, 2017 at 3:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.