Update README.md

master
basilhendroff 2020-05-21 13:19:50 +08:00 committed by GitHub
parent 4cc65c6df1
commit 4682b81bb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 29 additions and 3 deletions

View File

@ -1,11 +1,32 @@
# freenas-iocage-caddy
Script to install Caddy V2 in a FreeNAS jail
The aim is to develop a script to install Caddy V2 in a FreeNAS jail
##
### Currently supported
The centrepiece is a rc.d script, which supports default methods such as `service caddy stop` and `service caddy status`, but also includes a modifed `service caddy start` method to support the Caddy V2 executable as well as the following extra commands:
service caddy reload - A config reload with zero downtime. More info at https://caddyserver.com/docs/command-line#caddy-reload
service caddy validate - Check for a valid Caddyfile configuration. More info at https://caddyserver.com/docs/command-line#caddy-validate
Additional commands may be added at a later stage if deemed useful.
For other configurable script parameters, refer to the comments at the top of the rc.d script. At this stage, configurable script parameters include:
caddy_enable - Set to enable caddy. The default is disabled.
caddy_bin_path - location of the Caddy executable. The default is /usr/local/bin/caddy.
caddy_config_path - location of the Caddyfile. The default is /usr/local/www/Caddyfile
To change the defaults add lines to /etc/rc.conf. For example:
sysrc caddy_enable="YES"
sysrc caddy_bin_path="/usr/local/sbin/caddy"
Additional configrable script parameters may be added at a later stage if deemed useful.
### To Do
#### Build the install script
The script will mirror the steps below, that are presently manually executed.
```
# Set up the jail
iocage create --name="caddyv2" -r 11.3-RELEASE ip4_addr="vnet0|10.1.1.45/24" defaultrouter="10.1.1.1" boot="on" host_hostname="caddyv2" vnet="on"
@ -21,8 +42,13 @@ Script to install Caddy V2 in a FreeNAS jail
mkdir -p /usr/local/www && cd /usr/local/www
nano Caddyfile # Paste in the 'Hello World' text from includes/Caddyfile
# Install the Caddy V2 port
# Install the Caddy V2 executable
fetch https://github.com/caddyserver/caddy/releases/download/v2.0.0/caddy_2.0.0_freebsd_amd64.tar.gz
tar -xzvf caddy_2.0.0_freebsd_amd64.tar.gz
rm caddy_2.0.0_freebsd_amd64.tar.gz
# Start and test the Caddy installation
sysrc caddy_enable="YES"
Restart the jail.
In a browser, enter jail_IP:2015. You should see 'Hello World' returned.
```