Various install/deploy updates and improvements

Install: Remove DigitalOcean
Running: Add sc.exe Windows service info

Also add caddy.fs namespace docs
This commit is contained in:
Matthew Holt 2022-07-29 14:42:23 -06:00
parent b418c40043
commit cd102116b1
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5
4 changed files with 51 additions and 30 deletions

View file

@ -4,7 +4,7 @@ title: "Module Namespaces"
# Module Namespaces
Caddy guest modules are loaded generically as `interface{}` types. In order for the host modules to be able to use them, the loaded guest modules are usually type-asserted to a known type first. This page describes the mapping from module namespaces to Go types for all the standard modules.
Caddy guest modules are loaded generically as `interface{}` or `any` types. In order for the host modules to be able to use them, the loaded guest modules are usually type-asserted to a known type first. This page describes the mapping from module namespaces to Go types for all the standard modules.
Documentation for non-standard module namespaces can be found with the documentation for the host module that defines them.
@ -12,10 +12,10 @@ Documentation for non-standard module namespaces can be found with the documenta
One way to read this table is, "If your module is in <namespace>, then it should compile as <type>."
</aside>
Namespace | Expected Type | Description
--------- | ------------- | -----------
Namespace | Expected Type | Description | Notes
--------- | ------------- | ----------- | ----------
| | [`caddy.App`](https://pkg.go.dev/github.com/caddyserver/caddy/v2?tab=doc#App) | Caddy app
caddy.fs | [`fs.FS`](https://pkg.go.dev/io/fs#FS) | Virtual file system <i>⚠️ Experimental</i>
caddy.fs | [`fs.FS`](https://pkg.go.dev/io/fs#FS) or [`fs.StatFS`](https://pkg.go.dev/io/fs#StatFS) | Virtual file system | <i>⚠️ Experimental</i>. Some host modules may require more specific FS interfaces. We recommend that all `caddy.fs` modules implement the `fs.StatFS` interface if possible.
caddy.logging.encoders.filter | [`logging.LogFieldFilter`](https://pkg.go.dev/github.com/caddyserver/caddy/v2/modules/logging?tab=doc#LogFieldFilter) | Log field filter</i>
caddy.logging.writers | [`caddy.WriterOpener`](https://pkg.go.dev/github.com/caddyserver/caddy/v2?tab=doc#WriterOpener) | Log writers
caddy.storage | [`caddy.StorageConverter`](https://pkg.go.dev/github.com/caddyserver/caddy/v2?tab=doc#StorageConverter) | Storage backends
@ -26,9 +26,9 @@ http.matchers | [`caddyhttp.RequestMatcher`](https://pkg.go.dev/github.com/caddy
http.reverse_proxy.circuit_breakers | [`reverseproxy.CircuitBreaker`](https://pkg.go.dev/github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy?tab=doc#CircuitBreaker) | Reverse proxy circuit breakers
http.reverse_proxy.selection_policies | [`reverseproxy.Selector`](https://pkg.go.dev/github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy?tab=doc#Selector) | Load balancing selection policies<br>
http.reverse_proxy.transport | [`http.RoundTripper`](https://pkg.go.dev/net/http?tab=doc#RoundTripper) | HTTP reverse proxy transports
http.reverse_proxy.upstreams | [`reverseproxy.UpstreamSource`](https://pkg.go.dev/github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy?tab=doc#UpstreamSource) | Dynamic upstream source <i>⚠️ Experimental</i>
http.reverse_proxy.upstreams | [`reverseproxy.UpstreamSource`](https://pkg.go.dev/github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy?tab=doc#UpstreamSource) | Dynamic upstream source | <i>⚠️ Experimental</i>
tls.certificates | [`caddytls.CertificateLoader`](https://pkg.go.dev/github.com/caddyserver/caddy/v2/modules/caddytls?tab=doc#CertificateLoader) | TLS certificate source</i>
tls.handshake_match | [`caddytls.ConnectionMatcher`](https://pkg.go.dev/github.com/caddyserver/caddy/v2/modules/caddytls?tab=doc#ConnectionMatcher) | TLS connection matcher</i>
tls.issuance | [`certmagic.Issuer`](https://pkg.go.dev/github.com/caddyserver/certmagic?tab=doc#Issuer) | TLS certificate issuer<br>
tls.get_certificate | [`certmagic.CertificateManager`](https://pkg.go.dev/github.com/caddyserver/certmagic?tab=doc#CertificateManager) | TLS certificate manager<br><i>⚠️ Experimental</i>
tls.get_certificate | [`certmagic.CertificateManager`](https://pkg.go.dev/github.com/caddyserver/certmagic?tab=doc#CertificateManager) | TLS certificate manager | <i>⚠️ Experimental</i>
tls.stek | [`caddytls.STEKProvider`](https://pkg.go.dev/github.com/caddyserver/caddy/v2/modules/caddytls?tab=doc#STEKProvider) | TLS session ticket key source</i>

View file

@ -9,11 +9,10 @@ This page describes various methods for installing Caddy on your system.
**Official:**
- [Static binaries](#static-binaries)
- [Debian, Ubuntu, Raspbian](#debian-ubuntu-raspbian)
- [Fedora, RedHat, CentOS](#fedora-redhat-centos)
- [Arch Linux, Manjaro, Parabola](#arch-linux-manjaro-parabola)
- [Docker](#docker)
- [DigitalOcean](#digitalocean)
- [Debian, Ubuntu, Raspbian packages](#debian-ubuntu-raspbian)
- [Fedora, RedHat, CentOS packages](#fedora-redhat-centos)
- [Arch Linux, Manjaro, Parabola packages](#arch-linux-manjaro-parabola)
- [Docker image](#docker)
<aside class="tip">
@ -34,17 +33,19 @@ Our [official packages](https://github.com/caddyserver/dist) come only with the
## Static binaries
Simply downloading a Caddy binary does not [install it as a service](/docs/running#manual-installation), but can be useful in dev or when upgrading an existing installation.
- [**View releases on GitHub**](https://github.com/caddyserver/caddy/releases) (expand "Assets")
- [**Use our download page**](/download)
1. Obtain a Caddy binary:
- [**From releases on GitHub**](https://github.com/caddyserver/caddy/releases) (expand "Assets")
- [**From our download page**](/download)
- [**By building from source**](/docs/build) (either with `go` or `xcaddy`)
2. We recommend [installing Caddy as a system service](/docs/running#manual-installation)
You can upgrade static binaries by replacing them with newer versions and restarting Caddy.
## Debian, Ubuntu, Raspbian
Installing this package automatically starts and runs Caddy as a [systemd service](/docs/running#linux-service) named `caddy`, and also comes with a `caddy-api` service which is _not_ enabled by default, should you need it.
Installing this package automatically starts and runs Caddy as a [systemd service](/docs/running#linux-service) named `caddy`. It also comes with a `caddy-api` service which is _not_ enabled by default but should be used if you primarily configure Caddy via its API instead of config files.
Stable releases:
**Stable releases:**
<pre><code class="cmd"><span class="bash">sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https</span>
<span class="bash">curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg</span>
@ -52,7 +53,7 @@ Stable releases:
<span class="bash">sudo apt update</span>
<span class="bash">sudo apt install caddy</span></code></pre>
Testing releases (includes betas and release candidates):
**Testing releases** (includes betas and release candidates):
<pre><code class="cmd"><span class="bash">sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https</span>
<span class="bash">curl -1sLf 'https://dl.cloudsmith.io/public/caddy/testing/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-testing-archive-keyring.gpg</span>
@ -100,13 +101,6 @@ This package comes with both of Caddy's [systemd service](/docs/running#linux-se
[**View on Docker Hub**](https://hub.docker.com/_/caddy)
## DigitalOcean
[**Deploy a Caddy droplet on DigitalOcean**](https://marketplace.digitalocean.com/apps/caddy)
The droplet is preconfigured to run Caddy as a [systemd service](/docs/running#linux-service) via being installed with the [`apt` repo](#debian-ubuntu-raspbian).
## Homebrew
_Note: This is a community-maintained installation method._

View file

@ -4,7 +4,7 @@ title: Keep Caddy Running
# Keep Caddy Running
While Caddy can be run successfully by directly using its [Command Line Interface](/docs/command-line), there are numerous advantages to using a service manager to keep it running, such as ensuring it starts back up when the system boots, and to capture stdout/stderr logging.
While Caddy can be run directly with its [command line interface](/docs/command-line), there are numerous advantages to using a service manager to keep it running, such as ensuring it starts automatically when the system reboots and to capture stdout/stderr logs.
- [Linux Service](#linux-service)
@ -25,7 +25,7 @@ The recommended way to run Caddy on Linux distributions with systemd is with our
We provide two different systemd unit files that you can choose between, depending on your usecase:
- [**`caddy.service`**](https://github.com/caddyserver/dist/blob/master/init/caddy.service) if you configure Caddy with a [Caddyfile](/docs/caddyfile). If you prefer to use a JSON config file, you may [override](#overrides) the `ExecStart` and `ExecReload` commands.
- [**`caddy.service`**](https://github.com/caddyserver/dist/blob/master/init/caddy.service) if you configure Caddy with a [Caddyfile](/docs/caddyfile). If you prefer to use a different config adapter or a JSON config file, you may [override](#overrides) the `ExecStart` and `ExecReload` commands.
- [**`caddy-api.service`**](https://github.com/caddyserver/dist/blob/master/init/caddy-api.service) if you configure Caddy solely through its [API](/docs/api). This service uses the [`--resume`](/docs/command-line#caddy-run) option which will start Caddy using the `autosave.json` which is [persisted](/docs/json/admin/config/) by default.
@ -84,7 +84,7 @@ Test that it worked:
Create a group named `caddy`:
<pre><code class="cmd bash">sudo groupadd --system caddy</code></pre>
Create a user named `caddy`, with a writeable home directory:
Create a user named `caddy` with a writeable home directory:
<pre><code class="cmd bash">sudo useradd --system \
--gid caddy \
--create-home \
@ -140,6 +140,33 @@ Then, save the file and exit the text editor, and restart the service for it to
## Windows service
There are two ways to run Caddy as a service on Windows: sc.exe or WinSW.
### sc.exe
To create the service, run:
```
sc.exe create caddy start= auto binPath= "YOURPATH\caddy.exe run"
```
(replace YOURPATH with the actual path to your `caddy.exe`)
To start:
```
sc.exe start caddy
```
To stop:
```
sc.exe stop caddy
```
### WinSW
Install Caddy as a service on Windows with these instructions.
**Requirements:**
@ -185,7 +212,7 @@ For customizing the service wrapper, see the [WinSW documentation](https://githu
## Docker Compose
The simplest way to get up and running with Docker is to use Docker Compose. _The below is only an excerpt, see the docs on [Docker Hub](https://hub.docker.com/_/caddy) for more details_.
The simplest way to get up and running with Docker is to use Docker Compose. _The below is only an excerpt. See the docs on [Docker Hub](https://hub.docker.com/_/caddy) for more details_.
First, create a file `docker-compose.yml` (or add this service to your existing file):