[arch-commits] Commit in (8 files)
Levente Polyak
anthraxx at archlinux.org
Tue Dec 24 12:58:15 UTC 2019
Date: Tuesday, December 24, 2019 @ 12:58:14
Author: anthraxx
Revision: 539909
addpkg: caddy 1.0.4-2
Added:
caddy/
caddy/repos/
caddy/trunk/
caddy/trunk/Caddyfile
caddy/trunk/PKGBUILD
caddy/trunk/caddy.service
caddy/trunk/caddy.tmpfiles
caddy/trunk/plugins.go
----------------+
Caddyfile | 6 ++
PKGBUILD | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
caddy.service | 44 ++++++++++++++++
caddy.tmpfiles | 2
plugins.go | 61 ++++++++++++++++++++++
5 files changed, 263 insertions(+)
Added: caddy/trunk/Caddyfile
===================================================================
--- caddy/trunk/Caddyfile (rev 0)
+++ caddy/trunk/Caddyfile 2019-12-24 12:58:14 UTC (rev 539909)
@@ -0,0 +1,6 @@
+*:80 {
+ gzip
+ root /usr/share/caddy
+}
+
+import conf.d/*.conf
Added: caddy/trunk/PKGBUILD
===================================================================
--- caddy/trunk/PKGBUILD (rev 0)
+++ caddy/trunk/PKGBUILD 2019-12-24 12:58:14 UTC (rev 539909)
@@ -0,0 +1,150 @@
+# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
+# Contributor: Wei Congrui < crvv.mail at gmail dot com >
+# Contributor: Carl George < arch at cgtx dot us >
+# Contributor: Eric Engeström <eric at engestrom dot ch>
+# Contributor: Andreas Linz <klingt.net at gmail dot com>
+# Contributor: Akshay S Dinesh <asdofindia at gmail dot com>
+
+pkgname=caddy
+pkgver=1.0.4
+_gitcommit=aadda6e34e5b85b04670ecf3bb096dead3da61fc
+_distcommit=9e93bfd85c97d71ab842a4a4b555d358295c914e
+pkgrel=2
+pkgdesc='HTTP/2 Web Server with Automatic HTTPS'
+url='https://caddyserver.com'
+arch=('x86_64')
+license=('Apache')
+depends=('glibc')
+makedepends=('go-pie' 'git')
+backup=('etc/caddy/caddy.conf')
+source=("git+https://github.com/caddyserver/caddy#commit=${_gitcommit}?signed"
+ caddy-${_distcommit}-index.html::https://raw.githubusercontent.com/caddyserver/dist/${_distcommit}/welcome/index.html
+ caddy.service
+ caddy.tmpfiles
+ Caddyfile
+ plugins.go)
+sha256sums=('SKIP'
+ '7668022a48b0cbf459190f0bbfbfb32ae066449a95e006367cac9e1befa80c5f'
+ 'c14ac8681e0434caf2c68e4a18dc59f8796fdffe9039f2e3c799ca64d37aa1ea'
+ 'c8f002f5ba59985a643600dc3c871e18e110903aa945ef3f2da7c9edd39fbd7a'
+ 'fb998b6de7bfe58f65c62eab37a4885e70833d19902da089766ad627a5f5a305'
+ 'f5a0fbb961e7c9ecf99e88d0959a3164cbea54660c1c08c3ba3cdf1d45563929')
+validpgpkeys=(
+ 29D0817A67156E4F25DC24782A349DD577D586A5 # Matthew Holt <mholt at users.noreply.github.com>
+)
+
+pkgver() {
+ cd ${pkgname}
+ git describe --tags --match 'v*' | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
+}
+
+prepare() {
+ cd ${pkgname}/caddy
+ sed 's|/var/www/html|/srv/http|g' -i "${srcdir}/caddy-${_distcommit}-index.html"
+ sed 's|Version: "unknown"|Version: "v'${pkgver}'"|' -i caddymain/run.go
+
+ cat > main.go <<EOF
+package main
+
+import (
+ "github.com/caddyserver/caddy/caddy/caddymain"
+EOF
+ if [ ${#_plugins[@]} -gt 0 ]; then
+ echo "enabled plugins: ${_plugins[*]}"
+ go run "${srcdir}/plugins.go" "${_plugins[@]}" >> main.go
+ fi
+ cat >> main.go <<EOF
+)
+
+func main() {
+ caddymain.EnableTelemetry = false
+ caddymain.Run()
+}
+EOF
+}
+
+build() {
+ cd ${pkgname}/caddy
+ go build -v \
+ -trimpath \
+ -ldflags "-extldflags ${LDFLAGS}" \
+ .
+}
+
+package() {
+ cd ${pkgname}/caddy
+ install -Dm 755 caddy -t "${pkgdir}/usr/bin"
+ install -Dm 644 "${srcdir}/caddy.service" -t "${pkgdir}/usr/lib/systemd/system"
+ install -Dm 644 "${srcdir}/caddy.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/caddy.conf"
+ install -Dm 644 "${srcdir}/Caddyfile" "${pkgdir}/etc/caddy/caddy.conf"
+ install -Dm 644 "${srcdir}/caddy-${_distcommit}-index.html" "${pkgdir}/usr/share/caddy/index.html"
+ install -d "${pkgdir}/etc/caddy/conf.d"
+}
+
+_plugins=(
+# 'dns'
+# 'docker'
+# 'dyndns'
+# 'hook.service'
+# 'http.authz'
+# 'http.awses'
+# 'http.awslambda'
+# 'http.cache'
+# 'http.cgi'
+# 'http.cors'
+# 'http.datadog'
+# 'http.expires'
+# 'http.filter'
+# 'http.forwardproxy'
+# 'http.geoip'
+# 'http.git'
+# 'http.gopkg'
+# 'http.grpc'
+# 'http.ipfilter'
+# 'http.jwt'
+# 'http.locale'
+# 'http.login'
+# 'http.mailout'
+# 'http.minify'
+# 'http.nobots'
+# 'http.prometheus'
+# 'http.proxyprotocol'
+# 'http.ratelimit'
+# 'http.realip'
+# 'http.reauth'
+# 'http.restic'
+# 'http.s3browser'
+# 'http.supervisor'
+# 'http.webdav'
+# 'net'
+# 'supervisor'
+# 'tls.dns.auroradns'
+# 'tls.dns.azure'
+# 'tls.dns.cloudflare'
+# 'tls.dns.cloudxns'
+# 'tls.dns.digitalocean'
+# 'tls.dns.dnsimple'
+# 'tls.dns.dnsmadeeasy'
+# 'tls.dns.dnspod'
+# 'tls.dns.duckdns'
+# 'tls.dns.dyn'
+# 'tls.dns.exoscale'
+# 'tls.dns.gandi'
+# 'tls.dns.gandiv5'
+# 'tls.dns.godaddy'
+# 'tls.dns.googlecloud'
+# 'tls.dns.lightsail'
+# 'tls.dns.linode'
+# 'tls.dns.namecheap'
+# 'tls.dns.namedotcom'
+# 'tls.dns.ns1'
+# 'tls.dns.otc'
+# 'tls.dns.ovh'
+# 'tls.dns.powerdns'
+# 'tls.dns.rackspace'
+# 'tls.dns.rfc2136'
+# 'tls.dns.route53'
+# 'tls.dns.vultr'
+)
+
+# vim: ts=2 sw=2 et:
Added: caddy/trunk/caddy.service
===================================================================
--- caddy/trunk/caddy.service (rev 0)
+++ caddy/trunk/caddy.service 2019-12-24 12:58:14 UTC (rev 539909)
@@ -0,0 +1,44 @@
+[Unit]
+Description=Caddy HTTP/2 web 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=http
+Group=http
+Environment=CADDYPATH=/var/lib/caddy
+EnvironmentFile=-/etc/caddy/envfile
+ExecStart=/usr/bin/caddy -log stdout -agree -conf /etc/caddy/caddy.conf -root=/usr/share/caddy
+ExecReload=/usr/bin/kill -USR1 $MAINPID
+
+# 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
+
+# Hardening options
+PrivateTmp=true
+PrivateDevices=true
+ProtectHome=true
+ProtectSystem=strict
+ReadWritePaths=/var/lib/caddy /var/log/caddy
+CapabilityBoundingSet=CAP_NET_BIND_SERVICE
+AmbientCapabilities=CAP_NET_BIND_SERVICE
+NoNewPrivileges=true
+ProtectKernelTunables=true
+ProtectKernelModules=true
+ProtectControlGroups=true
+LockPersonality=true
+
+[Install]
+WantedBy=multi-user.target
Added: caddy/trunk/caddy.tmpfiles
===================================================================
--- caddy/trunk/caddy.tmpfiles (rev 0)
+++ caddy/trunk/caddy.tmpfiles 2019-12-24 12:58:14 UTC (rev 539909)
@@ -0,0 +1,2 @@
+d /var/lib/caddy 0750 http http
+d /var/log/caddy 0750 http http
Added: caddy/trunk/plugins.go
===================================================================
--- caddy/trunk/plugins.go (rev 0)
+++ caddy/trunk/plugins.go 2019-12-24 12:58:14 UTC (rev 539909)
@@ -0,0 +1,61 @@
+package main
+
+import (
+ "encoding/json"
+ "fmt"
+ "io/ioutil"
+ "log"
+ "net/http"
+ "os"
+ "sort"
+)
+
+const URL = "https://caddyserver.com/api/download-page"
+
+type Plugin struct {
+ Name string
+ ImportPath string
+}
+type PluginList struct {
+ Plugins []Plugin `json:"plugins"`
+}
+
+func getPlugins() []Plugin {
+ resp, err := http.Get(URL)
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer resp.Body.Close()
+ body, err := ioutil.ReadAll(resp.Body)
+ list := PluginList{}
+ err = json.Unmarshal(body, &list)
+ if err != nil {
+ log.Fatal(err)
+ }
+ return list.Plugins
+}
+func main() {
+ plugins := getPlugins()
+ sort.Slice(plugins, func(i, j int) bool {
+ return plugins[i].Name < plugins[j].Name
+ })
+ if len(os.Args) == 1 {
+ fmt.Println("plugins=(")
+ for _, plugin := range plugins {
+ fmt.Printf("# '%s'\n", plugin.Name)
+ }
+ fmt.Println(")")
+ return
+ }
+ pluginsMap := make(map[string]string)
+ for _, plugin := range plugins {
+ pluginsMap[plugin.Name] = plugin.ImportPath
+ }
+ for _, name := range os.Args[1:] {
+ path, ok := pluginsMap[name]
+ if !ok {
+ log.Fatalf("cannot find plugin %s\n", name)
+ }
+ fmt.Printf(`_ "%s"`+"\n", path)
+ }
+}
More information about the arch-commits
mailing list