You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.9 KiB

%global goipath github.com/traefik/traefik/v2
Version: 2.3.6
%gometa
%global common_description %{expand: Traefik (pronounced traffic) is a modern
HTTP reverse proxy and load balancer that makes deploying microservices easy.
Traefik integrates with your existing infrastructure components (Docker,
Swarm mode, Kubernetes, Marathon, Consul, Etcd, Rancher, Amazon ECS, ...)
and configures itself automatically and dynamically. Pointing Traefik at your
orchestrator should be the only onfiguration step you need.}
Name: traefik
Release: itix4
Summary: The Cloud Native Application Proxy
License: MIT
ExclusiveArch: x86_64
URL: %{gourl}
# Temporary Fix for a probable transient issue. XXX: Still needed ?
# Source0: %{gosource}
Source0: https://github.com/traefik/traefik/archive/refs/tags/v2.3.6.tar.gz
Source1: traefik.service
Source2: traefik.yaml
Patch0: traefik-sni.patch
Requires(pre): shadow-utils
BuildRequires: systemd
BuildRequires: breezy
BuildRequires: golang >= 1.15
BuildRequires: git
BuildRequires: go-bindata
BuildRequires: nodejs
BuildRequires: npm
%description
%{common_description}
# Since we don't recompile from source, disable the build_id checking
%global _missing_build_ids_terminate_build 0
%global _build_id_links none
%global debug_package %{nil}
%prep
%setup -c
%goprep
%patch0 -p1
cp %{S:1} %{name}.service
cp %{S:2} %{name}.yaml
%build
(cd webui && npm install && npm run build:nc)
# Workaround for "GOVCS disallows using bzr for public XXX"
export GOVCS='private:all,public:all'
go generate
CGO_ENABLED=0 GO111MODULE=on go build -ldflags="-s -w -X 'github.com/traefik/traefik/v2/pkg/version.Version=%{version}' -X 'github.com/traefik/traefik/v2/pkg/version.Codename=ITIX' -X 'github.com/traefik/traefik/v2/pkg/version.BuildDate=$(date -Iseconds)'" -o %{gobuilddir}/traefik %{goipath}/cmd/traefik
%install
install -d %{buildroot}/opt/%{name}/etc/
install -d %{buildroot}/opt/%{name}/etc/conf.d
install -d %{buildroot}/srv/%{name}/
install -D %{gobuilddir}/traefik %{buildroot}/opt/traefik/bin/traefik
install -D -m 0644 %{name}.service %{buildroot}%{_unitdir}/%{name}.service
install -D -m 0644 %{name}.yaml %{buildroot}/opt/%{name}/etc/%{name}.yaml
touch %{buildroot}/opt/%{name}/etc/%{name}.env
%files
%defattr(0755, root, root, 0755)
/opt/%{name}/bin/traefik
%defattr(0644, root, root, 0755)
%dir /opt/%{name}/bin
%{_unitdir}/%{name}.service
%dir /opt/%{name}/etc
%dir /opt/%{name}/etc/conf.d
%config(noreplace) /opt/%{name}/etc/%{name}.yaml
%config(noreplace) /opt/%{name}/etc/%{name}.env
%defattr(0600, traefik, itix-svc, 0700)
%dir /srv/%{name}
%pre
getent group itix-svc >/dev/null || groupadd -r itix-svc
getent passwd %{name} >/dev/null || useradd -r -g itix-svc \
-d /srv/%{name} -s /sbin/nologin -c "The Cloud Native Application Proxy" \
%{name}
exit 0
%post
%systemd_post %{name}.service
%preun
%systemd_preun %{name}.service
%postun
%systemd_postun_with_restart %{name}.service
%changelog