Initial commit
This commit is contained in:
1
centrifugo/centrifugo.config.json
Normal file
1
centrifugo/centrifugo.config.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
7
centrifugo/centrifugo.logrotate
Normal file
7
centrifugo/centrifugo.logrotate
Normal file
@@ -0,0 +1,7 @@
|
||||
/var/log/centrifugo/*log {
|
||||
copytruncate
|
||||
daily
|
||||
rotate 7
|
||||
compress
|
||||
missingok
|
||||
}
|
||||
1
centrifugo/centrifugo.nofiles.conf
Normal file
1
centrifugo/centrifugo.nofiles.conf
Normal file
@@ -0,0 +1 @@
|
||||
centrifugo - nofile 65536
|
||||
27
centrifugo/centrifugo.service
Normal file
27
centrifugo/centrifugo.service
Normal file
@@ -0,0 +1,27 @@
|
||||
[Unit]
|
||||
Description=Centrifugo real-time messaging server
|
||||
Documentation=https://github.com/centrifugal/centrifugo
|
||||
# start once the network and logging subsystems available
|
||||
After=network.target syslog.target
|
||||
|
||||
[Service]
|
||||
User=centrifugo
|
||||
Group=centrifugo
|
||||
LimitNOFILE=65536
|
||||
Environment="CONFIG=/etc/centrifugo/config.json"
|
||||
EnvironmentFile=/etc/sysconfig/centrifugo
|
||||
ExecStartPre=/usr/sbin/centrifugo checkconfig -c $CONFIG
|
||||
ExecStart=/usr/sbin/centrifugo -c $CONFIG $CENTRIFUGO_OPTS
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
ExecStop=/bin/kill -SIGTERM $MAINPID
|
||||
TimeoutStopSec=10
|
||||
KillMode=control-group
|
||||
RestartSec=1
|
||||
Restart=on-failure
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
SyslogIdentifier=centrifugo
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Alias=centrifugo.service
|
||||
109
centrifugo/centrifugo.spec
Normal file
109
centrifugo/centrifugo.spec
Normal file
@@ -0,0 +1,109 @@
|
||||
Name: centrifugo
|
||||
Version: 2.2.2
|
||||
Release: 1%{?dist}
|
||||
Summary: Centrifugo is a real-time messaging server.
|
||||
License: MIT
|
||||
URL: https://github.com/centrifugal/centrifugo
|
||||
Group: Apps/sys
|
||||
|
||||
BuildRequires: ca-certificates
|
||||
# we have incomplete git 2.14.1 in c7 repo, so we have to pin previous version here
|
||||
BuildRequires: git-core
|
||||
BuildRequires: golang
|
||||
BuildRequires: mr-rpm-macros
|
||||
BuildRequires: systemd-devel
|
||||
BuildRequires: systemd-units
|
||||
|
||||
Source0: https://github.com/centrifugal/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
|
||||
Source1: %{name}.config.json
|
||||
Source2: %{name}.service
|
||||
Source3: %{name}.logrotate
|
||||
Source4: %{name}.nofiles.conf
|
||||
Source5: %{name}.sysconfig
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
|
||||
|
||||
# go stuff
|
||||
%define debug_package %{nil}
|
||||
%define _enable_debug_packages 0
|
||||
|
||||
%define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v %{?debug:-x} %{?**};
|
||||
%define import_path github.com/centrifugal/%{name}
|
||||
|
||||
|
||||
%description
|
||||
%{name} is a language-agnostic real-time messaging server. Language-agnostic
|
||||
means that it does not matter which programming language your application uses
|
||||
on frontend or backend sides – %{name} can work in conjunction with any.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -qc
|
||||
%{__install} -d src/$(dirname %{import_path})
|
||||
%{__mv} %{name}-%{version} src/%{import_path}
|
||||
cd src/%{import_path}
|
||||
|
||||
|
||||
%build
|
||||
export GOPATH=$(pwd)
|
||||
cd src/%{import_path}
|
||||
export PATH=$(pwd):$PATH
|
||||
go build
|
||||
|
||||
|
||||
%install
|
||||
%{__install} -Dpm 0755 src/%{import_path}/%{name} %{buildroot}%{_sbindir}/%{name}
|
||||
%{__install} -Dpm 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}/config.json
|
||||
%{__install} -Dpm 0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service
|
||||
%{__install} -Dpm 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
|
||||
%{__install} -Dpm 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/security/limits.d/%{name}.conf
|
||||
%{__install} -Dpm 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
|
||||
%{__mkdir_p} %{buildroot}%{_sharedstatedir}/%{name}
|
||||
%{__mkdir_p} %{buildroot}%{_localstatedir}/log/%{name}
|
||||
%_fixperms %{buildroot}/*
|
||||
|
||||
|
||||
%pre
|
||||
getent passwd %{name} > /dev/null || \
|
||||
useradd --system -U -M %{name} -s /bin/false -d %{_sharedstatedir}/%{name}
|
||||
|
||||
|
||||
%post
|
||||
echo "Executing systemd post-install tasks"
|
||||
%if 0%{?systemd_post:1}
|
||||
%systemd_post %{name}.service
|
||||
%else
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
%endif
|
||||
|
||||
|
||||
%preun
|
||||
echo "Executing systemd pre-uninstall tasks"
|
||||
%if 0%{?systemd_preun:1}
|
||||
%systemd_preun %{name}.service
|
||||
%else
|
||||
if [ $1 -eq 0 ] ; then
|
||||
# Package removal, not upgrade
|
||||
/bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || :
|
||||
/bin/systemctl stop %{name}.service > /dev/null 2>&1 || :
|
||||
fi
|
||||
%endif
|
||||
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%{_sbindir}/%{name}
|
||||
%config %{_sysconfdir}/%{name}/config.json
|
||||
%config %{_unitdir}/%{name}.service
|
||||
%config %{_sysconfdir}/logrotate.d/%{name}
|
||||
%config %{_sysconfdir}/security/limits.d/%{name}.conf
|
||||
%config %{_sysconfdir}/sysconfig/%{name}
|
||||
%dir %attr(0755, %{name}, %{name}) %{_localstatedir}/log/%{name}
|
||||
%doc src/github.com/centrifugal/centrifugo/README.md
|
||||
%doc src/github.com/centrifugal/centrifugo/CHANGELOG.md
|
||||
%doc src/github.com/centrifugal/centrifugo/LICENSE
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Jul 17 2019 Sergei Fedosov <s.fedosov@corp.mail.ru>
|
||||
- Initial version
|
||||
3
centrifugo/centrifugo.sysconfig
Normal file
3
centrifugo/centrifugo.sysconfig
Normal file
@@ -0,0 +1,3 @@
|
||||
# Additional command line args
|
||||
# see output of centrifugo --help for details
|
||||
CENTRIFUGO_OPTS="--log_file /var/log/centrifugo/centrifugo.log"
|
||||
Reference in New Issue
Block a user