add next branch for caddy v2

This commit is contained in:
Christian Rebischke 2020-05-15 23:49:26 +00:00
parent 30153ea58f
commit a4ae059ffc
7 changed files with 468 additions and 0 deletions

61
next/PKGBUILD Normal file
View File

@ -0,0 +1,61 @@
# Maintainer : Christian Rebischke <chris.rebischke@archlinux.org>
pkgname=caddy
pkgver=2.0.0
pkgrel=1
pkgdesc="Powerful, enterprise-ready, open source web server with automatic HTTPS written in Go"
arch=('x86_64')
url="https://github.com/caddyserver/caddy"
license=('Apache')
depends=('glibc')
makedepends=('go-pie' 'git')
backup=('etc/caddy/caddy.conf')
source=("git+https://github.com/caddyserver/caddy#tag=v${pkgver}?signed"
'index.html'
'caddy.service'
'caddy-api.service'
'caddy.tmpfiles'
'caddy.sysusers'
'caddy.conf')
sha512sums=('SKIP'
'2abccd41f770daebf61285dc017249f20c707877ea3c870f4a2375bbbd2bf481a8652d1fd3c7afd7d6b5c54838e9d8474a33e2c9790ef67dcf9d79c4e52953b4'
'41e88f85972c5680c919b556f3f163e7908f5a6226b9c38bde0d7cfb32c62e2975fadaaa07534109c29dcdeceb5b696169dccaf8a1c132d578a327c6cf97b76d'
'9e990237a75618a727b68b849be6d88e000a97d0059512abfc030fc89dce2ddd94d9d1b41a374cb71c0feffa8e39c8d405385273d2c0961fb901640609d46a85'
'997e6e72bd02355f1139e2875eb190ed9e6fa8c1e72cea7824df764d1264e0925aeccb354cd939c1bf0c0803820a6f3d6c571fb89ce18491b9f4b196c3f5de06'
'c893d88fec89e37da6596030c8dce7103e7e575371e8542a24d2a0741e877358d85219f2d8ade9d6aa0f515efe1156a4badd9fef5f65f553a5b0c72330c4728f'
'399c177475e299bf5736dba1a9d045477072594390b73c7dd2e13e12785abe029d48e480aee98216f7a8735addd353ce4a07b56ed14364f641b138e4fca0ebcd')
validpgpkeys=(
'29D0817A67156E4F25DC24782A349DD577D586A5' # Matthew Holt <mholt@users.noreply.github.com>
)
pkgver() {
cd ${pkgname}
git describe --tags --match 'v*' | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
prepare() {
sed 's|/var/www/html|/srv/http|g' -i "${srcdir}/index.html"
sed 's|/etc/caddy/Caddyfile|/etc/caddy/caddy.conf|g' -i "${srcdir}/index.html"
}
build() {
cd "${pkgname}/cmd/caddy/"
go build -trimpath -ldflags "-extldflags ${LDFLAGS}" -o caddy
}
check() {
cd "${pkgname}"
go test ./...
}
package() {
cd "${pkgname}"
install -Dm755 "cmd/caddy/${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
install -Dm 644 "${srcdir}/caddy.service" -t "${pkgdir}/usr/lib/systemd/system"
install -Dm 644 "${srcdir}/caddy-api.service" -t "${pkgdir}/usr/lib/systemd/system"
install -Dm 644 "${srcdir}/caddy.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/caddy.conf"
install -Dm 644 "${srcdir}/caddy.sysusers" "${pkgdir}/usr/lib/sysusers.d/caddy.conf"
install -Dm 644 "${srcdir}/caddy.conf" "${pkgdir}/etc/caddy/caddy.conf"
install -Dm 644 "${srcdir}/index.html" "${pkgdir}/usr/share/caddy/index.html"
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

50
next/caddy-api.service Normal file
View File

@ -0,0 +1,50 @@
# caddy-api.service
#
# For using Caddy with its API.
#
# This unit is "durable" in that it will automatically resume
# the last active configuration if the service is restarted.
#
# See https://caddyserver.com/docs/install for instructions.
[Unit]
Description=Caddy API Server
Documentation=https://caddyserver.com/docs/
After=network-online.target
Wants=network-online.target systemd-networkd-wait-online.service
StartLimitIntervalSec=14400
StartLimitBurst=10
[Service]
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --resume
# Do not allow the process to be restarted in a tight loop. If the
# process fails to start, something critical needs to be fixed.
Restart=on-abnormal
# Use graceful shutdown with a reasonable timeout
KillMode=mixed
KillSignal=SIGQUIT
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=strict
ProtectKernelModules=true
NoNewPrivileges=true
LockPersonality=true
ProtectKernelTunables=true
ProtectHome=true
ReadWritePaths=/var/lib/caddy /var/log/caddy
PrivateDevices=true
ProtectControlGroups=true
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target

28
next/caddy.conf Normal file
View File

@ -0,0 +1,28 @@
# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# 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
# domain name.
:80
# Set this path to your site's directory.
root * /usr/share/caddy
# Enable the static file server.
file_server
# Import additional caddy config files in /etc/caddy/conf.d/
import /etc/caddy/conf.d/*
# 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
# Refer to the Caddy docs for more information:
# https://github.com/caddyserver/caddy/wiki/v2:-Documentation

57
next/caddy.service Normal file
View File

@ -0,0 +1,57 @@
# caddy.service
#
# For using Caddy with a config file.
#
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
#
# See https://caddyserver.com/docs/install for instructions.
#
# WARNING: This service does not use the --resume flag, so if you
# use the API to make changes, they will be overwritten by the
# Caddyfile next time the service is restarted. If you intend to
# use Caddy's API to configure it, add the --resume flag to the
# `caddy run` command or use the caddy-api.service file instead.
[Unit]
Description=Caddy webserver
Documentation=https://caddyserver.com/docs/
After=network-online.target
Wants=network-online.target systemd-networkd-wait-online.service
StartLimitIntervalSec=14400
StartLimitBurst=10
[Service]
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --adapter caddyfile --environ --config /etc/caddy/caddy.conf
ExecReload=/usr/bin/caddy reload --adapter caddyfile --config /etc/caddy/caddy.conf
# Do not allow the process to be restarted in a tight loop. If the
# process fails to start, something critical needs to be fixed.
Restart=on-abnormal
# Use graceful shutdown with a reasonable timeout
KillMode=mixed
KillSignal=SIGQUIT
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=strict
ProtectKernelModules=true
NoNewPrivileges=true
LockPersonality=true
ProtectKernelTunables=true
ProtectHome=true
ReadWritePaths=/var/lib/caddy /var/log/caddy
PrivateDevices=true
ProtectControlGroups=true
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target

1
next/caddy.sysusers Normal file
View File

@ -0,0 +1 @@
u caddy - "caddy daemon" /var/lib/caddy

2
next/caddy.tmpfiles Normal file
View File

@ -0,0 +1,2 @@
d /var/lib/caddy 0750 caddy caddy
d /var/log/caddy 0750 caddy caddy

269
next/index.html Normal file

File diff suppressed because one or more lines are too long