Merge commit '87de22d7464e239c775fbd48ebce1665d5b1e80d'

This commit is contained in:
Bjørn Erik Pedersen
2023-07-29 11:17:28 +02:00
177 changed files with 1623 additions and 1556 deletions

View File

@@ -1,14 +1,15 @@
---
title: Hosting & Deployment
linktitle: Hosting & Deployment Overview
title: Hosting and deployment
linkTitle: Overview
description: Site builds, automated deployments, and popular hosting solutions.
categories: [hosting and deployment]
keywords: []
menu:
docs:
identifier: hosting-and-deployment-overview
parent: hosting-and-deployment
weight: 01
weight: 01
weight: 1
weight: 1
---
Because Hugo renders *static* websites, you can host your new Hugo website virtually anywhere. The following represent only a few of the more popular hosting and automated deployment solutions used by the Hugo community.

View File

@@ -1,13 +1,11 @@
---
title: Deployment with Rclone
title: Deploy with Rclone
description: If you have access to your web host with SFTP/FTP/SSH/HTTP(DAV), you can use rclone to incrementally deploy your entire Hugo website.
categories: [hosting and deployment]
keywords: [rclone,sftp,deployment]
menu:
docs:
parent: hosting-and-deployment
weight: 80
weight: 80
aliases: [/tutorials/deployment-with-rclone/]
toc: true
---
@@ -22,7 +20,7 @@ toc: true
**NB**: You can remove ``--interactive`` in the commands below once you are comfortable with rclone, if you wish. Also, ``--gc`` and ``--minify`` are optional in the ``hugo`` commands below.
## Getting Started
## Getting started
The spoiler is that you can even deploy your entire website from any compatible OS with no configuration. Using SFTP for example:
@@ -31,9 +29,9 @@ hugo --gc --minify
rclone sync --interactive --sftp-host sftp.example.com --sftp-user www-data --sftp-ask-password public/ :sftp:www/
```
## Configure Rclone for Even Easier Usage
## Configure Rclone for even easier usage
The easiest way is simply to run ``rclone config``.
The easiest way is simply to run `rclone config`.
The [Rclone docs](https://rclone.org/docs/) provide [an example of configuring Rclone to use SFTP](https://rclone.org/sftp/).

View File

@@ -1,13 +1,11 @@
---
title: Deployment with Rsync
title: Deploy with Rsync
description: If you have access to your web host with SSH, you can use a simple rsync one-liner to incrementally deploy your entire Hugo website.
categories: [hosting and deployment]
keywords: [rsync,deployment]
menu:
docs:
parent: hosting-and-deployment
weight: 70
weight: 70
aliases: [/tutorials/deployment-with-rsync/]
toc: true
---
@@ -26,7 +24,7 @@ hugo && rsync -avz --delete public/ www-data@ftp.topologix.fr:~/www/
As you will see, we'll put this command in a shell script file, which makes building and deployment as easy as executing `./deploy`.
## Copy Your SSH Key to your Host
## Copy Your SSH Key to your host
To make logging in to your server more secure and less interactive, you can upload your SSH key. If you have already installed your SSH key to your server, you can move on to the next section.
@@ -77,7 +75,7 @@ Enter passphrase for key '/home/mylogin/.ssh/rsa_id':
Now that you can log in with your SSH key, let's create a script to automate deployment of your Hugo site.
## Shell Script
## Shell script
Create a new script called `deploy` the root of your Hugo tree:

View File

@@ -6,8 +6,6 @@ keywords: [21yunbox,hosting,deployment]
menu:
docs:
parent: hosting-and-deployment
weight: 10
weight: 10
toc: true
---

View File

@@ -6,8 +6,6 @@ keywords: [amplify,hosting,deployment]
menu:
docs:
parent: hosting-and-deployment
weight: 10
weight: 10
toc: true
---

View File

@@ -1,13 +1,11 @@
---
title: Hosting on Azure Static Web Apps
description: Learn how to deploy a Hugo application to Azure Static Web Apps.
title: Host on Azure Static Web Apps
description: Publish a Hugo site to Azure Static Web Apps.
categories: [hosting and deployment]
keywords: [hosting,Azure Static Web Apps]
menu:
docs:
parent: hosting-and-deployment
weight: 200
weight: 200
toc: true
---

View File

@@ -1,96 +0,0 @@
---
title: Host on Azure Static Web Apps
description: Deploy Hugo to Azure Static Web Apps and automate the whole process with GitHub Action Workflow
categories: [hosting and deployment]
keywords: [azure,git,deployment,hosting]
menu:
docs:
parent: hosting-and-deployment
weight: 10
weight: 10
toc: true
---
[Azure Static Web Apps] is a service that automatically builds and deploys full stack web apps to Azure from a Git repository, using [GitHub Actions] or [Azure DevOps].
_The following documentation covers how to use GitHub Actions for the deployment. If you are using Azure DevOps, follow the Microsoft documentation._
## Assumptions
1. You have Git 2.8 or greater [installed on your machine][installgit].
2. You have a GitHub account. [Signing up][ghsignup] for GitHub is free.
3. You have an Azure account. You can sign up for a [Free Trial][azuretrial].
4. You have a ready-to-publish Hugo website or have at least completed the [Quick Start].
## Deploy Hugo to Azure Static Web Apps
1. Navigate to the [Azure Portal][azureportal]
2. Click **Create a Resource**
3. Search for **Static Web Apps**
4. Click **Static Web Apps**
5. Click **Create**
![Create in Azure Portal](/images/hosting-and-deployment/hosting-on-azure/create-in-portal.png)
6. For **Subscription**, accept the subscription that is listed or select a new one from the drop-down list.
7. In _Resource group_, select **New**. In _New resource group name_, enter **hugo-static-app** and select **OK**.
8. Next, a name for your app in the **Name** box. Valid characters include `a-z`, `A-Z`, `0-9` and `-`.
9. For _Region_, select an available region close to you.
10. For _SKU_, select **Free**.
![Basic app details](/images/hosting-and-deployment/hosting-on-azure/basic-app-details.png)
11. Click the **Sign in with GitHub** button.
12. Select the **Organization** under which your repo exists.
13. Select the Hugo app you wish to deploy as the _Repository_ .
14. For the _Branch_ select the branch you want to deploy (eg: **main**).
15. Select **Hugo** under the _Build Presets_, which will populate the configuration files with the standard Hugo build options
* **App Location** is the path in the Git repo where Hugo's config file is
* **Api Location** is the path where the Serverless API is (or left blank if there is no API)
* **Artifact Location** is the path where Hugo publishes to
16. Click **Review + Create** to review the details and then **Create** to start the creation of the Azure Static Web Apps and create the GitHub Action workflow for deployment.
A GitHub Action workflow will immediately start a build using Hugo and deployment to Azure. The website can be accessed via the URL shown on the _Overview_ page of the Azure Static Web Apps resource in Azure.
## Using A Custom Hugo Version
When you create a Static Web App, a [workflow file][swaconfig] is generated which contains the deployment settings for the site. You can configure a specific Hugo version in the workflow file by providing a value for `HUGO_VERSION` in the `env` section of the `Azure/static-web-apps-deploy` GitHub Action.
```yaml
jobs:
build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: "/" # App source code path
api_location: "api" # Api source code path - optional
output_location: "public" # Built app content directory - optional
env:
HUGO_VERSION: 0.100.2
```
## Use a Custom Domain
Azure Static Web Apps supports custom domains as a CNAME or APEX domain mapping. You can configure the custom domains via the Azure Portal. Refer to the [official documentation for custom domains][domains] for more information.
[Azure Static Web Apps]: https://docs.microsoft.com/azure/static-web-apps/?WT.mc_id=javascript-26008-aapowell
[GitHub Actions]: https://docs.github.com/en/actions
[Azure DevOps]: https://docs.microsoft.com/azure/static-web-apps/publish-devops?WT.mc_id=javascript-26008-aapowell
[ghsignup]: https://github.com/join
[installgit]: https://git-scm.com/downloads
[azuretrial]: https://azure.microsoft.com/free/?WT.mc_id=javascript-26008-aapowell
[azureportal]: https://portal.azure.com/
[swaconfig]: https://docs.microsoft.com/azure/static-web-apps/github-actions-workflow?WT.mc_id=javascript-26008-aapowell
[domains]: https://docs.microsoft.com/azure/static-web-apps/custom-domain?WT.mc_id=javascript-26008-aapowell
[Quick Start]: /getting-started/quick-start/

View File

@@ -5,8 +5,6 @@ categories: [hosting and deployment]
menu:
docs:
parent: hosting-and-deployment
weight: 50
weight: 50
toc: true
---

View File

@@ -6,8 +6,6 @@ keywords: [hosting,firebase]
menu:
docs:
parent: hosting-and-deployment
weight: 20
weight: 20
toc: true
---
@@ -76,7 +74,7 @@ With this you will have the app initialized manually. After that you can manage
Don't forget to update your static pages before push!
## Manual Deploy
## Manual deploy
To deploy your Hugo site, execute the `firebase deploy` command, and your site will be up in no time:
@@ -84,7 +82,7 @@ To deploy your Hugo site, execute the `firebase deploy` command, and your site w
hugo && firebase deploy
```
## CI Setup (Other tools)
## CI setup (other tools)
You can generate a deploy token using

