-
Notifications
You must be signed in to change notification settings - Fork 811
CMS: Add new hosting in Docker documentation #7078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d81117e
Add article
nikolajlauridsen fd3ee77
Add HTTPS considerations
nikolajlauridsen ebf85f2
Add to readme
nikolajlauridsen 0f2aeaf
Add space
nikolajlauridsen a2cf217
Try and appease the dog 🐶
nikolajlauridsen 512d082
Sprinkle some more periods
nikolajlauridsen 16a386c
Apply suggestions from code review
nikolajlauridsen 13600c1
add to SUMMARY
nikolajlauridsen 8c531d5
Merge remote-tracking branch 'origin/docker-documentation' into docke…
nikolajlauridsen 38cd9b2
Update 15/umbraco-cms/fundamentals/setup/server-setup/running-umbraco…
eshanrnh d135aec
Update 15/umbraco-cms/fundamentals/setup/server-setup/running-umbraco…
eshanrnh 1cafd3b
Update 15/umbraco-cms/fundamentals/setup/server-setup/running-umbraco…
eshanrnh b24b66e
Update 15/umbraco-cms/fundamentals/setup/server-setup/running-umbraco…
eshanrnh c0dd52d
Update 15/umbraco-cms/fundamentals/setup/server-setup/running-umbraco…
eshanrnh fa8f590
Add across versions
nikolajlauridsen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
15/umbraco-cms/fundamentals/setup/server-setup/running-umbraco-in-docker.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| # Running Umbraco in Docker | ||
|
|
||
| Exactly how you choose to compose your Dockerfile will depend on your project specific needs. This section is not intended as a comprehensive guide, rather as an overview of topics to be aware of when hosting in Docker. | ||
|
|
||
| ## What is Docker | ||
|
|
||
| Docker is a platform for developing, shipping, and running applications in containers. Multiple services exist for hosting these containers. For more information, [refer to the official Docker documentation](https://docs.docker.com/) | ||
|
|
||
| ## The Docker file system | ||
|
|
||
| By default, files created inside a container are written to an ephemeral, writable container layer. | ||
| This means that the files don't persist when the container is removed, and it's challenging to get files out of the container. Additionally, this writable layer is not suitable for performance-critical data processing. | ||
|
|
||
| This has implications when running Umbraco in Docker. | ||
|
|
||
| For more information, refer to the [Docker documentation on storage](https://docs.docker.com/engine/storage/). | ||
|
|
||
| ### General file system consideration | ||
|
|
||
| In general, when working with files and Docker you work in a "push" fashion with read-only layers. When you build, you take all your files and "push" them into this read-only layer. | ||
|
|
||
| This means that you should avoid making files on the fly, and instead rely on building your image. | ||
|
|
||
| In an Umbraco context, this means you should not create or edit template, script or stylesheet files via the backoffice. These should be deployed as part of your web application and not managed via Umbraco. | ||
|
|
||
| Similarly, you shouldn't use InMemory modelsbuilder, since that also relies on creating files on the disk. While this is not a hard requirement, it doesn't provide any value if not live editing your site. | ||
eshanrnh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Instead, configure models builder to use use "source code" mode in development, and "none" in production, as [described when using runtime modes](https://docs.umbraco.com/umbraco-cms/fundamentals/setup/server-setup/runtime-modes). | ||
eshanrnh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| ### Logs | ||
|
|
||
| Umbraco writes logs to the `/umbraco/Logs/` directory. Due to the performance implications of writing to a writable layer, | ||
| and the limited size, it is recommended to mount a volume to this directory. | ||
|
|
||
| ### Data | ||
|
|
||
| The `/umbraco/Data/` directory is used to store temporary files, such as file uploads. Considering the limitations of the writable layer, you should also mount a volume to this directory. | ||
|
|
||
| ### Media | ||
|
|
||
| It's recommended to not store media in the writable layer. This is for similar performance reasons as logs, | ||
| but also for practical hosting reasons. You likely want to persist media files between containers. | ||
|
|
||
| One possible solution here is to again use bind mounts. The ideal setup though is to store the media and ImageSharp cache externally. For more information on this, refer to the [Azure Blob Storage documentation](https://docs.umbraco.com/umbraco-cms/extending/filesystemproviders/azure-blob-storage). | ||
eshanrnh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Required files | ||
|
|
||
| Your solution may require some specific files to run, such as license files. You will need to pass these files into the container at build time, or mount them externally. | ||
|
|
||
| ## HTTPS | ||
|
|
||
| When running in websites in Docker, it's common to use do so behind a reverse proxy, or load balancer. | ||
eshanrnh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| In these scenarios you will likely handle SSL termination at the reverse proxy. This means that Umbraco will not be aware of the SSL termination, and will complain about not using HTTPS. | ||
|
Check failure on line 54 in 15/umbraco-cms/fundamentals/setup/server-setup/running-umbraco-in-docker.md
|
||
|
|
||
| Umbraco checks for HTTPS in two locations: | ||
|
|
||
| 1. The `HstsCheck` health check - This will result in a failed healthcheck. | ||
| 2. The `UseHttpsValidator` - This will result in a build error, if Production runtime mode is used. | ||
|
|
||
| To avoid these checks failing, you can remove them in your project. | ||
|
|
||
| ### Health Check | ||
|
|
||
| The health check must be removed via configuration, through the `appsettings.json` file, environment variables, or similar. For more information see the [Health Check documentation](../../../reference/configuration/healthchecks.md). | ||
|
|
||
| The `HstsCheck` key is `E2048C48-21C5-4BE1-A80B-8062162DF124` so the appsettings will look something like: | ||
|
|
||
| ```json | ||
| "Umbraco": { | ||
| "CMS": { | ||
| "HealthChecks" : { | ||
| "DisabledChecks": [ | ||
| { | ||
| "Id": "E2048C48-21C5-4BE1-A80B-8062162DF124" | ||
| } | ||
| ] | ||
| }, | ||
| {...} | ||
| ``` | ||
|
|
||
| ### Runtime mode validator | ||
|
|
||
| The `UseHttpsValidator` must be removed through code For more information see the [Runtime mode documentation](runtime-modes.md). | ||
|
|
||
| The code to remove the validator can look something like: | ||
|
|
||
| ```C# | ||
| using Umbraco.Cms.Core.Composing; | ||
| using Umbraco.Cms.Infrastructure.Runtime.RuntimeModeValidators; | ||
|
|
||
| namespace MySite; | ||
|
|
||
| public class DockerChecksRemover : IComposer | ||
| { | ||
| public void Compose(IUmbracoBuilder builder) | ||
| => builder.RuntimeModeValidators().Remove<UseHttpsValidator>(); | ||
| } | ||
|
|
||
| ``` | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.