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.
- 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
- 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
- Then in the root dir (custom-images), rebuild the image using the terminal PS command:
docker-compose build cm
- Installed my careers.zip Sitecore package which provided the careers site def config file.
- In
.env
, added an entry for the new host
CAREERS_HOST=careers.localhost
- 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}`)"
- 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
- 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
- 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
- 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.