1

Problem

There is lots of documentation on how to create an MVC Sitecore site with Docker and containers. But how would you recommend creating a multisite Sitecore site for a multitenant 8+ site topology?

Details

Currently we have 8+ tenancy sites that when compiled/deployed indivdually deploy to tenant virtual directories hosted with one IIS sitecore site. Included is a shared code library. It's close to the architecture outlined here: MVC Area + separate solution for each site copying only their site to their respective tenant folders.

This way if we need to make a change to just one site, only one site needs to be compiled / deployed because only that site has changed.

We're currently looking at migrating to containers, but because containers are immutable, we would not be able to do this from what I've seen. For every site deploy, we'd have to add every other site to the container, compiling each. This would drastically increase our build/deployment time.

Questions

  1. Are there any options out there for this?
  2. Does anyone have any references to multi tenant Sitecore container setups? I have not been able to much on this topic.
5
  • 1
    This link you are sharing is very old, modern Sitecore implementations using Helix principle - helix.sitecore.com , for reference you can see this example - github.com/Sitecore/Habitat . You don't need a separate solution for each module, just need separate web projects. Commented Aug 13, 2021 at 4:12
  • Thanks! I had seen that. I know it's old, but that's what our company is using atm. But regardless of the sln setup, for a multisite sitecore site, what is the recommended way to containerize each site? @MahendraShekhawat
    – w00ngy
    Commented Aug 13, 2021 at 15:46
  • 2
    Two things come to mind for me. The disconnected solutions could all be brought together into a single solution that has a single output. Another option may be to checkout and compile each solution independently, but take the outputs and layer them together as a single artifact. This artifact could then possibly be used to build up the container image.
    – jdylanmc
    Commented Aug 13, 2021 at 18:15
  • 1
    @DylanMcCurry I had similar thoughts. Might be able to build separate images for each site and cache them. Then each solution build could check to see if the tenancy images have changed and if not just use those images to build off of to create the final image.
    – w00ngy
    Commented Aug 13, 2021 at 19:01
  • Use SXA for sitecore multi tenant implementations doc.sitecore.com/en/developers/sxa/17/… Commented Nov 7, 2021 at 11:12

1 Answer 1

1

Everything done here was in v10.1 xp0 MVC container topology installation which is minimal for a dev. It is definitely NOT using the remote rendering host architecture. Also not using SCS, K8, Helix and SXA to reduce complexity.

Warning: Don't base anything on Habitat, it's ok to learn from but is not a StarterKit. I started here: Containers in Sitecore development (https://doc.sitecore.com/xp/en/developers/101/developer-tools/containers-in-sitecore-development.html) using Docker Examples repository (https://github.com/Sitecore/docker-examples) and then used the container templates in custom-images.

Multisite specifics

  • Installation host: cm.ssd.localhost
  • Mulitsite host: careers.localhost

Any mods were made with no running containers typically. This is a long post. There are several steps that need to be done. Welcome to the ease of Sitecore configuration.

  1. In docker-compose.override.yml changed the volume mapping to:
        volumes:
      - ${LOCAL_DEPLOY_PATH}:C:\deploy
      - ${LOCAL_DATA_PATH}\cm:C:\inetpub\wwwroot\App_Data\logs
  1. You may have to change permissions to install an old-style Sitecore package. In .\docker\cm\Dockerfile add this line:
        #Set permissions to enable package installation
        RUN icacls 'C:\inetpub\wwwroot' /grant 'IIS_IUSRS:(F)' /t
  1. Then in the root dir (custom-images), rebuild the image using the terminal PS command:
docker-compose build cm 
  1. Installed my careers.zip Sitecore package which provided the careers site def config file.
  2. In .env, added an entry for the new host
CAREERS_HOST=careers.localhost
  1. In docker-compose.yml updated the host config (around line 127) adding new entries. Be very careful about ` (backwards quote)
Host(`${CM_HOST}`)||Host(`${CAREERS_HOST}`)||Host(`${EVENTS_HOST}`)"
  1. In .\docker\traefik\certs folder using a cmd terminal (not PS) did this command:
    mkcert -key-file careers.key.pem -cert-file careers.cert.pem careers.localhost
  1. In .\docker\traefik\config\dynamic\certs_config.yaml in the tls:certificates: add the cert's location:
        tls:
            certificates:
                certFile: C:\etc\traefik\certs\careers.cert.pem
                keyFile: C:\etc\traefik\certs\careers.key.pem
  1. In docker-compose.override.yml add the needed AllowedCors entries:
        id:
            environment:                Sitecore_Sitecore__IdentityServer__Clients__DefaultClient__AllowedCorsOrigins__AllowedCorsOriginsGroup2: https://${HRZ_HOST}
                Sitecore_Sitecore__IdentityServer__Clients__DefaultClient__AllowedCorsOrigins__AllowedCorsOriginsGroup3: https://${CAREERS_HOST}
                Sitecore_Sitecore__IdentityServer__Clients__DefaultClient__AllowedCorsOrigins__AllowedCorsOriginsGrou
  1. On your dev box running Docker Desktop, add the following to the .\etc\hosts file:
        127.0.0.1       careers.localhost
        127.0.0.1       events.localhost

Finally done At this point, could open a browser and this the published site at https://careers.localhost

But that is where it ends. Trying to hit https://careers.localhost/sitecore did not work. Yes the login screen appears, but logging in redirects you to cm.ssd.localhost. I did manually edit the redirect url at the login screen and replaced cm.ssd.localhost with careers.localhost. Voila, I was logged into careers.localhost.

So the truth is, my steps may help you get close. I have not been able to leap that final chasm with the identity server not redirecting to careers.localhost. I don't know if this is a bug or a missing config setting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.