File orchestrator.spec of Package orchestrator
#
# spec file for package orchestrator
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define services %{name}.service
%define homedir /var/lib/orchestrator/
%define configdir /etc/orchestrator
Name: orchestrator
Version: 3.2.6
Release: 0
Summary: A MySQL high availability and replication management tool
License: Apache-2.0
Url: https://github.com/openark/orchestrator/
Source: https://github.com/openark/orchestrator/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: vendor.tar.xz
Source2: series
Source3: orchestrator-user.conf
Patch1: fix-unit-file.patch
BuildRequires: golang-packaging
BuildRequires: golang(API)
BuildRequires: rsync
BuildRequires: pkgconfig(systemd)
BuildRequires: sysuser-shadow
BuildRequires: sysuser-tools
%{?systemd_ordering}
%{go_nostrip}
%{?sysusers_requires}
%description
A MySQL high availability and replication management tool, runs as a service and provides command line access, HTTP API and Web interface.
%prep
%autosetup -p1 -a1
%build
go build -mod=vendor -buildmode=pie -ldflags "-X main.AppVersion=%{version} -X main.BuildDescribe=%{version}" -o orchestrator ./go/cmd/orchestrator/main.go
./orchestrator -version
%sysusers_generate_pre %{SOURCE3} %{name} orchestrator-user.conf
%install
install -D -d -m 0755 %{buildroot}%{_prefix}/lib/orchestrator/
install -m 0755 orchestrator %{buildroot}%{_prefix}/lib/orchestrator/
rsync -av resources/ %{buildroot}%{_prefix}/lib/orchestrator/resources/
install -D -m 0644 etc/systemd/orchestrator.service %{buildroot}%{_unitdir}/orchestrator.service
install -D -m 0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/orchestrator-user.conf
install -D -d -m 0751 %{buildroot}%{homedir} %{buildroot}%{configdir}
install -m 0640 /dev/null %{buildroot}%{configdir}/config.json
%pre -f %{name}.pre
%service_add_pre %{services}
%post
%fillup_only -n orchestrator
%service_add_post %{services}
%preun
%service_del_preun %{services}
%postun
%service_del_postun %{services}
%files
%license LICENSE
%doc README.md
%doc conf/
%{_prefix}/lib/orchestrator/
%{_unitdir}/orchestrator.service
%{_sysusersdir}/orchestrator-user.conf
%config(noreplace) %attr(-,root,orchestrator) %{configdir}/
%dir %attr(-,orchestrator,orchestrator) %{homedir}/
%if %{with full_docs}
%files docs
%doc docs/*
%endif
%changelog