-
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 6 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
95 changes: 95 additions & 0 deletions
95
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,95 @@ | ||
| # Running Umbraco in Docker | ||
|
|
||
| Exactly how you choose to compose your Dockerfile depends on your needs, and your project. This section is not intended as a guide, | ||
| but as a general overview of what to be aware of when hosting in Docker. | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## What is Docker | ||
|
|
||
| Docker is a platform for developing, shipping, and running applications in containers. There exist multiple services for hosting these containers, | ||
| for more information, [refer to the official Docker documentation](https://docs.docker.com/) | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## The Docker file system | ||
|
|
||
| By default, all 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/). | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### General file system consideration | ||
|
|
||
| In general, when working with files and Docker you work in a "push" fashion with the read-only layers. WWhen you build, you take all your files and "push" them into the read-only layer. | ||
| This means that you should avoid making files on the fly, and instead rely on building your image. You should not create or edit template files on the fly, the same goes for script and style files. | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 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. Instead, use source code in development, and none in production, as [described when using runtime modes](https://docs.umbraco.com/umbraco-cms/fundamentals/setup/server-setup/runtime-modes). | ||
nikolajlauridsen 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 | ||
|
|
||
| Similarly to logs, it's recommended to not store media in the writable layer, both for performance reasons, | ||
| but also for practical development reasons. You likely want to persist media files between containers. | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| One possible solution here is to again use bind mounts. The ideal solution is 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). | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Required files | ||
|
|
||
| If your solution requires some files to run, for instance license files. You need to pass these files into the container at build time, or mount them externally. | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## HTTPS | ||
|
|
||
| When running in websites in Docker, it's common to use do so behind a reverse proxy, or load balancers. | ||
| In these scenarios you're likely to handle SSL termination at the reverse proxy. This means that Umbraco will not be aware of the SSL termination, and will likely complain about not using HTTPS. | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 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, either through the `appsettings.json`, environment variables, or similar, for more information see the [Health Check documentation](../../../reference/configuration/healthchecks.md). | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 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). | ||
nikolajlauridsen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 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>(); | ||
| } | ||
|
|
||
| ``` | ||
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.