Files
turborepo-remote-cache/turborepo-remote-cache.spec
Zoran Peričić 583e9f497b Initial package: turborepo-remote-cache 2.8.2
Self-hosted Turborepo remote cache server packaged as a Fedora RPM
with the same base + -service + -container split used by the gitea
package.

- Base: dynamic sysusers turbo-cache user, /etc/turborepo-remote-cache
  config dir with config.env token template, /var/cache storage dir
- -service: native Node.js systemd unit, app installed to
  %{nodejs_sitelib}/turborepo-remote-cache with pnpm-vendored
  production node_modules (built via fetch-sources.sh)
- -container: Podman quadlet pinned to
  docker.io/ducktors/turborepo-remote-cache:2.8.2
- Listens on 127.0.0.1:3128; runners reach via host.containers.internal
2026-04-08 13:27:32 +02:00

143 lines
4.6 KiB
RPMSpec

%global npm_name turborepo-remote-cache
%global __brp_mangle_shebangs_exclude_from ^%{nodejs_sitelib}/%{npm_name}/.*$
Name: turborepo-remote-cache
Version: 2.8.2
Release: 1%{?dist}
Summary: Self-hosted Turborepo remote cache server
License: MIT
Group: Development/Tools
URL: https://github.com/ducktors/turborepo-remote-cache
# Fetch both with ./fetch-sources.sh <version> before rpmbuild
Source0: %{name}-%{version}.tar.gz
Source1: %{name}-%{version}-node_modules_prod.tar.gz
Source10: %{name}.sysusers
Source11: %{name}.service
Source12: %{name}.container
Source13: config.env
BuildArch: noarch
BuildRequires: systemd-rpm-macros
BuildRequires: nodejs-devel
BuildRequires: nodejs-npm
BuildRequires: pnpm
%description
Turborepo Remote Cache is a self-hosted implementation of the Vercel
Remote Cache API used by Turborepo and turbo-compatible build tools.
It lets CI runners share build artifacts without relying on Vercel's
hosted cache.
This base package ships the sysusers.d drop-in, the configuration
directory with a token template, and the cache storage directory.
Install either turborepo-remote-cache-service (native Node.js) or
turborepo-remote-cache-container (Podman quadlet) to actually run
the server.
%package service
Summary: Turborepo Remote Cache as a native Node.js systemd service
Requires: %{name} = %{version}-%{release}
Requires: nodejs >= 1:20
Conflicts: %{name}-container
%{?systemd_requires}
%description service
Runs turborepo-remote-cache as a native Node.js process under systemd,
using the pnpm-vendored production dependencies shipped with this
package. Listens on 127.0.0.1:3128 by default.
%package container
Summary: Turborepo Remote Cache as a Podman quadlet
Requires: %{name} = %{version}-%{release}
Requires: podman
Requires: containers-common
Conflicts: %{name}-service
%description container
Runs turborepo-remote-cache as a Podman container via quadlet,
pulling docker.io/ducktors/turborepo-remote-cache:%{version}.
Listens on 127.0.0.1:3128 by default; cache storage is bind-mounted
from /var/cache/turborepo-remote-cache on the host.
%prep
%setup -q -n %{name}-%{version}
# Drop the vendored node_modules from Source1 into the source tree
tar -xzf %{SOURCE1}
%build
# Compile TypeScript → dist/. node_modules is already vendored.
pnpm build
%install
%{__rm} -rf %{buildroot}
# Base: sysusers, config dir, cache dir
install -p -D -m 644 %{SOURCE10} %{buildroot}%{_sysusersdir}/%{name}.conf
install -d -m 750 %{buildroot}%{_sysconfdir}/%{name}
install -m 640 %{SOURCE13} %{buildroot}%{_sysconfdir}/%{name}/config.env
install -d -m 750 %{buildroot}%{_localstatedir}/cache/%{name}
# -service: install app tree to %{nodejs_sitelib}/turborepo-remote-cache
install -d -m 755 %{buildroot}%{nodejs_sitelib}/%{npm_name}
cp -pr dist node_modules package.json \
%{buildroot}%{nodejs_sitelib}/%{npm_name}/
# CLI symlink + shebang fix
install -d -m 755 %{buildroot}%{_bindir}
ln -s %{nodejs_sitelib}/%{npm_name}/dist/cli.js \
%{buildroot}%{_bindir}/%{name}
sed -i -e '1s|^#!.*node.*|#!/usr/bin/node|' \
%{buildroot}%{nodejs_sitelib}/%{npm_name}/dist/cli.js || :
chmod 755 %{buildroot}%{nodejs_sitelib}/%{npm_name}/dist/cli.js
# -service: systemd unit
install -p -D -m 644 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}.service
# -container: quadlet
install -p -D -m 644 %{SOURCE12} \
%{buildroot}%{_datadir}/containers/systemd/%{name}.container
%pre
%sysusers_create_package %{name} %{SOURCE10}
%post service
%systemd_post %{name}.service
%preun service
%systemd_preun %{name}.service
%postun service
%systemd_postun_with_restart %{name}.service
%files
%defattr(-,root,root,-)
%{_sysusersdir}/%{name}.conf
%dir %attr(0750,root,turbo-cache) %{_sysconfdir}/%{name}
%config(noreplace) %attr(0640,root,turbo-cache) %{_sysconfdir}/%{name}/config.env
%dir %attr(0750,turbo-cache,turbo-cache) %{_localstatedir}/cache/%{name}
%files service
%defattr(-,root,root,-)
%{_unitdir}/%{name}.service
%dir %{nodejs_sitelib}/%{npm_name}
%{nodejs_sitelib}/%{npm_name}/dist
%{nodejs_sitelib}/%{npm_name}/node_modules
%{nodejs_sitelib}/%{npm_name}/package.json
%{_bindir}/%{name}
%files container
%defattr(-,root,root,-)
%{_datadir}/containers/systemd/%{name}.container
%changelog
* Wed Apr 08 2026 Zoran Pericic <zpericic@netst.org> - 2.8.2-1
- Initial package for ducktors/turborepo-remote-cache 2.8.2
- Split into -service (native Node.js) and -container (Podman quadlet)
- Dynamic sysusers turbo-cache user
- Listens on 127.0.0.1:3128; storage at /var/cache/turborepo-remote-cache