Skip to content

Commit fd3ee77

Browse files
Add HTTPS considerations
1 parent d81117e commit fd3ee77

File tree

1 file changed

+54
-3
lines changed

1 file changed

+54
-3
lines changed

15/umbraco-cms/fundamentals/setup/server-setup/running-umbraco-in-docker.md

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Running Umbraco in Docker
22

3-
Exactly how you chose to compose your Dockerfile depends on your needs, and your project, so this section is not intended as a guide,
3+
Exactly how you choose to compose your Dockerfile depends on your needs, and your project, so this section is not intended as a guide,
44
but as a general overview of what to be aware of when hosting in Docker.
55

66
## What is Docker
@@ -12,21 +12,25 @@ for more information, [refer to the official Docker documentation](https://docs.
1212

1313
By default, all files created inside a container is written to a ephemeral writable container layer.
1414
This means that the files don't persist when the container is removed, and it's difficult to get files out of the container. Additionally, this writable layer is not suitable for performance-critical data processing.
15-
This has several implications when running Umbraco in Docker. For more information refer to the [Docker documentation on storage](https://docs.docker.com/engine/storage/).
15+
This has several implications when running Umbraco in Docker. For more information, refer to the [Docker documentation on storage](https://docs.docker.com/engine/storage/).
1616

1717
### General file system consideration
1818

1919
In general, when working with files and Dockcer you work in a "push" fashion with the read-only layers, that is when you build you take all your files and "push" them into the read-only layer.
2020
This means that you should avoid making files on the fly, and instead rely on building your image, this means that you should not create or edit template files on the fly, the same goes for script and style files.
2121

22-
Similarly, you shouldn't use InMemory modelsbuilder, since that also relies on creating files on the disk, instead you should 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).
22+
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 simply doesn't provide any value if not live editing your site, instead you should 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).
2323

2424

2525
### Logs
2626

2727
Umbraco writes logs to the `/umbraco/Logs/` directory, due to the performance implications of writing to a writable layer,
2828
and the limited size of the writable layer, it is recommended to mount a volume to this directory.
2929

30+
### Data
31+
32+
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.
33+
3034
### Media
3135

3236
Similarly to logs, it's recommended to not store media in the writable layer, both for performance reasons,
@@ -35,9 +39,56 @@ but also for practical development reason, you likely want to persist media file
3539
One possible solution here is to again use bind mounts, however the ideal solution is store the media and ImageSharp cache externally,
3640
for more information on this, refer to the [Azure Blob Storage documentation](https://docs.umbraco.com/umbraco-cms/extending/filesystemproviders/azure-blob-storage).
3741

42+
### Required files
43+
44+
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.
3845

3946
## HTTPS
4047

4148
When running in websites in Docker, it's common to use do so behind a reverse proxy, or load balancers.
4249
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.
4350

51+
Umbraco checks for HTTPS in two locations:
52+
53+
1. The `HstsCheck` health check - This will result in a failed healthcheck.
54+
2. The `UseHttpsValidator` - This will result in a build error, if Production runtime mode is used.
55+
56+
To avoid these checks failing, you can remove them in your project.
57+
58+
### Health Check
59+
60+
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).
61+
62+
The `HstsCheck` key is `E2048C48-21C5-4BE1-A80B-8062162DF124` so the appsettings will look something like:
63+
64+
```json
65+
"Umbraco": {
66+
"CMS": {
67+
"HealthChecks" : {
68+
"DisabledChecks": [
69+
{
70+
"Id": "E2048C48-21C5-4BE1-A80B-8062162DF124"
71+
}
72+
]
73+
},
74+
{...}
75+
```
76+
### Runtime mode validator
77+
78+
The `UseHttpsValidator` must be removed through code, for more information see the [Runtime mode documentation](runtime-modes.md).
79+
80+
The code to remove the validator can look something like:
81+
82+
```C#
83+
using Umbraco.Cms.Core.Composing;
84+
using Umbraco.Cms.Infrastructure.Runtime.RuntimeModeValidators;
85+
86+
namespace MySite;
87+
88+
public class DockerChecksRemover : IComposer
89+
{
90+
public void Compose(IUmbracoBuilder builder)
91+
=> builder.RuntimeModeValidators().Remove<UseHttpsValidator>();
92+
}
93+
94+
```

0 commit comments

Comments
 (0)