THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

chore(distribution): add rpm based packaging and system unit file (#1292)

tags/1.15.1^2
Boris Manojlovic Anthony Lapenna 2 years ago
parent
commit
c9ccdaaea4
2 changed files with 113 additions and 0 deletions
  1. +17
    -0
      distribution/portainer.service
  2. +96
    -0
      distribution/portainer.spec

+ 17
- 0
distribution/portainer.service View File

@@ -0,0 +1,17 @@
[Unit]
Description=Portainer.io management ui
After=docker.service
Wants=docker.service
Wants=docker-latest.service

[Service]
Type=simple
Restart=always
RestartSec=3
Environment=ASSETS=/usr/share/portainer
Environment=DBFILES=/var/lib/portainer
EnvironmentFile=-/etc/sysconfig/%p
ExecStart=/usr/sbin/portainer -a $ASSETS -d $DBFILES

[Install]
WantedBy=multi-user.target

+ 96
- 0
distribution/portainer.spec View File

@@ -0,0 +1,96 @@
Name: portainer
Version: 1.15.0
Release: 0
License: Zlib
Summary: A lightweight docker management UI
Url: https://portainer.io
Group: BLAH
Source0: https://github.com/portainer/portainer/releases/download/%{version}/portainer-%{version}-linux-amd64.tar.gz
Source1: portainer.service
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version}
BuildRequires: help2man
%endif
Requires: docker
%{?systemd_requires}
BuildRequires: systemd

%description
Portainer is a lightweight management UI which allows you to easily manage
your different Docker environments (Docker hosts or Swarm clusters).
Portainer is meant to be as simple to deploy as it is to use.
It consists of a single container that can run on any Docker engine
(can be deployed as Linux container or a Windows native container).
Portainer allows you to manage your Docker containers, images, volumes,
networks and more ! It is compatible with the standalone Docker engine and with Docker Swarm mode.

%prep
%setup -qn portainer

%build
%if 0%{?suse_version}
help2man -N --no-discard-stderr ./portainer > portainer.1
%endif

%install
# Create directory structure
install -D -m 0755 portainer %{buildroot}%{_sbindir}/portainer
install -d -m 0755 %{buildroot}%{_datadir}/portainer
install -d -m 0755 %{buildroot}%{_localstatedir}/lib/portainer
install -D -m 0644 %{S:1} %{buildroot}%{_unitdir}/portainer.service
%if 0%{?suse_version}
install -D -m 0644 portainer.1 %{buildroot}%{_mandir}/man1/portainer.1
( cd %{buildroot}%{_sbindir} ; ln -s service rcportainer )
%endif
# populate
# don't install docker binary with package use system wide installed one
for src in css fonts ico images index.html js;do
cp -a $src %{buildroot}%{_datadir}/portainer/
done

%pre
%if 0%{?suse_version}
%service_add_pre portainer.service
#%%else # this does not work on rhel 7?
#%%systemd_pre portainer.service
true
%endif

%preun
%if 0%{?suse_version}
%service_del_preun portainer.service
%else
%systemd_preun portainer.service
%endif

%post
%if 0%{?suse_version}
%service_add_post portainer.service
%else
%systemd_post portainer.service
%endif

%postun
%if 0%{?suse_version}
%service_del_postun portainer.service
%else
%systemd_postun_with_restart portainer.service
%endif


%files
%defattr(-,root,root)
%{_sbindir}/portainer
%dir %{_datadir}/portainer
%{_datadir}/portainer/css
%{_datadir}/portainer/fonts
%{_datadir}/portainer/ico
%{_datadir}/portainer/images
%{_datadir}/portainer/index.html
%{_datadir}/portainer/js
%dir %{_localstatedir}/lib/portainer/
%{_unitdir}/portainer.service
%if 0%{?suse_version}
%{_mandir}/man1/portainer.1*
%{_sbindir}/rcportainer
%endif

Loading…
Cancel
Save