Running Umbraco in Containers – Share Your Experience #18468
Replies: 14 comments 13 replies
-
Hi! We're running a load balanced site in Azure with Docker containers via GitHub actions deployments. Our stage and feature environments are also running the same dockerfile. We're also using the same(ish) dockerfile to develop locally with docker-compose. We can simulate the load balanced environment locally quite easily that way. Overall it's working great. It's quite easy to adopt an Umbraco site to run in a container, even an existing one. I'd say the most work lies in creating/maintaining the deployment flow and the hardest challenges lies in debugging container errors once deployed to the platform. But neither of those things are specific to Umbraco. Challenges (most of them in development actually):
Production Dockerfile: https://gist.github.com/jrunestone/ab845ec50d3a8636c6bf44355b6cc8fc |
Beta Was this translation helpful? Give feedback.
-
Calling @mjpraxis and @CarlSargunar for their container feedback! |
Beta Was this translation helpful? Give feedback.
-
I did Umbraco with docker in both Azure and GCP, and my biggest challanges are still 3 things (based on v13):
The other bits which i usually do is disabling the keep alive job from umbraco, as it just make things harder as you need allow outgoing traffic to app and if you loadbalance with waf it doesnt make sense to do that from app and is better to use healtchecks to keep it alive instead. |
Beta Was this translation helpful? Give feedback.
-
I have lots of feedback on the Azure hosting and not just container specific if that's of any interest ;) |
Beta Was this translation helpful? Give feedback.
-
@nikolajlauridsen we are running several v15 Backoffice instances i Kubernetes(K8S). There was some fine-tuning in the beginning making sure that the setting was correct: The public URL to the Backoffice
Making sure that the setting UseHttps in K8S is false, since the internal traffic is HTTP. As we are only using the Backoffice, we had to make sure that K8S only had 0 (zero) or 1 pod running. |
Beta Was this translation helpful? Give feedback.
-
So, as someone who runs the k8s infra and other related cloud resources for our Umbraco team i can remark the following things:
Ill edit this if more things come to mind. |
Beta Was this translation helpful? Give feedback.
-
My experience with containers is mostly through Github actions and Azure Container apps, but for my contribs:
|
Beta Was this translation helpful? Give feedback.
-
Hi @nikolajlauridsen , We're running multiple websites (low, medium and big size) on our own k8s infrastructure since Umbraco 9. We are currently using the dotnet sdk and runtime official dotnet images. All our sites were recently migrated to Umbraco 13. Here are key features of our environment:
Our infrastructure is not perfect yet but allows each developer to work and deploy changes on environments using the Gitlab pipeline. The git flow and project structure is standardized for all website. I'll be happy to give more information if needed |
Beta Was this translation helpful? Give feedback.
-
Just adding a link to this older setup from @liamlaverty (maybe he has new insights since then) https://24days.in/umbraco-cms/2023/automatons/umbraco-docker/ Also some great insights from Scott Hanselman on how to optimize your .NET build to be as tiny as possible (basically treeshaking) and keeping the docker images tiny as well: https://www.youtube.com/watch?v=KqhhaMgbGhU |
Beta Was this translation helpful? Give feedback.
-
We are running Umbraco 13.7.2 to support two sites with medium to high traffic and are currently hosting on an AKS cluster. We previously were hosting with Azure app services and Umbraco 8 and since the migration have hit some issues with locking when content editing is happening. This has been linked to us doing blue/green deployments during releases to avoid downtime. The approach works well for the public facing service but when we were doing it for the editorial one we hit locking issues which spanned long after the release had been complete and the older version pods decommissioned. The locking errors where observed when content creators would try to save/publish from the CMS. After conversations with Umbraco support we have stopped doing blue/green for the editorial service and accepted downtime during releases and start up. Interestingly enough with Azure app services we did not have those problems and had a staging slot which was swapped with production as part of the release. Ideally, we would want to get back to doing this way but not certain how/if it is possible at this point in time. |
Beta Was this translation helpful? Give feedback.
-
We’ve been hosting almost all our clients on a Kubernetes cluster since the release of Umbraco 9. Overall, this has been smooth, with only a few minor issues—mostly related to some Views (especially from third-party packages) and case sensitivity due to the non-Windows file system. We’ve built several CI/CD pipelines for hosting Umbraco in containers. Here’s an example of the setup we commonly use: We also have experience running Umbraco on AWS: More recently, I did a proof of concept for running Umbraco on Google Cloud: We haven’t encountered any major Umbraco-related issues when hosting in Docker containers or on a Kubernetes cluster. A recent challenge involved working with private packages, which we resolved using Microsoft’s artifacts-credprovider. Our Dockerfile is relatively straightforward—here’s an example: Just don’t forget to pass the FEED_ACCESSTOKEN as a build argument. |
Beta Was this translation helpful? Give feedback.
-
Am running around 20 sites currently under Azure app service but wanting to move them in to our k8s clusters in the near future. Primarily for the benefit of utilizing common tooling and the flexibility we have around compute scale. Glad to hear their are others out there successfully hosting this way. From testing, the environment variables needed are
Here is a redacted Dockerfile. Using a chiseled image keeps the final output at around ~250mb. # syntax=docker/dockerfile:1
# Client build stage
FROM node:18 AS client-build-env
WORKDIR /src/Client
COPY src/Client/. .
RUN npm install && \
npm run build -- --output-path=/src/Client/build/client && \
npm run build:server -- --output-path=/src/Client/build/server
# Publish Stage
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS publish
WORKDIR /src/build
COPY --from=client-build-env /src/Client/build/client ./CMSWeb/wwwroot/scripts/
COPY --from=client-build-env /src/Client/build/server ./CMSWeb/wwwroot/scripts/server
COPY src/ .
WORKDIR /src/build/CMSWeb
RUN dotnet restore "./CMSWeb.csproj" --runtime linux-x64 && \
dotnet publish "./CMSWeb.csproj" -c Release -o /app/publish --no-restore --runtime linux-x64
RUN mkdir -p /app/publish/wwwroot/media
# Runtime stage
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy-chiseled-extra AS final
USER $APP_UID
ENV ASPNETCORE_HTTP_PORTS=8080
ENV ASPNETCORE_HTTPS_PORTS=8443
EXPOSE $ASPNETCORE_HTTP_PORTS
EXPOSE $ASPNETCORE_HTTPS_PORTS
WORKDIR /app
COPY --from=publish --chown=$APP_UID:$APP_UID --chmod=760 /app/publish .
ENTRYPOINT [ "dotnet", "./CMSWeb.dll"] Biggest challenge I face is not necessarily to do with containers or k8s but common across load balancing Umbraco in general. Is the examine indexes. For testing I created the load balanced front end containers as stateful sets with a mapped umbraco/Data and the LuceneDirectoryFactory set to default so the indexes get stored at umbraco/Data/TEMP. However when scaling up these take time to build and I haven't found a reliable Umbraco endpoint that I can use as reediness check that will prevent traffic being served to new containers until the indexes are ready. Here is a redacted manifest ---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: umbraco-frontend
spec:
serviceName: "umbraco-frontend"
replicas: 3
selector:
matchLabels:
app: umbraco-frontend
template:
metadata:
labels:
app: umbraco-frontend
azure.workload.identity/use: "true"
spec:
securityContext:
runAsUser: 1654
runAsGroup: 1654
fsGroup: 1654
serviceAccountName: umbraco
containers:
- name: umbraco-frontend
imagePullPolicy: Always
image: example.azurecr.io/umbraco:latest
ports:
- name: http
containerPort: 8080
envFrom:
- configMapRef:
name: umbraco
env:
- name: AppSettings__Environment
value: 'Subscriber'
volumeMounts:
- name: umbraco-data
mountPath: /app/umbraco/Data
volumeClaimTemplates:
- metadata:
name: umbraco-data
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 1Gi Would be great to connect with any community members that are hosting in a similar fashion to knowledge share. |
Beta Was this translation helpful? Give feedback.
-
Thank you, everyone, for all your contributions. It has been amazing to follow along with all the great knowledge sharing 🤩 It's greatly appreciated, H5YR. We initially started this discussion to see if there were any technical problems we needed to solve in the CMS. Thankfully, this is not the case 😄. I think a good next step is to create some documentation with information about what you need to be aware of when hosting Umbraco with Docker. Some things I've noted down for this are
This is not intended to be a strict guide, since the specifics are very project-dependent, but rather general information about what you need to be aware of when hosting Umbraco in Docker. I'll leave this discussion open for a week so you have an opportunity to come up with input on this, and then I'll close it. |
Beta Was this translation helpful? Give feedback.
-
I've now created a document in the docs for running Umbraco in Docker. I've made it as more of a general overview of what to consider when hosting in Docker. Now I'm not a hosting guru, so if you have any improvements, they're greatly appreciated as contributions over on the documentation repo. I'll close this discussion now, thank you all again for your participation 🤩 . |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Are you running Umbraco in production using Docker, Kubernetes, or something similar? We'd love to hear how it's working for you! 🤩
We’re looking to improve how Umbraco runs in containerized environments, and your input can help shape future updates. If you have a Dockerfile or setup you’d be open to sharing, that would be super helpful too! 😄
Your feedback will help shape how we support containerized deployments in the future. Let’s discuss! 💭
Beta Was this translation helpful? Give feedback.
All reactions