diff --git a/Caddyfile b/Caddyfile index 83d2c36..f89c9a8 100644 --- a/Caddyfile +++ b/Caddyfile @@ -5,21 +5,22 @@ # # To use your own domain name (with automatic HTTPS), first make # sure your domain's A/AAAA DNS records are properly pointed to -# this machine's public IP, then replace the line below with your +# this machine's public IP, then replace ":80" below with your # domain name. -:80 -# Set this path to your site's directory. -root * /usr/share/caddy +:80 { + # Set this path to your site's directory. + root * /usr/share/caddy -# Enable the static file server. -file_server + # Enable the static file server. + file_server -# Another common task is to set up a reverse proxy: -# reverse_proxy localhost:8080 + # Another common task is to set up a reverse proxy: + # reverse_proxy localhost:8080 -# Or serve a PHP site through php-fpm: -# php_fastcgi localhost:9000 + # Or serve a PHP site through php-fpm: + # php_fastcgi localhost:9000 +} # Refer to the Caddy docs for more information: # https://caddyserver.com/docs/caddyfile diff --git a/_service b/_service index fb1842a..9f0e1e5 100644 --- a/_service +++ b/_service @@ -1,20 +1,8 @@ - - https://github.com/caddyserver/caddy.git - git - caddy - @PARENT_TAG@ - v(.*) - v2.8.4 - enable - - - - - *.tar - gz - + + ./ + ./ diff --git a/bash-completion b/bash-completion deleted file mode 100644 index 82eea79..0000000 --- a/bash-completion +++ /dev/null @@ -1,1210 +0,0 @@ -# caddy completion -*- shell-script -*- - -# helper method -declare -f _contains_element > /dev/null || _contains_element() { - local e match="$1" - shift - for e; do [[ "$e" == "$match" ]] && return 0; done - return 1 -} - -_caddy_completions() -{ - # get current word, words array, current word index, and previous word, ignoring ":" as a wordbreak - local cur cword words - _get_comp_words_by_ref -n ":" cur words cword prev - - # complete subcommands list - if [ "$cword" -eq "1" ] && [ "adapt build-info environ file-server fmt hash-password help list-modules reload reverse-proxy run start stop trust untrust validate version" != "" ]; then - COMPREPLY=($(compgen -W "adapt build-info environ file-server fmt hash-password help list-modules reload reverse-proxy run start stop trust untrust validate version" -- "$cur")) - __ltrim_colon_completions "$cur" - return - fi - - local subcommand="${words[1]}" - - local args used_flags used_args index - - # register completions for each subcommand - if [ "${subcommand}" == "adapt" ]; then - local args_shift=2 - # get the list of already used flags and args, ignoring the current word - args=("${words[@]:args_shift}") # args without command and subcommand - used_flags=() - used_args=() - index=0 - - while [ "${#args[@]}" -gt 0 ]; do - if [ "${index}" -eq "$((cword-args_shift))" ]; then - # ignore current word - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - if [ "${args[0]}" == "--pretty" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - if [ "${args[0]}" == "--validate" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - if [ "${args[0]}" == "--adapter" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - if [ "${args[0]}" == "--config" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - - if [[ "${args[0]}" != "-"* ]]; then - used_args+=("${args[0]}") - fi - args=("${args[@]:1}") - index=$((index+1)) - done - - if [[ "$prev" == "--adapter" ]]; then - COMPREPLY=() - if command -v grep > /dev/null && command -v sed > /dev/null && command -v tr > /dev/null; then - COMPREPLY=($(compgen -W "$(caddy list-modules | grep adapters | sed s/caddy.adapters.// | tr ' -' ' ')" -- "$cur")) - fi - return - fi - if [[ "$prev" == "--config" ]]; then - COMPREPLY=() - COMPREPLY=($(compgen -f -- "$cur")) - return - fi - - if [[ $cur == -* ]]; then - # flags - completion=() - - if [[ $cur != --* ]]; then - true - fi - - if ! _contains_element "--pretty" "${used_flags[@]}"; then - completion+=("--pretty") - fi - if ! _contains_element "--validate" "${used_flags[@]}"; then - completion+=("--validate") - fi - if ! _contains_element "--adapter" "${used_flags[@]}"; then - completion+=("--adapter") - fi - if ! _contains_element "--config" "${used_flags[@]}"; then - completion+=("--config") - fi - - COMPREPLY=($(compgen -W "${completion[*]}" -- "$cur")) - return - fi - - - return - fi - if [ "${subcommand}" == "build-info" ]; then - local args_shift=2 - # get the list of already used flags and args, ignoring the current word - args=("${words[@]:args_shift}") # args without command and subcommand - used_flags=() - used_args=() - index=0 - - while [ "${#args[@]}" -gt 0 ]; do - if [ "${index}" -eq "$((cword-args_shift))" ]; then - # ignore current word - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - - - if [[ "${args[0]}" != "-"* ]]; then - used_args+=("${args[0]}") - fi - args=("${args[@]:1}") - index=$((index+1)) - done - - - if [[ $cur == -* ]]; then - # flags - completion=() - - if [[ $cur != --* ]]; then - true - fi - - - COMPREPLY=($(compgen -W "${completion[*]}" -- "$cur")) - return - fi - - - return - fi - if [ "${subcommand}" == "environ" ]; then - local args_shift=2 - # get the list of already used flags and args, ignoring the current word - args=("${words[@]:args_shift}") # args without command and subcommand - used_flags=() - used_args=() - index=0 - - while [ "${#args[@]}" -gt 0 ]; do - if [ "${index}" -eq "$((cword-args_shift))" ]; then - # ignore current word - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - - - if [[ "${args[0]}" != "-"* ]]; then - used_args+=("${args[0]}") - fi - args=("${args[@]:1}") - index=$((index+1)) - done - - - if [[ $cur == -* ]]; then - # flags - completion=() - - if [[ $cur != --* ]]; then - true - fi - - - COMPREPLY=($(compgen -W "${completion[*]}" -- "$cur")) - return - fi - - - return - fi - if [ "${subcommand}" == "file-server" ]; then - local args_shift=2 - # get the list of already used flags and args, ignoring the current word - args=("${words[@]:args_shift}") # args without command and subcommand - used_flags=() - used_args=() - index=0 - - while [ "${#args[@]}" -gt 0 ]; do - if [ "${index}" -eq "$((cword-args_shift))" ]; then - # ignore current word - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - if [ "${args[0]}" == "--browse" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - if [ "${args[0]}" == "--templates" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - if [ "${args[0]}" == "--domain" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - if [ "${args[0]}" == "--listen" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - if [ "${args[0]}" == "--root" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - - if [[ "${args[0]}" != "-"* ]]; then - used_args+=("${args[0]}") - fi - args=("${args[@]:1}") - index=$((index+1)) - done - - if [[ "$prev" == "--domain" ]]; then - COMPREPLY=() - return - fi - if [[ "$prev" == "--listen" ]]; then - COMPREPLY=() - return - fi - if [[ "$prev" == "--root" ]]; then - COMPREPLY=() - COMPREPLY=($(compgen -d -- "$cur")) - return - fi - - if [[ $cur == -* ]]; then - # flags - completion=() - - if [[ $cur != --* ]]; then - true - fi - - if ! _contains_element "--browse" "${used_flags[@]}"; then - completion+=("--browse") - fi - if ! _contains_element "--templates" "${used_flags[@]}"; then - completion+=("--templates") - fi - if ! _contains_element "--domain" "${used_flags[@]}"; then - completion+=("--domain") - fi - if ! _contains_element "--listen" "${used_flags[@]}"; then - completion+=("--listen") - fi - if ! _contains_element "--root" "${used_flags[@]}"; then - completion+=("--root") - fi - - COMPREPLY=($(compgen -W "${completion[*]}" -- "$cur")) - return - fi - - - return - fi - if [ "${subcommand}" == "fmt" ]; then - local args_shift=2 - # get the list of already used flags and args, ignoring the current word - args=("${words[@]:args_shift}") # args without command and subcommand - used_flags=() - used_args=() - index=0 - - while [ "${#args[@]}" -gt 0 ]; do - if [ "${index}" -eq "$((cword-args_shift))" ]; then - # ignore current word - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - if [ "${args[0]}" == "--overwrite" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - - if [[ "${args[0]}" != "-"* ]]; then - used_args+=("${args[0]}") - fi - args=("${args[@]:1}") - index=$((index+1)) - done - - - if [[ $cur == -* ]]; then - # flags - completion=() - - if [[ $cur != --* ]]; then - true - fi - - if ! _contains_element "--overwrite" "${used_flags[@]}"; then - completion+=("--overwrite") - fi - - COMPREPLY=($(compgen -W "${completion[*]}" -- "$cur")) - return - fi - - if [[ "${#used_args[@]}" -eq "0" ]]; then - COMPREPLY=() - COMPREPLY=($(compgen -f -- "$cur")) - return - fi - - return - fi - if [ "${subcommand}" == "hash-password" ]; then - local args_shift=2 - # get the list of already used flags and args, ignoring the current word - args=("${words[@]:args_shift}") # args without command and subcommand - used_flags=() - used_args=() - index=0 - - while [ "${#args[@]}" -gt 0 ]; do - if [ "${index}" -eq "$((cword-args_shift))" ]; then - # ignore current word - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - - if [ "${args[0]}" == "--algorithm" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - if [ "${args[0]}" == "--plaintext" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - if [ "${args[0]}" == "--salt" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - - if [[ "${args[0]}" != "-"* ]]; then - used_args+=("${args[0]}") - fi - args=("${args[@]:1}") - index=$((index+1)) - done - - if [[ "$prev" == "--algorithm" ]]; then - COMPREPLY=() - return - fi - if [[ "$prev" == "--plaintext" ]]; then - COMPREPLY=() - return - fi - if [[ "$prev" == "--salt" ]]; then - COMPREPLY=() - return - fi - - if [[ $cur == -* ]]; then - # flags - completion=() - - if [[ $cur != --* ]]; then - true - fi - - if ! _contains_element "--algorithm" "${used_flags[@]}"; then - completion+=("--algorithm") - fi - if ! _contains_element "--plaintext" "${used_flags[@]}"; then - completion+=("--plaintext") - fi - if ! _contains_element "--salt" "${used_flags[@]}"; then - completion+=("--salt") - fi - - COMPREPLY=($(compgen -W "${completion[*]}" -- "$cur")) - return - fi - - - return - fi - if [ "${subcommand}" == "help" ]; then - local args_shift=2 - # get the list of already used flags and args, ignoring the current word - args=("${words[@]:args_shift}") # args without command and subcommand - used_flags=() - used_args=() - index=0 - - while [ "${#args[@]}" -gt 0 ]; do - if [ "${index}" -eq "$((cword-args_shift))" ]; then - # ignore current word - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - - - if [[ "${args[0]}" != "-"* ]]; then - used_args+=("${args[0]}") - fi - args=("${args[@]:1}") - index=$((index+1)) - done - - - if [[ $cur == -* ]]; then - # flags - completion=() - - if [[ $cur != --* ]]; then - true - fi - - - COMPREPLY=($(compgen -W "${completion[*]}" -- "$cur")) - return - fi - - if [[ "${#used_args[@]}" -eq "0" ]]; then - COMPREPLY=() - COMPREPLY=($(compgen -W "adapt build-info environ file-server fmt hash-password help list-modules reload reverse-proxy run stop trust untrust validate" -- "$cur")) - return - fi - - return - fi - if [ "${subcommand}" == "list-modules" ]; then - local args_shift=2 - # get the list of already used flags and args, ignoring the current word - args=("${words[@]:args_shift}") # args without command and subcommand - used_flags=() - used_args=() - index=0 - - while [ "${#args[@]}" -gt 0 ]; do - if [ "${index}" -eq "$((cword-args_shift))" ]; then - # ignore current word - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - if [ "${args[0]}" == "--versions" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - - if [[ "${args[0]}" != "-"* ]]; then - used_args+=("${args[0]}") - fi - args=("${args[@]:1}") - index=$((index+1)) - done - - - if [[ $cur == -* ]]; then - # flags - completion=() - - if [[ $cur != --* ]]; then - true - fi - - if ! _contains_element "--versions" "${used_flags[@]}"; then - completion+=("--versions") - fi - - COMPREPLY=($(compgen -W "${completion[*]}" -- "$cur")) - return - fi - - - return - fi - if [ "${subcommand}" == "reload" ]; then - local args_shift=2 - # get the list of already used flags and args, ignoring the current word - args=("${words[@]:args_shift}") # args without command and subcommand - used_flags=() - used_args=() - index=0 - - while [ "${#args[@]}" -gt 0 ]; do - if [ "${index}" -eq "$((cword-args_shift))" ]; then - # ignore current word - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - - if [ "${args[0]}" == "--adapter" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - if [ "${args[0]}" == "--config" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - if [ "${args[0]}" == "--address" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - - if [[ "${args[0]}" != "-"* ]]; then - used_args+=("${args[0]}") - fi - args=("${args[@]:1}") - index=$((index+1)) - done - - if [[ "$prev" == "--adapter" ]]; then - COMPREPLY=() - if command -v grep > /dev/null && command -v sed > /dev/null && command -v tr > /dev/null; then - COMPREPLY=($(compgen -W "$(caddy list-modules | grep adapters | sed s/caddy.adapters.// | tr ' -' ' ')" -- "$cur")) - fi - return - fi - if [[ "$prev" == "--config" ]]; then - COMPREPLY=() - COMPREPLY=($(compgen -f -- "$cur")) - return - fi - if [[ "$prev" == "--address" ]]; then - COMPREPLY=() - return - fi - - if [[ $cur == -* ]]; then - # flags - completion=() - - if [[ $cur != --* ]]; then - true - fi - - if ! _contains_element "--adapter" "${used_flags[@]}"; then - completion+=("--adapter") - fi - if ! _contains_element "--config" "${used_flags[@]}"; then - completion+=("--config") - fi - if ! _contains_element "--address" "${used_flags[@]}"; then - completion+=("--address") - fi - - COMPREPLY=($(compgen -W "${completion[*]}" -- "$cur")) - return - fi - - - return - fi - if [ "${subcommand}" == "reverse-proxy" ]; then - local args_shift=2 - # get the list of already used flags and args, ignoring the current word - args=("${words[@]:args_shift}") # args without command and subcommand - used_flags=() - used_args=() - index=0 - - while [ "${#args[@]}" -gt 0 ]; do - if [ "${index}" -eq "$((cword-args_shift))" ]; then - # ignore current word - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - if [ "${args[0]}" == "--change-host-header" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - if [ "${args[0]}" == "--from" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - if [ "${args[0]}" == "--to" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - - if [[ "${args[0]}" != "-"* ]]; then - used_args+=("${args[0]}") - fi - args=("${args[@]:1}") - index=$((index+1)) - done - - if [[ "$prev" == "--from" ]]; then - COMPREPLY=() - return - fi - if [[ "$prev" == "--to" ]]; then - COMPREPLY=() - return - fi - - if [[ $cur == -* ]]; then - # flags - completion=() - - if [[ $cur != --* ]]; then - true - fi - - if ! _contains_element "--change-host-header" "${used_flags[@]}"; then - completion+=("--change-host-header") - fi - if ! _contains_element "--from" "${used_flags[@]}"; then - completion+=("--from") - fi - if ! _contains_element "--to" "${used_flags[@]}"; then - completion+=("--to") - fi - - COMPREPLY=($(compgen -W "${completion[*]}" -- "$cur")) - return - fi - - - return - fi - if [ "${subcommand}" == "run" ]; then - local args_shift=2 - # get the list of already used flags and args, ignoring the current word - args=("${words[@]:args_shift}") # args without command and subcommand - used_flags=() - used_args=() - index=0 - - while [ "${#args[@]}" -gt 0 ]; do - if [ "${index}" -eq "$((cword-args_shift))" ]; then - # ignore current word - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - if [ "${args[0]}" == "--environ" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - if [ "${args[0]}" == "--resume" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - if [ "${args[0]}" == "--watch" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - if [ "${args[0]}" == "--adapter" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - if [ "${args[0]}" == "--config" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - if [ "${args[0]}" == "--pingback" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - if [ "${args[0]}" == "--pidfile" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - - if [[ "${args[0]}" != "-"* ]]; then - used_args+=("${args[0]}") - fi - args=("${args[@]:1}") - index=$((index+1)) - done - - if [[ "$prev" == "--adapter" ]]; then - COMPREPLY=() - if command -v grep > /dev/null && command -v sed > /dev/null && command -v tr > /dev/null; then - COMPREPLY=($(compgen -W "$(caddy list-modules | grep adapters | sed s/caddy.adapters.// | tr ' -' ' ')" -- "$cur")) - fi - return - fi - if [[ "$prev" == "--config" ]]; then - COMPREPLY=() - COMPREPLY=($(compgen -f -- "$cur")) - return - fi - if [[ "$prev" == "--pingback" ]]; then - COMPREPLY=() - return - fi - if [[ "$prev" == "--pidfile" ]]; then - COMPREPLY=() - COMPREPLY=($(compgen -f -- "$cur")) - return - fi - - if [[ $cur == -* ]]; then - # flags - completion=() - - if [[ $cur != --* ]]; then - true - fi - - if ! _contains_element "--environ" "${used_flags[@]}"; then - completion+=("--environ") - fi - if ! _contains_element "--resume" "${used_flags[@]}"; then - completion+=("--resume") - fi - if ! _contains_element "--watch" "${used_flags[@]}"; then - completion+=("--watch") - fi - if ! _contains_element "--adapter" "${used_flags[@]}"; then - completion+=("--adapter") - fi - if ! _contains_element "--config" "${used_flags[@]}"; then - completion+=("--config") - fi - if ! _contains_element "--pingback" "${used_flags[@]}"; then - completion+=("--pingback") - fi - if ! _contains_element "--pidfile" "${used_flags[@]}"; then - completion+=("--pidfile") - fi - - COMPREPLY=($(compgen -W "${completion[*]}" -- "$cur")) - return - fi - - - return - fi - if [ "${subcommand}" == "start" ]; then - local args_shift=2 - # get the list of already used flags and args, ignoring the current word - args=("${words[@]:args_shift}") # args without command and subcommand - used_flags=() - used_args=() - index=0 - - while [ "${#args[@]}" -gt 0 ]; do - if [ "${index}" -eq "$((cword-args_shift))" ]; then - # ignore current word - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - if [ "${args[0]}" == "--watch" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - if [ "${args[0]}" == "--adapter" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - if [ "${args[0]}" == "--config" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - if [ "${args[0]}" == "--pidfile" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - - if [[ "${args[0]}" != "-"* ]]; then - used_args+=("${args[0]}") - fi - args=("${args[@]:1}") - index=$((index+1)) - done - - if [[ "$prev" == "--adapter" ]]; then - COMPREPLY=() - if command -v grep > /dev/null && command -v sed > /dev/null && command -v tr > /dev/null; then - COMPREPLY=($(compgen -W "$(caddy list-modules | grep adapters | sed s/caddy.adapters.// | tr ' -' ' ')" -- "$cur")) - fi - return - fi - if [[ "$prev" == "--config" ]]; then - COMPREPLY=() - COMPREPLY=($(compgen -f -- "$cur")) - return - fi - if [[ "$prev" == "--pidfile" ]]; then - COMPREPLY=() - COMPREPLY=($(compgen -f -- "$cur")) - return - fi - - if [[ $cur == -* ]]; then - # flags - completion=() - - if [[ $cur != --* ]]; then - true - fi - - if ! _contains_element "--watch" "${used_flags[@]}"; then - completion+=("--watch") - fi - if ! _contains_element "--adapter" "${used_flags[@]}"; then - completion+=("--adapter") - fi - if ! _contains_element "--config" "${used_flags[@]}"; then - completion+=("--config") - fi - if ! _contains_element "--pidfile" "${used_flags[@]}"; then - completion+=("--pidfile") - fi - - COMPREPLY=($(compgen -W "${completion[*]}" -- "$cur")) - return - fi - - - return - fi - if [ "${subcommand}" == "stop" ]; then - local args_shift=2 - # get the list of already used flags and args, ignoring the current word - args=("${words[@]:args_shift}") # args without command and subcommand - used_flags=() - used_args=() - index=0 - - while [ "${#args[@]}" -gt 0 ]; do - if [ "${index}" -eq "$((cword-args_shift))" ]; then - # ignore current word - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - - if [ "${args[0]}" == "--address" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - - if [[ "${args[0]}" != "-"* ]]; then - used_args+=("${args[0]}") - fi - args=("${args[@]:1}") - index=$((index+1)) - done - - if [[ "$prev" == "--address" ]]; then - COMPREPLY=() - return - fi - - if [[ $cur == -* ]]; then - # flags - completion=() - - if [[ $cur != --* ]]; then - true - fi - - if ! _contains_element "--address" "${used_flags[@]}"; then - completion+=("--address") - fi - - COMPREPLY=($(compgen -W "${completion[*]}" -- "$cur")) - return - fi - - - return - fi - if [ "${subcommand}" == "trust" ]; then - local args_shift=2 - # get the list of already used flags and args, ignoring the current word - args=("${words[@]:args_shift}") # args without command and subcommand - used_flags=() - used_args=() - index=0 - - while [ "${#args[@]}" -gt 0 ]; do - if [ "${index}" -eq "$((cword-args_shift))" ]; then - # ignore current word - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - - - if [[ "${args[0]}" != "-"* ]]; then - used_args+=("${args[0]}") - fi - args=("${args[@]:1}") - index=$((index+1)) - done - - - if [[ $cur == -* ]]; then - # flags - completion=() - - if [[ $cur != --* ]]; then - true - fi - - - COMPREPLY=($(compgen -W "${completion[*]}" -- "$cur")) - return - fi - - - return - fi - if [ "${subcommand}" == "untrust" ]; then - local args_shift=2 - # get the list of already used flags and args, ignoring the current word - args=("${words[@]:args_shift}") # args without command and subcommand - used_flags=() - used_args=() - index=0 - - while [ "${#args[@]}" -gt 0 ]; do - if [ "${index}" -eq "$((cword-args_shift))" ]; then - # ignore current word - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - - if [ "${args[0]}" == "--ca" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - if [ "${args[0]}" == "--cert" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - - if [[ "${args[0]}" != "-"* ]]; then - used_args+=("${args[0]}") - fi - args=("${args[@]:1}") - index=$((index+1)) - done - - if [[ "$prev" == "--ca" ]]; then - COMPREPLY=() - return - fi - if [[ "$prev" == "--cert" ]]; then - COMPREPLY=() - COMPREPLY=($(compgen -f -- "$cur")) - return - fi - - if [[ $cur == -* ]]; then - # flags - completion=() - - if [[ $cur != --* ]]; then - true - fi - - if ! _contains_element "--ca" "${used_flags[@]}"; then - completion+=("--ca") - fi - if ! _contains_element "--cert" "${used_flags[@]}"; then - completion+=("--cert") - fi - - COMPREPLY=($(compgen -W "${completion[*]}" -- "$cur")) - return - fi - - - return - fi - if [ "${subcommand}" == "validate" ]; then - local args_shift=2 - # get the list of already used flags and args, ignoring the current word - args=("${words[@]:args_shift}") # args without command and subcommand - used_flags=() - used_args=() - index=0 - - while [ "${#args[@]}" -gt 0 ]; do - if [ "${index}" -eq "$((cword-args_shift))" ]; then - # ignore current word - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - - if [ "${args[0]}" == "--config" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - if [ "${args[0]}" == "--adapter" ]; then - used_flags+=("${args[0]}") - args=("${args[@]:2}") - index=$((index+2)) - continue - fi - - if [[ "${args[0]}" != "-"* ]]; then - used_args+=("${args[0]}") - fi - args=("${args[@]:1}") - index=$((index+1)) - done - - if [[ "$prev" == "--config" ]]; then - COMPREPLY=() - COMPREPLY=($(compgen -f -- "$cur")) - return - fi - if [[ "$prev" == "--adapter" ]]; then - COMPREPLY=() - if command -v grep > /dev/null && command -v sed > /dev/null && command -v tr > /dev/null; then - COMPREPLY=($(compgen -W "$(caddy list-modules | grep adapters | sed s/caddy.adapters.// | tr ' -' ' ')" -- "$cur")) - fi - return - fi - - if [[ $cur == -* ]]; then - # flags - completion=() - - if [[ $cur != --* ]]; then - true - fi - - if ! _contains_element "--config" "${used_flags[@]}"; then - completion+=("--config") - fi - if ! _contains_element "--adapter" "${used_flags[@]}"; then - completion+=("--adapter") - fi - - COMPREPLY=($(compgen -W "${completion[*]}" -- "$cur")) - return - fi - - - return - fi - if [ "${subcommand}" == "version" ]; then - local args_shift=2 - # get the list of already used flags and args, ignoring the current word - args=("${words[@]:args_shift}") # args without command and subcommand - used_flags=() - used_args=() - index=0 - - while [ "${#args[@]}" -gt 0 ]; do - if [ "${index}" -eq "$((cword-args_shift))" ]; then - # ignore current word - args=("${args[@]:1}") - index=$((index+1)) - continue - fi - - - - if [[ "${args[0]}" != "-"* ]]; then - used_args+=("${args[0]}") - fi - args=("${args[@]:1}") - index=$((index+1)) - done - - - if [[ $cur == -* ]]; then - # flags - completion=() - - if [[ $cur != --* ]]; then - true - fi - - - COMPREPLY=($(compgen -W "${completion[*]}" -- "$cur")) - return - fi - - - return - fi -} - -# register completion -complete -F _caddy_completions caddy - diff --git a/caddy-2.8.4.tar.gz b/caddy-2.8.4.tar.gz index eb648a3..5eb010a 100644 --- a/caddy-2.8.4.tar.gz +++ b/caddy-2.8.4.tar.gz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3e0792d64cf4c30314f078dff742dac165ce347cf75a4b1d929a82df50e4f655 -size 678314 +oid sha256:9e2125dda6200fc997d3965578e7b526e042857f2305261c02853775c04e1cf6 +size 10306476 diff --git a/caddy.changes b/caddy.changes index 6d2ac45..8406c77 100644 --- a/caddy.changes +++ b/caddy.changes @@ -1,3 +1,22 @@ +------------------------------------------------------------------- +Fri Jun 14 10:21:50 UTC 2024 - Enrico Belleri + +- Add OBS manual service download_files + +------------------------------------------------------------------- +Tue Jun 11 14:55:47 UTC 2024 - Enrico Belleri + +- Source Caddyfile and index.html from upstream +- Remove part of inaccurate description +- Package shell completion separately +- Generate shell completion during build +- Include manpages +- Remove compatibility with SLE-12 +- Source buildable-artifact tar from github to embed version + information (https://github.com/golang/go/issues/29228) +- Check binary with version subcommand +- Raise golang(API) required version + ------------------------------------------------------------------- Sun Jun 02 14:15:59 UTC 2024 - Jeff Kowalczyk diff --git a/caddy.spec b/caddy.spec index 18b708f..4c83768 100644 --- a/caddy.spec +++ b/caddy.spec @@ -16,14 +16,6 @@ # -# SLE-12 _sharedstatedir was /usr/com, _localstatedir is /var as expected -# SLE-15+ _sharedstatedir is /var/lib, _localstatedir is /var -# _sharedstatedir used here as home directory for newly created user caddy -# If not redefined build fails with empty /usr/com not owned by any package -%if 0%{?suse_version} < 1500 -%define _sharedstatedir /var/lib -%endif - Name: caddy Version: 2.8.4 Release: 0 @@ -31,17 +23,16 @@ Summary: Fast, multi-platform web server with automatic HTTPS License: Apache-2.0 Group: Productivity/Networking/Web/Proxy URL: https://caddyserver.com/ -Source0: %{name}-%{version}.tar.gz +# bug https://github.com/golang/go/issues/29228 +Source0: https://github.com/caddyserver/%{name}/releases/download/v%{version}/%{name}_%{version}_buildable-artifact.tar.gz#/%{name}-%{version}.tar.gz Source1: vendor.tar.gz -Source2: Caddyfile +Source2: https://github.com/caddyserver/dist/raw/v%{version}/config/Caddyfile Source3: caddy.service -Source4: index.html -Source5: bash-completion -Source6: zsh-completion -Source7: caddy.sysusers +Source4: https://github.com/caddyserver/dist/raw/v%{version}/welcome/index.html +Source5: caddy.sysusers BuildRequires: systemd-rpm-macros BuildRequires: sysuser-tools -BuildRequires: golang(API) >= 1.21 +BuildRequires: golang(API) >= 1.22 %{?systemd_requires} %{sysusers_requires} @@ -49,22 +40,47 @@ BuildRequires: golang(API) >= 1.21 Caddy is a powerful, extensible platform to serve your sites, services, and apps, written in Go. -It operates primarily at L4 (transport layer) and L7 (application layer) of -the OSI model, though it has the ability to work with other layers. +%package bash-completion +Summary: Bash Completion for %{name} +Group: System/Shells +Requires: bash-completion +Supplements: (%{name} and bash) +BuildArch: noarch + +%description bash-completion +Bash completion script for %{name}, generated during the build. + +%package zsh-completion +Summary: ZSH Completion for %{name} +Group: System/Shells +Supplements: (%{name} and zsh) +BuildArch: noarch + +%description zsh-completion +ZSH completion script for %{name}, generated during the build. + +%package fish-completion +Summary: Fish Completion for %{name} +Group: System/Shells +Supplements: (%{name} and fish) +BuildArch: noarch + +%description fish-completion +Fish shell completion script for %{name}, generated during the build. %prep -%autosetup -a 1 +%autosetup -a 1 -c %build # Build the binary. %ifnarch ppc64 export GOFLAGS="-buildmode=pie" %endif -go build ./cmd/%{name} +go build -v -x %check -# execute the binary as a basic check -./%{name} --help +# Execute binary and check version +[[ "$(./%{name} version)" == "v%{version}" ]] || exit 1 %install install -d %{buildroot}/%{_sbindir} @@ -76,7 +92,7 @@ install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/%{name}/Caddyfile # service install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name} -install -Dpm0644 %{SOURCE7} %{buildroot}%{_sysusersdir}/%{name}.conf +install -Dpm0644 %{SOURCE5} %{buildroot}%{_sysusersdir}/%{name}.conf # data directory install -d -m 0750 %{buildroot}%{_sharedstatedir}/%{name} @@ -85,10 +101,21 @@ install -d -m 0750 %{buildroot}%{_sharedstatedir}/%{name} install -D -p -m 0644 %{SOURCE4} %{buildroot}%{_datadir}/%{name}/index.html # bash completion -install -D -p -m 0644 %{SOURCE5} %{buildroot}%{_datadir}/bash-completion/completions/%{name} -install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_datadir}/zsh/site-functions/_%{name} +install -d -p -m 0755 %{buildroot}%{_datadir}/bash-completion/completions +./%{name} completion bash > %{buildroot}%{_datadir}/bash-completion/completions/%{name} -%sysusers_generate_pre %{SOURCE7} %{name} %{name}.conf +# zsh completion +install -d -p -m 0755 %{buildroot}%{_datadir}/zsh/site-functions +./%{name} completion zsh > %{buildroot}%{_datadir}/zsh/site-functions/_%{name} + +# fish completion +install -d -p -m 0755 %{buildroot}%{_datadir}/fish/vendor_completions.d +./%{name} completion fish > %{buildroot}%{_datadir}/fish/vendor_completions.d/%{name}.fish + +# man pages +./%{name} manpage --directory %{buildroot}%{_mandir}/man8 + +%sysusers_generate_pre %{SOURCE5} %{name} %{name}.conf %pre -f %{name}.pre %service_add_pre %{name}.service @@ -106,6 +133,7 @@ install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_datadir}/zsh/site-functions/_%{n %files %license LICENSE %doc AUTHORS README.md +%{_mandir}/man8/caddy*.8%{?ext_man} %{_bindir}/%{name} %{_datadir}/%{name} %{_unitdir}/%{name}.service @@ -114,11 +142,14 @@ install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_datadir}/zsh/site-functions/_%{n %dir %{_sysconfdir}/%{name} %config(noreplace) %{_sysconfdir}/%{name}/Caddyfile %dir %attr(0750, %{name}, %{name}) %{_sharedstatedir}/%{name} -# filesystem owns all the parent directories here -%{_datadir}/bash-completion/completions/%{name} -# own parent directories in case zsh is not installed -%dir %{_datadir}/zsh -%dir %{_datadir}/zsh/site-functions -%{_datadir}/zsh/site-functions/_%{name} + +%files bash-completion +%{_datadir}/bash-completion + +%files fish-completion +%{_datadir}/fish + +%files zsh-completion +%{_datadir}/zsh %changelog diff --git a/index.html b/index.html index 78b7777..69284f2 100644 --- a/index.html +++ b/index.html @@ -1,269 +1,394 @@ - - Caddy works! - - - - + - #caddy .caddy-color { - fill: #005e7e; - } + +
+
+
+
+ + + + + + + + + - h1 { - font-size: 20px; - margin-bottom: 50px; - } +

