Skip to content

Commit 1dc8c29

Browse files
authored
Merge pull request #6588 from nikolajlauridsen/docker-documentation
Add docker documentation for V14 and V15
2 parents ee319ed + 2389127 commit 1dc8c29

File tree

7 files changed

+384
-93
lines changed

7 files changed

+384
-93
lines changed

14/umbraco-cms/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* [Requirements](fundamentals/setup/requirements.md)
1616
* [Installation](fundamentals/setup/install/README.md)
1717
* [Install using .NET CLI](fundamentals/setup/install/install-umbraco-with-templates.md)
18+
* [Running Umbraco in Docker using Docker Compose](fundamentals/setup/install/running-umbraco-on-docker-locally.md)
1819
* [Install using Visual Studio](fundamentals/setup/install/visual-studio.md)
1920
* [Local IIS With Umbraco](fundamentals/setup/install/iis.md)
2021
* [Install using Visual Studio Code](fundamentals/setup/install/install-umbraco-with-vs-code.md)

14/umbraco-cms/fundamentals/setup/install/install-umbraco-with-templates.md

Lines changed: 90 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -37,54 +37,98 @@ From that command's output, you will get a better understanding of what are the
3737
Umbraco Project (C#)
3838
Author: Umbraco HQ
3939
Description: An empty Umbraco project ready to get started.
40-
Options:
41-
-v|--version The version of Umbraco.Cms to add as PackageReference.
42-
string - Optional
43-
Default: 10.0.0
44-
45-
--use-https-redirect Adds code to Program.cs to redirect HTTP to HTTPS and enables the UseHttps setting.
46-
bool - Optional
47-
Default: false
48-
49-
--no-restore If specified, skips the automatic restore of the project on create.
50-
bool - Optional
51-
Default: false
52-
53-
--exclude-gitignore Whether to exclude .gitignore from the generated template.
54-
bool - Optional
55-
Default: false
56-
57-
--minimal-gitignore Whether to only include minimal (Umbraco specific) rules in the .gitignore.
58-
bool - Optional
59-
Default: false
60-
61-
--connection-string Database connection string used by Umbraco.
62-
string - Optional
6340
64-
--connection-string-provider-name Database connection string provider name used by Umbraco.
65-
string - Optional
66-
Default: Microsoft.Data.SqlClient
41+
Usage:
42+
dotnet new umbraco [options] [template options]
6743
68-
--development-database-type Database type used by Umbraco for development.
69-
None - Do not configure a database for development.
70-
SQLite - Use embedded SQLite database.
71-
LocalDB - Use embedded LocalDB database (requires SQL Server Express with Advanced Services).
72-
Default: None
73-
74-
--friendly-name Used to specify the name of the default admin user when using unattended install on development (stored as plain text).
75-
string - Optional
76-
77-
--email Used to specify the email of the default admin user when using unattended install on development (stored as plain text).
78-
string - Optional
79-
80-
--password Used to specify the password of the default admin user when using unattended install on development (stored as plain text).
81-
string - Optional
82-
83-
--no-nodes-view-path Path to a custom view presented with the Umbraco installation contains no published content.
84-
string - Optional
85-
86-
-p|--PackageTestSiteName The name of the package project this should be a test site for.
87-
string - Optional
44+
Options:
45+
-n, --name <name> The name for the output being created. If no name is specified, the name of the output directory is used.
46+
-o, --output <output> Location to place the generated output.
47+
--dry-run Displays a summary of what would happen if the given command line were run if it would result in a template
48+
creation.
49+
--force Forces content to be generated even if it would change existing files.
50+
--no-update-check Disables checking for the template package updates when instantiating a template.
51+
--project <project> The project that should be used for context evaluation.
52+
-lang, --language <C#> Specifies the template language to instantiate.
53+
--type <project> Specifies the template type to instantiate.
54+
55+
Template options:
56+
-r, --release <Latest|LTS> The Umbraco release to use, either latest or latest long term supported
57+
Type: choice
58+
Latest The latest umbraco release
59+
LTS The most recent long term supported version
60+
Default: Latest
61+
--use-https-redirect Adds code to Startup.cs to redirect HTTP to HTTPS and enables the UseHttps setting.
62+
Type: bool
63+
Default: false
64+
-da, --use-delivery-api Enables the Delivery API
65+
Type: bool
66+
Default: false
67+
--add-docker Adds a docker file to the project.
68+
Type: bool
69+
Default: false
70+
--no-restore If specified, skips the automatic restore of the project on create.
71+
Type: bool
72+
Default: false
73+
--exclude-gitignore Whether to exclude .gitignore from the generated template.
74+
Type: bool
75+
Default: false
76+
--minimal-gitignore Whether to only include minimal (Umbraco specific) rules in the .gitignore.
77+
Type: bool
78+
Default: false
79+
--connection-string <connection-string> Database connection string used by Umbraco.
80+
Type: string
81+
--connection-string-provider-name Database connection string provider name used by Umbraco.
82+
<connection-string-provider-name> Type: string
83+
Default: Microsoft.Data.SqlClient
84+
--development-database-type <choice> Database type used by Umbraco for development.
85+
Type: choice
86+
None Do not configure a database for development.
87+
SQLite Use embedded SQLite database.
88+
LocalDB Use embedded LocalDB database (requires SQL Server Express with Advanced
89+
Services).
90+
Default: None
91+
--friendly-name <friendly-name> Used to specify the name of the default admin user when using unattended install on
92+
development (stored as plain text).
93+
Type: string
94+
--email <email> Used to specify the email of the default admin user when using unattended install on
95+
development (stored as plain text).
96+
Type: string
97+
--password <password> Used to specify the password of the default admin user when using unattended install on
98+
development (stored as plain text).
99+
Type: string
100+
--no-nodes-view-path <no-nodes-view-path> Path to a custom view presented with the Umbraco installation contains no published
101+
content.
102+
Type: string
103+
-dm, --development-mode <choice> Choose the development mode to use for the project.
104+
Type: choice
105+
BackofficeDevelopment Enables backoffice development, allowing you to develop from
106+
within the backoffice, this is the default behaviour.
107+
IDEDevelopment Configures appsettings.Development.json to Development runtime
108+
mode and SourceCodeAuto models builder mode, and configures appsettings.json to
109+
Production runtime mode, Nothing models builder mode, and enables UseHttps
110+
Default: BackofficeDevelopment
111+
-mm, --models-mode <choice> Choose the models builder mode to use for the project. When development mode is set to
112+
IDEDevelopment this only changes the models builder mode appsetttings.development.json
113+
Type: choice
114+
Default Let DevelopmentMode determine the models builder mode.
115+
InMemoryAuto Generate models in memory, automatically updating when a content
116+
type change, this means no need for app rebuild, however models are only available in
117+
views.
118+
SourceCodeManual Generate models as source code, only updating when requested
119+
manually, this means a interaction and rebuild is required when content type(s) change,
120+
however models are available in code.
121+
SourceCodeAuto Generate models as source code, automatically updating when a
122+
content type change, this means a rebuild is required when content type(s) change,
123+
however models are available in code.
124+
Nothing No models are generated, this is recommended for production assuming
125+
generated models are used for development.
126+
Default: Default
127+
-sk, --starter-kit <choice> Choose a starter kit to install.
128+
Type: choice
129+
None No starter kit.
130+
Umbraco.TheStarterKit The Umbraco starter kit.
131+
Default: None
88132
```
89133

90134
## Create an Umbraco project
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
description: "Running Umbraco on docker locally using docker compose"
3+
---
4+
5+
# Running Umbraco in Docker using Docker Compose
6+
7+
To aid in developing Umbraco with additional services, the templates can provide the requisite files to run Umbraco with an SQL Server database in Docker. This setup is designed to be used for local development, and not for production.
8+
9+
## Prerequisites
10+
11+
Before you can run Umbraco in Docker, you need to have the following installed:
12+
* Version 14.3.0 or higher of the Umbraco Templates
13+
* Docker Desktop
14+
15+
## Installing
16+
17+
Installing Umbraco with the Docker file and Docker Compose file is a two-step process.
18+
19+
1. Create a folder to hold your project and enter that folder.
20+
21+
```bash
22+
mkdir MyDockerProject
23+
cd MyDockerProject
24+
```
25+
2. Create your Umbraco project using the Umbraco Templates, and remember to use the `--add-docker` flag to include the Docker files.
26+
27+
28+
Conventionally this is named the same as the folder, but it is not a requirement.
29+
30+
```bash
31+
dotnet new umbraco -n MyDockerProject --add-docker
32+
```
33+
34+
Now we need to add some additional files to make docker compose work. We can do this using the umbraco-compose template, passing the project name we specified earlier to the -P parameter:
35+
36+
```bash
37+
dotnet new umbraco-compose -P "MyDockerProject"
38+
```
39+
40+
The `-P` flag is required to specify the correct paths in the docker-compose file. The project is now ready to run with docker compose.
41+
42+
The final folder structure looks like this:
43+
44+
* MyDockerProject
45+
* MyDockerProject
46+
* Typical project files
47+
* DockerFile
48+
* `.dockerignore`
49+
* `.env`
50+
* Database
51+
* DockerFile
52+
* `healthcheck.sh`
53+
* `setup.sql`
54+
* `startup.sh`
55+
* `docker-compose.yml`
56+
57+
The project now includes docker files for both Umbraco and the SQL server database.
58+
59+
It also includes additional scripts to launch and configure the database and a `.env` file with the database password.
60+
61+
## Running
62+
63+
To run the project use the `docker compose up` command in the root of the project files where the `docker-compose.yml` is.
64+
65+
This command will build both the Umbraco and SQL Server images and launch them in the correct order. When the site is booted, access it in your browser on `http://localhost:44372/`.
66+
67+
### Useful commands
68+
69+
There are some useful commands you can use to manage the docker containers:
70+
71+
* `docker compose down --volumes`: Delete your containers and the volumes they use. This is useful if you want to start from scratch.
72+
73+
{% hint style="warning" %}
74+
Be careful with this command, as it deletes your database and all data in it.
75+
{% endhint %}
76+
77+
* `docker compose up --build`: Rebuild the images and start the containers. This is useful if you have made changes to the project and want to see them reflected on the running site.
78+
* `docker compose watch`: Start the containers and watch the default models folder. This means that if the project uses a source-code models builder the images are automatically rebuilt and restarts when you change the models.
79+
80+
## Details
81+
82+
The docker compose file uses bind mounts for the following folders:
83+
84+
* `/wwwroot/media`
85+
* `/wwwroot/scripts`
86+
* `/wwwroot/css`
87+
* `/Views`
88+
* `/models`
89+
90+
This is not meant to be used in production.
91+
92+
For local development, however, this means that the files necessary for development are available from outside the container in your IDE. This allows development even though the project is running in docker.
93+
94+
## Template options
95+
96+
The `umbraco-compose` template has a few options that can be used to customize the setup:
97+
98+
* `-P` or `--project-name`: The name of the project. This is required and used to set the correct paths in the docker-compose file.
99+
* `-dbpw` or `--DatabasePasswor`: Used to specify the database password. This is stored in the `.env` file and defaults to: `Password1234`.
100+
* `-p` or `--Port`: Used to specify the port the site will run on. Defaults to `44372`.

15/umbraco-cms/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* [Requirements](fundamentals/setup/requirements.md)
1212
* [Installation](fundamentals/setup/install/README.md)
1313
* [Install using .NET CLI](fundamentals/setup/install/install-umbraco-with-templates.md)
14+
* [Running Umbraco in Docker using Docker Compose](fundamentals/setup/install/running-umbraco-on-docker-locally.md)
1415
* [Install using Visual Studio](fundamentals/setup/install/visual-studio.md)
1516
* [Local IIS With Umbraco](fundamentals/setup/install/iis.md)
1617
* [Install using Visual Studio Code](fundamentals/setup/install/install-umbraco-with-vs-code.md)

0 commit comments

Comments
 (0)