-
Notifications
You must be signed in to change notification settings - Fork 63
/
shifter.spec
265 lines (221 loc) · 9.07 KB
/
shifter.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
%{!?_shifter_sysconfdir: %{expand:%%global _shifter_sysconfdir %{_sysconfdir}/shifter}}
%define _sysconfdir %_shifter_sysconfdir
%if 0%{!?_without_shifter_user:1}
%{expand:%%global shifter_user %{?shifter_user}%{!?shifter_user:shifter}}
%{expand:%%global shifter_group %{?shifter_group}%{!?shifter_group:%{shifter_user}}}
%{expand:%%global shifter_uid %{?shifter_uid}%{!?shifter_uid:50}}
%{expand:%%global shifter_gid %{?shifter_gid}%{!?shifter_gid:%{shifter_uid}}}
%endif
%if 0%{!?_without_systemd:1}
%{!?_unitdir: %global _without_systemd --without-systemd}
%{!?systemd_requires: %global _without_systemd --without-systemd}
%endif
%{!?shifter_release: %global shifter_release 1.nersc%{?dist}}
%{?_with_slurm: %global with_slurm %{_prefix}}
Summary: NERSC Shifter -- Containers for HPC
Name: shifter
Version: 22.02.1
Release: 20220218
License: BSD (LBNL-modified)
Group: System Environment/Base
URL: https://github.com/NERSC/shifter
Packager: Douglas Jacobsen <[email protected]>
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%description
Shifter enables container images for HPC. In a nutshell, Shifter
allows an HPC system to efficiently and safely permit end-users to run
jobs inside a Docker image. Shifter consists of a few moving parts:
1) a utility that typically runs on the compute node that creates the
runtime environment for the application,
2) an image gateway service that pulls images from a registry and
repacks them in a format suitable for the HPC system (typically
squashfs), and
3) example scripts/plugins to integrate Shifter with various batch
scheduler systems.
This package contains no files; to install the core components of
Shifter, please install the "shifter-runtime" package.
%package runtime
Summary: Runtime component(s) for NERSC Shifter (formerly udiRoot)
Group: System Environment/Base
%if 0%{?suse_version}
BuildRequires: munge, libcurl-devel, libjson-c-devel, pam-devel, libcap-devel python3
%else
BuildRequires: munge-devel, gcc, gcc-c++
BuildRequires: libtool autoconf automake
BuildRequires: libcurl libcurl-devel
BuildRequires: json-c json-c-devel
BuildRequires: pam-devel
BuildRequires: libcap-devel
BuildRequires: python3
Requires: xfsprogs
%endif
%description runtime
Shifter enables container images for HPC. In a nutshell, Shifter
allows an HPC system to efficiently and safely permit end-users to run
jobs inside a Docker image. Shifter consists of a few moving parts:
1) a utility that typically runs on the compute node that creates the
runtime environment for the application,
2) an image gateway service that pulls images from a registry and
repacks them in a format suitable for the HPC system (typically
squashfs), and
3) example scripts/plugins to integrate Shifter with various batch
scheduler systems.
This package contains the runtime and user interface components of
Shifter.
%package imagegw
Summary: Image Manager/Gateway for Shifter
%if 0%{!?_without_systemd:1}
%{systemd_requires}
%endif
%if 0%{?rhel}
Requires(pre): shadow-utils
Requires: squashfs-tools python3 python36-pymongo munge
%endif
%if 0%{?suse_version} > 0
Requires: squashfs python3 munge shifter-python
%endif
%description imagegw
Shifter enables container images for HPC. In a nutshell, Shifter
allows an HPC system to efficiently and safely permit end-users to run
jobs inside a Docker image. Shifter consists of a few moving parts:
1) a utility that typically runs on the compute node that creates the
runtime environment for the application,
2) an image gateway service that pulls images from a registry and
repacks them in a format suitable for the HPC system (typically
squashfs), and
3) example scripts/plugins to integrate Shifter with various batch
scheduler systems.
This package contains the Image Gateway and image management tools for
use with Shifter.
%if 0%{?with_slurm:1}
%package slurm
Summary: Slurm Spank Module for Shifter
BuildRequires: slurm-devel
%description slurm
Shifter enables container images for HPC. In a nutshell, Shifter
allows an HPC system to efficiently and safely permit end-users to run
jobs inside a docker image. Shifter consists of a few moving parts:
1) a utility that typically runs on the compute node that creates the
runtime environment for the application,
2) an image gateway service that pulls images from a registry and
repacks them in a format suitable for the HPC system (typically
squashfs), and
3) example scripts/plugins to integrate Shifter with various batch
scheduler systems.
This package contains the Spank Plugin module which allows for the
integration of Shifter with the Slurm Workload Manager.
%endif
%package fasthash
Summary: fasthash utility to import images into shifter
%description fasthash
Shifter enables container images for HPC. In a nutshell, Shifter
allows an HPC system to efficiently and safely permit end-users to run
jobs inside a docker image. Shifter consists of a few moving parts:
1) a utility that typically runs on the compute node that creates the
runtime environment for the application,
2) an image gateway service that pulls images from a registry and
repacks them in a format suitable for the HPC system (typically
squashfs), and
3) example scripts/plugins to integrate Shifter with various batch
scheduler systems.
This package contains a utility needed to import images directly
into Shifter. This is not required to pull docker images and is
optional. In a remote configuration, this RPM should be installed on
the remote system.
%prep
%setup -q
test -x configure || ./autogen.sh
%build
## build udiRoot (runtime) first
export PYTHON=python3
%configure \
%{?with_slurm:--with-slurm=%{with_slurm}} %{?acflags}
MAKEFLAGS=%{?_smp_mflags} %{__make}
%install
%make_install
# Yes, this is a bit of hack.
install -m 755 imagegw/shifter_imagegw/fasthash.py %{buildroot}/%{_bindir}/fasthash
# Create directory for ImageGW API logs
%{__mkdir_p} $RPM_BUILD_ROOT%{_localstatedir}/log/%{name}_imagegw
: > $RPM_BUILD_ROOT/%{_sysconfdir}/shifter_etc_files/passwd
: > $RPM_BUILD_ROOT/%{_sysconfdir}/shifter_etc_files/group
%if %{?with_slurm:1}0
rm -f $RPM_BUILD_ROOT/%{_libdir}/shifter/shifter_slurm.a
rm -f $RPM_BUILD_ROOT/%{_libdir}/shifter/shifter_slurm.la
%else
rm -f $RPM_BUILD_ROOT/%{_libdir}/shifter/shifter_slurm.a
rm -f $RPM_BUILD_ROOT/%{_libdir}/shifter/shifter_slurm.la
rm -f $RPM_BUILD_ROOT/%{_libdir}/shifter/shifter_slurm.so
rm -f $RPM_BUILD_ROOT/%{_libexecdir}/shifter/shifter_slurm_dws_support
%endif
%if 0%{!?_without_systemd:1}
%{__mkdir_p} $RPM_BUILD_ROOT%{_unitdir}
%if 0%{?suse_version} > 1230
%{__install} -m 0644 extra/systemd/shifter_imagegw_36.service $RPM_BUILD_ROOT%{_unitdir}/shifter_imagegw.service
%else
%{__install} -m 0644 extra/systemd/shifter_imagegw.service $RPM_BUILD_ROOT%{_unitdir}/
%endif
%endif
%check
%{__make} check
%if 0%{!?_without_shifter_user:1}
%pre imagegw
getent group %{shifter_group} >/dev/null || groupadd -f -g %{shifter_gid} -r %{shifter_group}
if ! getent passwd %{shifter_user} >/dev/null ; then
if ! getent passwd %{shifter_uid} >/dev/null ; then
useradd -r -u %{shifter_uid} -g %{shifter_group} -d %{_sysconfdir} -s /sbin/nologin -c "Shifter User" %{shifter_user}
else
useradd -r -g %{shifter_group} -d %{_sysconfdir} -s /sbin/nologin -c "Shifter User" %{shifter_user}
fi
fi
exit 0
%endif
%post runtime
getent passwd > %{_sysconfdir}/shifter_etc_files/passwd
getent group > %{_sysconfdir}/shifter_etc_files/group
%post imagegw
%files
%defattr(-, root, root)
%doc AUTHORS Dockerfile LICENSE NEWS README* doc extra/cle6
%files runtime
%defattr(-, root, root)
%doc AUTHORS LICENSE NEWS README* udiRoot.conf.example
%attr(4755, root, root) %{_bindir}/shifter
%config(noreplace missingok) %verify(not filedigest mtime size) %{_sysconfdir}/shifter_etc_files/passwd
%config(noreplace missingok) %verify(not filedigest mtime size) %{_sysconfdir}/shifter_etc_files/group
%config(noreplace) %{_sysconfdir}/shifter_etc_files/nsswitch.conf
%{_bindir}/shifterimg
%{_sbindir}/setupRoot
%{_sbindir}/unsetupRoot
%{_libexecdir}/shifter/mount
%{_libexecdir}/shifter/opt
%{_sysconfdir}/udiRoot.conf.example
%files imagegw
%defattr(-, root, root)
%doc AUTHORS LICENSE NEWS README* contrib extra/systemd
%attr(0770, %{shifter_user}, %{shifter_group}) %dir %{_localstatedir}/log/%{name}_imagegw/
%{_libdir}/python3.*/site-packages/shifter_imagegw
%{_libexecdir}/shifter/imagecli.py*
%{_libexecdir}/shifter/imagegwapi.py*
%{_libexecdir}/shifter/sitecustomize.py*
%{_datadir}/shifter/requirements.txt
%{_sysconfdir}/imagemanager.json.example
%if 0%{!?_without_systemd:1}
%{_unitdir}/shifter_imagegw*
%endif
%if 0%{?with_slurm:1}
%files slurm
%defattr(-, root, root)
%doc AUTHORS LICENSE NEWS README*
%{_libdir}/shifter/shifter_slurm.so
%{_libexecdir}/shifter/shifter_slurm_dws_support
%endif
%files fasthash
%defattr(-, root, root)
%{_bindir}/fasthash
%changelog
* Sun Jun 14 2020 Shane Canon <[email protected]> - 18.04.5
- Added support for external mode
* Sun Apr 24 2016 Douglas Jacobsen <[email protected]> - 16.04.0pre1-1
- Initial version of spec file