+ Congratulations! + おめでとう! + Felicidades! + 恭喜! + बधाई हो! + Поздравляю! + Вітаю! + 🎊 +

- h1 .emoji { - font-size: 150%; - vertical-align: middle; - } +

+ Your web server is working. Now make it work for you. 💪 +

+

+ Caddy is ready to serve your site over HTTPS: +

+
    +
  1. Point your domain's A/AAAA DNS records at this machine.
  2. +
  3. Upload your site's files to /var/www/html. +
  4. + Edit your Caddyfile at /etc/caddy/Caddyfile: +
      +
    1. Replace :80 with your domain name
    2. +
    3. Change the site root to /var/www/html
    4. +
    +
  5. +
  6. Reload the configuration: systemctl reload caddy
  7. +
  8. Visit your site!
  9. +
+

If that worked 🥳

+

+ Awesome! You won't have to look at this slanted page anymore. +

+

+ Remember, Caddy can do a lot more than serve static files. It's also a powerful reverse proxy and + application platform. You can use the Caddyfile to enable any other features you need. Or you could use + Caddy's API to configure it programmatically. +

+

+ Everything you need to know is either in the 📖 Caddy + documentation or the manual for your OS/platform. Have fun! +

- h1 .lang { - margin-right: 1.5em; - } - - h2 { - font-size: 28px; - margin-top: 1.5em; - } - - p, - ol, - ul { - color: #333; - line-height: 1.5em; - } - - p { - margin: 1.5em 0; - } - - ol, - ul { - margin: .5em 0 .5em 2em; - } - - ol li, - ul li { - margin-left: 1em; - margin-bottom: .5em; - } - - li ol { - list-style-type: lower-alpha; - } - - code { - color: #000; - font-family: Menlo, monospace; - background: #f0f0f0; - border-radius: 2px; - padding: 4px 8px; - font-size: 90%; - } - - .warn { - color: #dd0000; - } - - footer { - color: #777; - font-size: 16px; - text-align: center; - max-width: 600px; - margin: 0 auto 50px; - } - - #disclaimer { - font-size: 14px; - margin-top: 20px; - display: inline-block; - border-top: 1px solid #ccc; - padding: 20px; - } - - @media (max-width: 1100px) { - .stack { - width: 85%; - } - } - - @media (max-width: 800px) { - .stack { - margin: 0 0 50px 0; - width: 100%; - } - - .paper { - padding: 50px; - } - - #paper1, - #paper2 { - display: none; - } - - #paper3 { - left: 0; - transform: none; - top: 0; - } - - #caddy { - margin-bottom: 25px; - } - } - - - -
-
-
-
- - -

- Congratulations! - おめでとう! - Felicidades! - 恭喜! - बधाई हो! - Поздравляю!
 - 🎊 -

- -

- Your web server is working. Now make it work for you. 💪 -

-

- Caddy is ready to serve your site over HTTPS: -

-
    -
  1. Point your domain's A/AAAA DNS records at this machine.
  2. -
  3. Upload your site's files to /var/www/html. -
  4. - Edit your Caddyfile at /etc/caddy/Caddyfile: -
      -
    1. Replace :80 with your domain name
    2. -
    3. Change the site root to /var/www/html
    4. -
    -
  5. -
  6. Reload the configuration: systemctl reload caddy
  7. -
  8. Visit your site!
  9. -
-

If that worked 🥳

-

- Awesome! You won't have to look at this slanted page anymore. -

-

- Remember, Caddy can do a lot more than serve static files. It's also a powerful reverse proxy and application platform. You can use the Caddyfile to enable any other features you need. Or you could use Caddy's API to configure it programmatically. -

-

- Everything you need to know is either in the 📖 Caddy documentation or the manual for your OS/platform. Have fun! -

- -

If that didn't work 😶

-

- It's okay, you can fix it! First check the following things: -

-
    -
  • Service status: systemctl status caddy
  • -
  • Logs: journalctl --no-pager -u caddy
  • -
  • Are your site's files readable by the caddy user and group? ls -la /var/www/html
  • -
  • Is the caddy home directory writeable? ls -la /var/lib/caddy
  • -
  • Ensure your domain's A and/or AAAA records point to your machine's public IP address: dig example.com
  • -
  • Are your ports 80 and 443 externally reachable, and is Caddy able to bind to them? Check your firewalls, port forwarding, and other network configuration.
  • -
-

- WAIT! Before trying again, switch to Let's Encrypt's staging environment to avoid being accidentally rate limited. Once you get everything else working, it's safe to switch back. -

-

- Depending on your DNS provider, it may take a while for the DNS records to propagate. Even when everything is configured properly, automated challenges to obtain TLS certificates usually take several seconds, but may take up to several minutes or hours. -

- If you still need help, we have a great community! First try a search, and if your question is original, go ahead and ask it! Remember to pay it forward and help others too. 😁 -

-

- Visit Caddy on: - GitHub - or - Twitter - or - Our Forum -

-
+

If that didn't work 😶

+

+ It's okay, you can fix it! First check the following things: +

+
    +
  • Service status: systemctl status caddy
  • +
  • Logs: journalctl --no-pager -u caddy
  • +
  • Are your site's files readable by the caddy user and group? ls -la /var/www/html
  • +
  • Is the caddy home directory writeable? ls -la /var/lib/caddy
  • +
  • Ensure your domain's A and/or AAAA records point to your machine's public IP address: + dig example.com
  • +
  • Are your ports 80 and 443 externally reachable, and is Caddy able to bind to them? Check your + firewalls, port forwarding, and other network configuration.
  • +
+

+ WAIT! Before trying again, switch to Let's Encrypt's staging environment to + avoid being accidentally rate limited. Once you + get everything else working, it's safe to switch back. +

+

+ Depending on your DNS provider, it may take a while for the DNS records to propagate. Even when + everything is configured properly, automated challenges to obtain TLS certificates usually take several + seconds, but may take up to several minutes or hours. +

+ If you still need help, we have a great community! First try a search, and if your question is original, go ahead + and ask it! Remember to pay it forward and help others too. 😁 +

+

+ Visit Caddy on: + GitHub + or + Twitter + or + Our Forum +

+
- - - + + + \ No newline at end of file diff --git a/vendor.tar.gz b/vendor.tar.gz index 8cf7118..92aaa33 100644 --- a/vendor.tar.gz +++ b/vendor.tar.gz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b7c720de94ae3f6e752f03e9f07b3304c3ee3ef0e9f68ec99642779a7c4db9a3 -size 9782477 +oid sha256:4b6de27cc755b38ce0fbb1bb41ad566de9c7d8aa3a5cd13ef3e670f4ff939bba +size 10210785 diff --git a/zsh-completion b/zsh-completion deleted file mode 100644 index 77984f9..0000000 --- a/zsh-completion +++ /dev/null @@ -1,165 +0,0 @@ -#compdef caddy - -function _caddy { - local _line - - _arguments -C \ - "1: :(adapt build-info environ file-server fmt hash-password help list-modules reload reverse-proxy run start stop trust untrust validate version)" \ - "*::arg:->args" - - case $line[1] in - adapt) - __caddy_adapt - ;; - build-info) - __caddy_build-info - ;; - environ) - __caddy_environ - ;; - file-server) - __caddy_file-server - ;; - fmt) - __caddy_fmt - ;; - hash-password) - __caddy_hash-password - ;; - help) - __caddy_help - ;; - list-modules) - __caddy_list-modules - ;; - reload) - __caddy_reload - ;; - reverse-proxy) - __caddy_reverse-proxy - ;; - run) - __caddy_run - ;; - start) - __caddy_start - ;; - stop) - __caddy_stop - ;; - trust) - __caddy_trust - ;; - untrust) - __caddy_untrust - ;; - validate) - __caddy_validate - ;; - version) - __caddy_version - ;; - esac -} - -function __caddy_adapt { - _arguments \ - "--pretty: :" \ - "--validate: :" \ - "--adapter: :_files" \ - "--config: :_files" \ - -} -function __caddy_build-info { - -} -function __caddy_environ { - -} -function __caddy_file-server { - _arguments \ - "--browse: :" \ - "--templates: :" \ - "--domain: :_files" \ - "--listen: :_files" \ - "--root: :_dirs" \ - -} -function __caddy_fmt { - _arguments \ - "--overwrite: :" \ - -} -function __caddy_hash-password { - _arguments \ - "--algorithm: :_files" \ - "--plaintext: :_files" \ - "--salt: :_files" \ - -} -function __caddy_help { - -} -function __caddy_list-modules { - _arguments \ - "--versions: :" \ - -} -function __caddy_reload { - _arguments \ - "--adapter: :_files" \ - "--config: :_files" \ - "--address: :_files" \ - -} -function __caddy_reverse-proxy { - _arguments \ - "--change-host-header: :" \ - "--from: :_files" \ - "--to: :_files" \ - -} -function __caddy_run { - _arguments \ - "--environ: :" \ - "--resume: :" \ - "--watch: :" \ - "--adapter: :_files" \ - "--config: :_files" \ - "--pingback: :_files" \ - "--pidfile: :_files" \ - -} -function __caddy_start { - _arguments \ - "--watch: :" \ - "--adapter: :_files" \ - "--config: :_files" \ - "--pidfile: :_files" \ - -} -function __caddy_stop { - _arguments \ - "--address: :_files" \ - -} -function __caddy_trust { - -} -function __caddy_untrust { - _arguments \ - "--ca: :_files" \ - "--cert: :_files" \ - -} -function __caddy_validate { - _arguments \ - "--config: :_files" \ - "--adapter: :_files" \ - -} -function __caddy_version { - -} - -_caddy