Stefan Holm Olsen

7 ways to deploy Optimizely CMS 12 (.NET 6)

Optimizely CMS 12 (and Commerce 14) has been public since September 2021. And with Optimizely now running on .NET 6 the world is wide open for applying new methods, patterns and technologies. And now there are so many ways to deploy Optimizely. In this blog post, I will start by exploring how and where Optimizely CMS can now deployed.

IIS on Windows

IIS on Windows Server has always been the only way to host Optimizely CMS and Commerce sites, until Azure App Service (also Windows-based) came along. Simply because prior to CMS 12 and Commerce 14, Optimizely was built on top of .NET Framework which could only be hosted by IIS on Windows.

CMS 12 sites will still be first-class citizens on IIS and Windows. The recommended process model is In-Process, which is almost exactly how the .NET Framework sites were hosted. Basically, it means that IIS will load and run the site DLL within the worker process.

Another option is Out-of-Process, where the site is running as a Kestrel application and IIS is simply receiving and proxying requests to Kestrel. However, this has a performance downside and is not recommended for general use.

All of this means that we can still host Optimizely sites on regular internal servers, as well as on classic web hotels.

Kestrel

Kestrel is a new name in .NET we need to remember. It is a self-contained web server, implemented in managed code, and supported on all major platforms (Windows, Linux and Mac OS). Self-contained means that the main project of a site is compiled into a Kestrel application. Upon startup it immediately runs a web server for that single site.

We can simply run the Kestrel webserver directly from the command line on a server and it will serve the site. As simple as that.

Kestrel supports many new features, all of which can be installed as NuGet packages and configured in code or in a JSON file.

Kestrel on Linux

Despite all of the Kestrel coolness, for large sites it will rarely be used alone. Instead, it will usually be accompanied by some kind of reverse proxy (like YARP, HAProxy, nginx, Apache etc.) for load balancing and acceleration.

And instead of running Kestrel from command-line, we might want to launch the Kestrel server with Systemd (which is very similar to running a Windows service). This ensures high reliability of the Kestrel server process. If the process crashes, Systemd can simply attempt to restart it.

Docker

Docker has established itself as the main containerization platform. And being able to run Optimizely in a Docker container was probably one of the most awaited feature in the developer community. It had been attempted for years, but now it is finally supported officially.

In fact, the new generation of Optimizely DXP hosting (which I was an early beta tester of) is building Docker-like containers before deploying them to Azure App Services for Containers. So, now it is very much supported.

In practice, when the Docker container starts, it will simply run the site Kestrel server from command line. For integrated scaling and load balancing we can upgrade to Docker Swarm Mode or Kubernetes.

Kubernetes

Since we can now build Docker containers with Optimizely, we can host the site in the popular Kubernetes container engine. This can be thought of like hosting the site in a private container cloud.

Maybe your company has already invested in a private cloud. In this case, it may be natural to host websites, like Optimizely, on the very same platform as everything else. Then this is very good news, as you no longer need to mess with setting up the site on virtual machines in the private cloud. You would just build a container image and provision a number of servers to run this image. Very cool!

Kubernetes also goes by enterprise names, like RedHat OpenShift, Canonical Charmed Kubernetes (or MicroK8s).

I believe this has huge cost-efficiency potential for some big corporations that may already have invested in a private container platform. Imagine being able to run a site on “some servers”, instead of reserving, manually maintaining and documenting specific servers for the site. When you have a lot of servers, this matters a lot for operations.

Optimizely DXP

Optimizely DXP is a managed hosting service, in which Optimizely provisions, manages and supports your websites on top of an Azure App Service stack. This includes smooth deployment flows, a global CDN configuration and more.

DXP also often include complementary Optimizely services like Content Recommendation, Product Recommendation, Search & Navigation etc. Services that can really accelerate the growth of a website or a web shop.

The previous generation of Optimizely DXP was built on top of the original Azure App Services (based on Windows). But the new generation, made for CMS 12, is based on Azure App Service for Containers. On deployment, the code is turned into a Docker image for the site to run.

Azure App Service for Containers (Linux)

For companies that prefer to manage their sites in the Azure cloud on their own, it is possible to mimic the provisioning and configuration of the new generation of Optimizely DXP.

Some companies prefer this model, so they can manage and monitor the sites on their own (or with a third-party partner). This model could also be cheaper for some companies, if they already have certain licenses that can be utilized in Azure.

Alternative ideas

  • Amazon Web Services: While it was supported on older versions of Optimizely CMS, it has not yet been done for CMS 12. But with the right driver classes, there should not be a reason it could not be done again.
  • Google Cloud: Earlier this year, Optimizely and Google announced a strategic partnership for the Optimizely Experimentation platforms. In light of this, consider that Google Cloud actually has all the required components for hosting an Optimizely site. With the right driver classes, this can also be done.
  • A Raspberry Pi cluster: Yes, such experimental clusters do exist (see Anthony Simon's tutorial), but they are a lot slower than regular servers. And we would need external SQL Server and file storage to run Optimizely site on such a cluster. So, while they are fun to work with, they are not production-ready.

Do you have other cool deployment ideas? Then leave a comment.