Files
turborepo-remote-cache/turborepo-remote-cache.spec
T
zpericic 846611952a Container respects PORT from config.env
Drop the PORT=3000 override from the quadlet so the container listens
on PORT from config.env like the native service, and publish
127.0.0.1:3128:3128. Move PublishPort into a %config(noreplace) quadlet
drop-in, /etc/containers/systemd/turborepo-remote-cache.container.d/
publish-port.conf, so hosts can change the host binding without an
untracked override. Document in config.env that the container
overrides HOST and that the listen address belongs in PublishPort.
2026-10-29 17:07:56 +01:00

207 lines
7.3 KiB
RPMSpec

%global npm_name turborepo-remote-cache
%global __brp_mangle_shebangs_exclude_from ^%{nodejs_sitelib}/%{npm_name}/.*$
# Build the native Node.js -service subpackage by default.
# Disable when building in a network-less environment (e.g. stock mock):
# rpmbuild -bb --without service turborepo-remote-cache.spec
# mock --without=service ...
# The base and -container subpackages never need network.
%bcond_without service
Name: turborepo-remote-cache
Version: 2.14.1
Release: 2%{?dist}
Summary: Self-hosted Turborepo remote cache server
License: MIT
Group: Development/Tools
URL: https://github.com/ducktors/turborepo-remote-cache
Source0: %{url}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source10: %{name}.sysusers
Source11: %{name}.service
Source12: %{name}.container
Source13: config.env
Source14: publish-port.conf
BuildArch: noarch
BuildRequires: systemd-rpm-macros
%if %{with service}
BuildRequires: nodejs-devel
BuildRequires: nodejs-npm
BuildRequires: pnpm
%endif
%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.
%if %{with service}
%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 built into this
package. Listens on 127.0.0.1:3128 by default.
%endif
%package container
Summary: Turborepo Remote Cache as a Podman quadlet
Requires: %{name} = %{version}-%{release}
Requires: podman
Requires: containers-common
%if %{with service}
Conflicts: %{name}-service
%endif
%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}
%build
%if %{with service}
# Pull all deps (dev + prod) so tsc is available. Network required.
pnpm install --frozen-lockfile --ignore-scripts
# Compile TypeScript directly (bypass upstream `pnpm build` which also
# runs lint — lint is a dev-time check we don't care about at package build).
pnpm exec tsc -p ./tsconfig.json
# Drop dev dependencies before shipping.
pnpm prune --prod --ignore-scripts
%endif
%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}
%if %{with service}
# -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
%endif
# -container: quadlet
install -p -D -m 644 %{SOURCE12} \
%{buildroot}%{_datadir}/containers/systemd/%{name}.container
install -p -D -m 644 %{SOURCE14} \
%{buildroot}%{_sysconfdir}/containers/systemd/%{name}.container.d/publish-port.conf
%pre
%sysusers_create_package %{name} %{SOURCE10}
%if %{with service}
%post service
%systemd_post %{name}.service
%preun service
%systemd_preun %{name}.service
%postun service
%systemd_postun_with_restart %{name}.service
%endif
%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}
%if %{with service}
%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}
%endif
%files container
%defattr(-,root,root,-)
%{_datadir}/containers/systemd/%{name}.container
%dir %{_sysconfdir}/containers/systemd/%{name}.container.d
%config(noreplace) %{_sysconfdir}/containers/systemd/%{name}.container.d/publish-port.conf
%changelog
* Thu Oct 29 2026 Zoran Pericic <zpericic@netst.org> - 2.14.1-2
- Container respects PORT from config.env: drop the PORT=3000 override
and publish 127.0.0.1:3128:3128
- Move PublishPort to a %%config(noreplace) quadlet drop-in at
/etc/containers/systemd/turborepo-remote-cache.container.d/publish-port.conf
* Thu Oct 01 2026 Zoran Pericic <zpericic@netst.org> - 2.14.1-1
- Update to 2.14.1
- Storage backend failures surface as 5xx instead of cache miss;
Azure download failures no longer hang (2.11.6-2.11.7)
- Path traversal fix, CDN read URL support (2.12.0)
- fastify 5.12.1, Lambda request size limit fix (2.12.1-2.12.3)
- JWT team/roles claim checks, alternative scope claim name
(2.13.0-2.14.0)
- Stream artifact uploads to storage instead of buffering in memory,
publish atomically via temporary key (2.14.1)
* Sun Aug 02 2026 Zoran Pericic <zpericic@netst.org> - 2.11.5-2
- Set STORAGE_PATH_USE_TMP_FOLDER=false in config.env and quadlet:
upstream joins STORAGE_PATH onto os.tmpdir() by default (even for
absolute paths), so artifacts were written to ephemeral /tmp instead
of /var/cache/turborepo-remote-cache and lost on restart
- Add :U to the quadlet volume so the host cache dir is chowned to the
container's app user
* Sun Aug 02 2026 Zoran Pericic <zpericic@netst.org> - 2.11.5-1
- Update to 2.11.5
- Adds local cache cleanup endpoint (2.9.0) and read-only mode (2.10.0)
- Forwards non-500 upstream status codes, improved JWT auth error
logging (2.11.0-2.11.1)
- Security dependency overrides: fast-xml-parser, uuid, fast-uri,
picomatch, shell-quote (2.11.2, 2.11.5)
- Azure Blob upload fix, POSIX separators for artifact keys
(2.11.3-2.11.4)
* 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)
- -service build pulls deps online with pnpm; disable with
--without service when network is unavailable
- Dynamic sysusers turbo-cache user
- Listens on 127.0.0.1:3128; storage at /var/cache/turborepo-remote-cache