carlgeorge / caddy

Description

Caddy is the HTTP/2 web server with automatic HTTPS.

https://caddyserver.com

Installation Instructions

Caddy web server with all dns provider extensions enabled.

default Caddyfile:

:80 {
    gzip
    root /usr/share/caddy
}

caddy.service:

[Unit]
Description=Caddy HTTP/2 web server
Documentation=https://caddyserver.com/docs
After=network.target

[Service]
User=caddy
Group=caddy
Environment=CADDYPATH=/var/lib/caddy
EnvironmentFile=-/etc/caddy/Envfile
ExecStart=/usr/bin/caddy -log stdout -agree -conf /etc/caddy/Caddyfile -root /tmp
ExecReload=/usr/bin/kill -USR1 $MAINPID
LimitNOFILE=1048576
LimitNPROC=64
PrivateTmp=true
PrivateDevices=true
ProtectHome=true
ProtectSystem=strict
ReadWriteDirectories=/var/lib/caddy
AmbientCapabilities=CAP_NET_BIND_SERVICE

[Install]
WantedBy=multi-user.target

caddy.spec:

%bcond_without bundling

%if 0%{?with_debug}
%global _dwz_low_mem_die_limit 0
%else
%global debug_package   %{nil}
%endif

%global provider        github
%global provider_tld    com
%global project         mholt
%global repo            caddy
# https://github.com/mholt/caddy
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path     %{provider_prefix}

Name: caddy
Version: 0.10.3
Release: 1%{?dist}
Summary: HTTP/2 web server with automatic HTTPS
License: ASL 2.0
URL: https://caddyserver.com
Source0: https://%{provider_prefix}/archive/v%{version}/%{repo}-%{version}.tar.gz
Source1: https://caddyserver.com/resources/images/brand/caddy-at-your-service-white.svg
Source2: index.html
Source3: caddy.service
Source4: caddy.tmpfiles
Source5: Caddyfile
Patch0: enable-dnsproviders.patch
ExclusiveArch: %{go_arches}
BuildRequires: golang >= 1.8
%if %{with bundling}
BuildRequires: git
%else
BuildRequires: golang(gopkg.in/yaml.v2)
BuildRequires: golang(gopkg.in/natefinch/lumberjack.v2)
BuildRequires: golang(github.com/dustin/go-humanize)
BuildRequires: golang(github.com/hashicorp/go-syslog)
BuildRequires: golang(github.com/flynn/go-shlex)
BuildRequires: golang(golang.org/x/crypto/ocsp)
BuildRequires: golang(github.com/naoina/toml)
BuildRequires: golang(golang.org/x/net/http2)
BuildRequires: golang(github.com/xenolf/lego/acme)
BuildRequires: golang(github.com/lucas-clemente/quic-go/h2quic)
BuildRequires: golang(github.com/jimstudt/http-authentication/basic)
BuildRequires: golang(github.com/gorilla/websocket)
BuildRequires: golang(github.com/russross/blackfriday)
BuildRequires: golang(github.com/caddyserver/dnsproviders)
%endif
BuildRequires: systemd
Requires(post): systemd 
Requires(preun): systemd 
Requires(postun): systemd


%description
Caddy is the HTTP/2 web server with automatic HTTPS.


%prep
%autosetup -p1


%build
mkdir -p src/%{provider}.%{provider_tld}/%{project}
ln -s ../../.. src/%{import_path}
export GOPATH=$(pwd):%{gopath}
%{?with_bundling:go get -v -d ./src/%{import_path}/...}
go build -v -o bin/caddy -ldflags "-X %{import_path}/caddy/caddymain.gitTag=v%{version}" %{import_path}/caddy


%install
install -D -m 0755 bin/caddy %{buildroot}%{_bindir}/caddy
install -D -m 0644 %{S:1} %{buildroot}%{_datadir}/caddy/caddy-at-your-service-white.svg
install -D -m 0644 %{S:2} %{buildroot}%{_datadir}/caddy/index.html
install -D -m 0644 %{S:3} %{buildroot}%{_unitdir}/caddy.service
install -D -m 0644 %{S:4} %{buildroot}%{_tmpfilesdir}/caddy.conf
install -D -m 0644 %{S:5} %{buildroot}%{_sysconfdir}/caddy/Caddyfile


%pre
getent group caddy &> /dev/null || \
groupadd -r caddy &> /dev/null
getent passwd caddy  &> /dev/null || \
useradd -r -g caddy -d %{_sharedstatedir}/caddy -s /sbin/nologin -c 'Caddy web server' caddy &> /dev/null
exit 0


%post
%systemd_post caddy.service


%preun
%systemd_preun caddy.service


%postun
%systemd_postun_with_restart caddy.service


%files
%license LICENSE.txt
%doc README.md
%{_bindir}/caddy
%{_datadir}/caddy
%{_unitdir}/caddy.service
%{_tmpfilesdir}/caddy.conf
%dir %{_sysconfdir}/caddy
%config(noreplace) %{_sysconfdir}/caddy/Caddyfile


%changelog
* Fri May 19 2017 Carl George <carl.george@rackspace.com> - 0.10.3-1
- Latest upstream

* Mon May 15 2017 Carl George <carl.george@rackspace.com> - 0.10.2-1
- Initial package

Active Releases

The following unofficial repositories are provided as-is by owner of this project. Contact the owner directly for bugs or issues (IE: not bugzilla).

Release Architectures Repo Download
Fedora 26 x86_64 (1)* Fedora 26 (0 downloads)
Fedora rawhide x86_64 (3)* Fedora rawhide (0 downloads)

* Total number of packages downloaded in the last seven days.