Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 14/umbraco-cms/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* [Requirements](fundamentals/setup/requirements.md)
* [Installation](fundamentals/setup/install/README.md)
* [Install using .NET CLI](fundamentals/setup/install/install-umbraco-with-templates.md)
* [Running Umbraco in Docker using Docker Compose](fundamentals/setup/install/running-umbraco-on-docker-locally.md)
* [Install using Visual Studio](fundamentals/setup/install/visual-studio.md)
* [Local IIS With Umbraco](fundamentals/setup/install/iis.md)
* [Install using Visual Studio Code](fundamentals/setup/install/install-umbraco-with-vs-code.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,54 +37,98 @@ From that command's output, you will get a better understanding of what are the
Umbraco Project (C#)
Author: Umbraco HQ
Description: An empty Umbraco project ready to get started.
Options:
-v|--version The version of Umbraco.Cms to add as PackageReference.
string - Optional
Default: 10.0.0

--use-https-redirect Adds code to Program.cs to redirect HTTP to HTTPS and enables the UseHttps setting.
bool - Optional
Default: false

--no-restore If specified, skips the automatic restore of the project on create.
bool - Optional
Default: false

--exclude-gitignore Whether to exclude .gitignore from the generated template.
bool - Optional
Default: false

--minimal-gitignore Whether to only include minimal (Umbraco specific) rules in the .gitignore.
bool - Optional
Default: false

--connection-string Database connection string used by Umbraco.
string - Optional

--connection-string-provider-name Database connection string provider name used by Umbraco.
string - Optional
Default: Microsoft.Data.SqlClient
Usage:
dotnet new umbraco [options] [template options]

--development-database-type Database type used by Umbraco for development.
None - Do not configure a database for development.
SQLite - Use embedded SQLite database.
LocalDB - Use embedded LocalDB database (requires SQL Server Express with Advanced Services).
Default: None

--friendly-name Used to specify the name of the default admin user when using unattended install on development (stored as plain text).
string - Optional

--email Used to specify the email of the default admin user when using unattended install on development (stored as plain text).
string - Optional

--password Used to specify the password of the default admin user when using unattended install on development (stored as plain text).
string - Optional

--no-nodes-view-path Path to a custom view presented with the Umbraco installation contains no published content.
string - Optional

-p|--PackageTestSiteName The name of the package project this should be a test site for.
string - Optional
Options:
-n, --name <name> The name for the output being created. If no name is specified, the name of the output directory is used.
-o, --output <output> Location to place the generated output.
--dry-run Displays a summary of what would happen if the given command line were run if it would result in a template
creation.
--force Forces content to be generated even if it would change existing files.
--no-update-check Disables checking for the template package updates when instantiating a template.
--project <project> The project that should be used for context evaluation.
-lang, --language <C#> Specifies the template language to instantiate.
--type <project> Specifies the template type to instantiate.

Template options:
-r, --release <Latest|LTS> The Umbraco release to use, either latest or latest long term supported
Type: choice
Latest The latest umbraco release
LTS The most recent long term supported version
Default: Latest
--use-https-redirect Adds code to Startup.cs to redirect HTTP to HTTPS and enables the UseHttps setting.
Type: bool
Default: false
-da, --use-delivery-api Enables the Delivery API
Type: bool
Default: false
--add-docker Adds a docker file to the project.
Type: bool
Default: false
--no-restore If specified, skips the automatic restore of the project on create.
Type: bool
Default: false
--exclude-gitignore Whether to exclude .gitignore from the generated template.
Type: bool
Default: false
--minimal-gitignore Whether to only include minimal (Umbraco specific) rules in the .gitignore.
Type: bool
Default: false
--connection-string <connection-string> Database connection string used by Umbraco.
Type: string
--connection-string-provider-name Database connection string provider name used by Umbraco.
<connection-string-provider-name> Type: string
Default: Microsoft.Data.SqlClient
--development-database-type <choice> Database type used by Umbraco for development.
Type: choice
None Do not configure a database for development.
SQLite Use embedded SQLite database.
LocalDB Use embedded LocalDB database (requires SQL Server Express with Advanced
Services).
Default: None
--friendly-name <friendly-name> Used to specify the name of the default admin user when using unattended install on
development (stored as plain text).
Type: string
--email <email> Used to specify the email of the default admin user when using unattended install on
development (stored as plain text).
Type: string
--password <password> Used to specify the password of the default admin user when using unattended install on
development (stored as plain text).
Type: string
--no-nodes-view-path <no-nodes-view-path> Path to a custom view presented with the Umbraco installation contains no published
content.
Type: string
-dm, --development-mode <choice> Choose the development mode to use for the project.
Type: choice
BackofficeDevelopment Enables backoffice development, allowing you to develop from
within the backoffice, this is the default behaviour.
IDEDevelopment Configures appsettings.Development.json to Development runtime
mode and SourceCodeAuto models builder mode, and configures appsettings.json to
Production runtime mode, Nothing models builder mode, and enables UseHttps
Default: BackofficeDevelopment
-mm, --models-mode <choice> Choose the models builder mode to use for the project. When development mode is set to
IDEDevelopment this only changes the models builder mode appsetttings.development.json
Type: choice
Default Let DevelopmentMode determine the models builder mode.
InMemoryAuto Generate models in memory, automatically updating when a content
type change, this means no need for app rebuild, however models are only available in
views.
SourceCodeManual Generate models as source code, only updating when requested
manually, this means a interaction and rebuild is required when content type(s) change,
however models are available in code.
SourceCodeAuto Generate models as source code, automatically updating when a
content type change, this means a rebuild is required when content type(s) change,
however models are available in code.
Nothing No models are generated, this is recommended for production assuming
generated models are used for development.
Default: Default
-sk, --starter-kit <choice> Choose a starter kit to install.
Type: choice
None No starter kit.
Umbraco.TheStarterKit The Umbraco starter kit.
Default: None
```

## Create an Umbraco project
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
description: "Running Umbraco on docker locally using docker compose"
---

# Running Umbraco in Docker using Docker Compose

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.

## Prerequisites

Before you can run Umbraco in Docker, you need to have the following installed:
* Version 14.3.0 or higher of the Umbraco Templates
* Docker Desktop

## Installing

Installing Umbraco with the Docker file and Docker Compose file is a two-step process.

1. Create a folder to hold your project and enter that folder.

```bash
mkdir MyDockerProject
cd MyDockerProject
```
2. Create your Umbraco project using the Umbraco Templates, and remember to use the `--add-docker` flag to include the Docker files.


Conventionally this is named the same as the folder, but it is not a requirement.

```bash
dotnet new umbraco -n MyDockerProject --add-docker
```

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:

Check warning on line 34 in 14/umbraco-cms/fundamentals/setup/install/running-umbraco-on-docker-locally.md

View workflow job for this annotation

GitHub Actions / runner / vale

[vale] reported by reviewdog 🐶 [UmbracoDocs.UmbracoTerms] We prefer 'Umbraco' over 'umbraco.' Raw Output: {"message": "[UmbracoDocs.UmbracoTerms] We prefer 'Umbraco' over 'umbraco.'", "location": {"path": "14/umbraco-cms/fundamentals/setup/install/running-umbraco-on-docker-locally.md", "range": {"start": {"line": 34, "column": 96}}}, "severity": "WARNING"}

```bash
dotnet new umbraco-compose -P "MyDockerProject"
```

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.

The final folder structure looks like this:

* MyDockerProject
* MyDockerProject
* Typical project files
* DockerFile
* `.dockerignore`
* `.env`
* Database
* DockerFile
* `healthcheck.sh`
* `setup.sql`
* `startup.sh`
* `docker-compose.yml`

The project now includes docker files for both Umbraco and the SQL server database.

It also includes additional scripts to launch and configure the database and a `.env` file with the database password.

## Running

To run the project use the `docker compose up` command in the root of the project files where the `docker-compose.yml` is.

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/`.

### Useful commands

There are some useful commands you can use to manage the docker containers:

* `docker compose down --volumes`: Delete your containers and the volumes they use. This is useful if you want to start from scratch.

{% hint style="warning" %}
Be careful with this command, as it deletes your database and all data in it.
{% endhint %}

* `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.
* `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.

## Details

The docker compose file uses bind mounts for the following folders:

* `/wwwroot/media`
* `/wwwroot/scripts`
* `/wwwroot/css`
* `/Views`
* `/models`

This is not meant to be used in production.

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.

## Template options

The `umbraco-compose` template has a few options that can be used to customize the setup:

* `-P` or `--project-name`: The name of the project. This is required and used to set the correct paths in the docker-compose file.
* `-dbpw` or `--DatabasePasswor`: Used to specify the database password. This is stored in the `.env` file and defaults to: `Password1234`.
* `-p` or `--Port`: Used to specify the port the site will run on. Defaults to `44372`.
1 change: 1 addition & 0 deletions 15/umbraco-cms/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* [Requirements](fundamentals/setup/requirements.md)
* [Installation](fundamentals/setup/install/README.md)
* [Install using .NET CLI](fundamentals/setup/install/install-umbraco-with-templates.md)
* [Running Umbraco in Docker using Docker Compose](fundamentals/setup/install/running-umbraco-on-docker-locally.md)
* [Install using Visual Studio](fundamentals/setup/install/visual-studio.md)
* [Local IIS With Umbraco](fundamentals/setup/install/iis.md)
* [Install using Visual Studio Code](fundamentals/setup/install/install-umbraco-with-vs-code.md)
Expand Down
Loading
Loading