SiteHost

Working with Umbraco Web Containers

Deploying a Umbraco web application is super easy with the .NET Core + SDK 6 / 7 Cloud Container images. We designed these to concentrate and simplify your application configuration in a single Container. We have an article of deploying for our .NET Core Containers and this page follow a similar flow.

Currently our .NET containers support versions of Umbraco 10+ due to our available Cloud Container images.

In this guide, we will cover setting up a .NET Core + SDK 6 / 7 Web Container and customize it to run a Umbraco CMS based website.

You can follow these steps either in your local environment or on your Cloud Container server using your SSH user

Create and build the app

Install Umbraco on your local machine:

dotnet new -i Umbraco.Templates

Create a new project:

dotnet new umbraco –name MyProject

Once you are happy with your process, we need to do a few tweaks before deploying your project on your Cloud Container. First, we need to edit the launchSettings.json file in order to allow your project to listen on port 80:

nano Properties/launchSettings.json

Update the applicationUrl key under iisSettings group, it should look like this:

"applicationUrl": "http://localhost",

And we remove the value on the applicationUrl key under the Umbraco.Web.UI group, it should look like this:

"applicationUrl": "",

After that, all that is left to do is to publish the project, we can achieve that with the following command:

dotnet publish -c release --no-restore /{project_folder}/MyProject/ -o /{desire_localtion}/

Deploying the Project

Now you can move the output of the publish command to the application directory, this should be in the /container/application/ folder. Once updated, you will need to make a small change on the supervisord.conf file located in /container/config. Here you will have to replace the name of the dll file with the one you choose when creating the project:

[program:dotnetapp]
directory=/container/application/
;command=/usr/bin/dotnet ExampleApp.dll
command=/usr/bin/dotnet MyProject.dll
stdout_logfile=/container/logs/supervisor/%(program_name)s-stdout.log
stderr_logfile=/container/logs/supervisor/%(program_name)s-stderr.log

After you have deployed your project and made those changes, you'll need to restart your container for the changes to take effect.

Redirecting to HTTPS

Most of the work that needs to be done is already covered by our Enforcing SSL documentation. All of the method calls will need to be made before app.UseUmbraco(). There is a couple of other changes that need to be made specific to Umbraco.

We'll need to edit the applicationUrl for iisSettings to use https:// instead of http://.

"applicationUrl": "https://localhost",

The only other change you'll need is to tell Umbraco to use HTTPS in appSettings.json This will change all of Umbraco's URLs to use HTTPS instead of HTTP.

"Umbraco": {
  "CMS": {
    "Global": {
      "UseHttps": true,
    }
  }
}

Example Project

If you need an example, you can check out our example Umbraco repo to help guide you to creating your own project or to use as a template.