View File

@@ -1,13 +1,11 @@
---
title: Host on GitHub
title: Host on GitHub Pages
description: Deploy Hugo as a GitHub Pages project or personal/organizational site and automate the whole process with Github Actions
categories: [hosting and deployment]
keywords: [github,git,deployment,hosting]
menu:
docs:
parent: hosting-and-deployment
weight: 30
weight: 30
toc: true
aliases: [/tutorials/github-pages-blog/]
---
@@ -102,14 +100,14 @@ jobs:
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.111.3
HUGO_VERSION: 0.115.1
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass Embedded
run: sudo snap install dart-sass-embedded
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Checkout
uses: actions/checkout@v3
with:

View File

@@ -1,13 +1,11 @@
---
title: Host on GitLab
title: Host on GitLab Pages
description: GitLab makes it easy to build, deploy, and host your Hugo website via their free GitLab Pages service, which provides native support for Hugo.
categories: [hosting and deployment]
keywords: [hosting,deployment,git,gitlab]
menu:
docs:
parent: hosting-and-deployment
weight: 40
weight: 40
toc: true
aliases: [/tutorials/hosting-on-gitlab/]
---
@@ -28,24 +26,48 @@ The `baseURL` in your [site configuration](/getting-started/configuration/) must
Define your [CI/CD](https://docs.gitlab.com/ee/ci/quick_start/) jobs by creating a `.gitlab-ci.yml` file in the root of your project.
{{< code file=".gitlab-ci.yml" >}}
image: registry.gitlab.com/pages/hugo/hugo_extended:latest
variables:
DART_SASS_VERSION: 1.63.6
HUGO_VERSION: 0.115.3
NODE_VERSION: 20.x
GIT_DEPTH: 0
GIT_STRATEGY: clone
GIT_SUBMODULE_STRATEGY: recursive
TZ: America/Los_Angeles
image:
name: golang:1.20.6-bookworm
pages:
script:
- hugo
# Install brotli
- apt-get update
- apt-get install -y brotli
# Install Dart Sass
- curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
- tar -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
- cp -r dart-sass/* /usr/local/bin
- rm -rf dart-sass*
# Install Hugo
- curl -LJO https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb
- apt-get install -y ./hugo_extended_${HUGO_VERSION}_linux-amd64.deb
- rm hugo_extended_${HUGO_VERSION}_linux-amd64.deb
# Install Node.js
- curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | bash -
- apt-get install -y nodejs
# Install Node.js dependencies
- "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
# Build
- hugo --gc --minify
# Compress
- find public -type f -regex '.*\.\(css\|html\|js\|txt\|xml\)$' -exec gzip -f -k {} \;
- find public -type f -regex '.*\.\(css\|html\|js\|txt\|xml\)$' -exec brotli -f -k {} \;
artifacts:
paths:
- public
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
{{< /code >}}
{{% note %}}
See [this list](https://gitlab.com/pages/hugo/container_registry) if you wish to use a particular Hugo version to build your site.
{{% /note %}}
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
{{% /code %}}
## Push your Hugo website to GitLab

View File

@@ -1,12 +1,11 @@
---
title: "Host on KeyCDN"
title: Host on KeyCDN
description: "Accelerate your Hugo site globally with a KeyCDN integration. This tutorial shows you how to set up your static site as a GitLab page behind a KeyCDN pull zone."
categories: [hosting and deployment]
keywords: [keycdn,hosting,deployment,cdn]
menu:
docs:
parent: hosting-and-deployment
weight: 40
---
[KeyCDN](https://www.keycdn.com/) provides a multitude of features to help accelerate and secure your Hugo site globally including Brotli compression, Let's Encrypt support, Origin Shield, and more.
@@ -73,7 +72,7 @@ While the Secret Variable for your API Key will look similar to:
The Zone ID and API key are used to purge your zone its not strictly needed but otherwise, the CDN might deliver older versions of your assets for quite a while.
## Push Your Changes to GitLab
## Push your changes to GitLab
Now its time to push the newly created repository to GitLab:

View File

@@ -6,8 +6,6 @@ keywords: [netlify,hosting,deployment]
menu:
docs:
parent: hosting-and-deployment
weight: 10
weight: 10
toc: true
---
@@ -49,7 +47,7 @@ Select the repo you want to use for continuous deployment. If you have a large n
![Screenshot of step 1 of create a new site for Netlify: selecting the git provider](/images/hosting-and-deployment/hosting-on-netlify/netlify-create-new-site-step-2.jpg)
Once selected, you'll be brought to a screen for basic setup. Here you can select the branch you want to publish, your [build command], and your publish (i.e. deploy) directory. The publish directory should mirror that of what you've set in your [site configuration][config], the default of which is `public`. The following steps assume you are publishing from the `master` branch.
Once selected, you'll be brought to a screen for basic setup. Here you can select the branch you want to publish, your [build command], and your publish (i.e. deploy) directory. The publish directory should mirror that of what you've set in your [site configuration], the default of which is `public`. The following steps assume you are publishing from the `master` branch.
## Configure Hugo version in Netlify
@@ -73,7 +71,7 @@ The Netlify configuration file can be a little hard to understand and get right
{{< readfile file="netlify.toml" highlight="toml" >}}
## Build and Deploy Site
## Build and deploy site
In the Netlify console, selecting "Deploy site" will immediately take you to a terminal for your build:.
@@ -91,7 +89,7 @@ Now every time you push changes to your hosted git repository, Netlify will rebu
See [this blog post](https://www.netlify.com/blog/2017/04/11/netlify-plus-hugo-0.20-and-beyond/) for more details about how Netlify handles Hugo versions.
## Use Hugo Themes with Netlify
## Use Hugo themes with Netlify
The `git clone` method for installing themes is not supported by Netlify. If you were to use `git clone`, it would require you to recursively remove the `.git` subdirectory from the theme folder and would therefore prevent compatibility with future versions of the theme.
@@ -124,7 +122,7 @@ You can update a theme to the latest version by executing the following command
git submodule update --rebase --remote
```
## Next Steps
## Next steps
You now have a live website served over HTTPS, distributed through CDN, and configured for continuous deployment. Dig deeper into the Netlify documentation:
@@ -134,7 +132,7 @@ You now have a live website served over HTTPS, distributed through CDN, and conf
[app.netlify.com]: https://app.netlify.com
[build command]: /getting-started/usage/#build-your-site
[config]: /getting-started/configuration/
[site configuration]: /getting-started/configuration/
[ghsm]: https://github.com/blog/2104-working-with-submodules
[gitsm]: https://git-scm.com/book/en/v2/Git-Tools-Submodules
[httpscustom]: https://www.netlify.com/docs/ssl/

View File

@@ -6,8 +6,6 @@ keywords: [hosting,deployment]
menu:
docs:
parent: hosting-and-deployment
weight: 10
weight: 10
toc: true
---
@@ -48,23 +46,23 @@ You can set up a Hugo site on Render in two quick steps:
That's it! Your site will be live on your Render URL (which looks like `yoursite.onrender.com`) as soon as the build is done.
## Continuous Deploys
## Continuous deploys
Now that Render is connected to your repo, it will **automatically build and publish your site** any time you push to your GitHub/GitLab.
You can choose to disable auto deploys under the **Settings** section for your site and deploy it manually from the Render dashboard.
## CDN and Cache Invalidation
## CDN and cache invalidation
Render hosts your site on a global, lightning fast CDN which ensures the fastest possible download times for all your users across the globe.
Every deploy automatically and instantly invalidates the CDN cache, so your users can always access the latest content on your site.
## Custom Domains
## Custom domains
Add your own domains to your site easily using Render's [custom domains](https://render.com/docs/custom-domains) guide.
## Pull Request Previews
## Pull Request previews
With Pull Request (PR) previews, you can visualize changes introduced in a pull request instead of simply relying on code reviews.
@@ -72,7 +70,7 @@ Once enabled, every PR for your site will automatically generate a new static si
Read more about [Pull Request Previews](https://render.com/docs/pull-request-previews) on Render.
## Hugo Themes
## Hugo themes
Render automatically downloads all Git submodules defined in your Git repo on every build. This way Hugo themes added as submodules work as expected.

View File

@@ -6,8 +6,8 @@ keywords: [s3,gcs,azure,hosting,deployment]
menu:
docs:
parent: hosting-and-deployment
weight: 2
weight: 2
weight: 20
weight: 20
toc: true
---