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
43 lines
1.2 KiB
Bash
Executable File
43 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# Fetch upstream source tarball and vendor production node_modules.
|
|
#
|
|
# Produces two files next to the spec:
|
|
# turborepo-remote-cache-<VERSION>.tar.gz (upstream src)
|
|
# turborepo-remote-cache-<VERSION>-node_modules_prod.tar.gz
|
|
#
|
|
# Requires: curl, tar, pnpm, node
|
|
#
|
|
# Run this before `rpmbuild` whenever VERSION changes.
|
|
|
|
set -euo pipefail
|
|
|
|
VERSION="${1:-2.8.2}"
|
|
PKG="turborepo-remote-cache"
|
|
UPSTREAM="https://github.com/ducktors/${PKG}"
|
|
|
|
SPEC_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
WORK="$(mktemp -d)"
|
|
trap 'rm -rf "$WORK"' EXIT
|
|
|
|
SRC_TARBALL="${PKG}-${VERSION}.tar.gz"
|
|
DEPS_TARBALL="${PKG}-${VERSION}-node_modules_prod.tar.gz"
|
|
|
|
echo ">>> Fetching ${UPSTREAM}/archive/refs/tags/v${VERSION}.tar.gz"
|
|
curl -fsSL -o "${SPEC_DIR}/${SRC_TARBALL}" \
|
|
"${UPSTREAM}/archive/refs/tags/v${VERSION}.tar.gz"
|
|
|
|
echo ">>> Extracting source to ${WORK}"
|
|
tar -C "${WORK}" -xzf "${SPEC_DIR}/${SRC_TARBALL}"
|
|
cd "${WORK}/${PKG}-${VERSION}"
|
|
|
|
echo ">>> Installing production dependencies with pnpm"
|
|
pnpm install --prod --frozen-lockfile --ignore-scripts
|
|
|
|
echo ">>> Packing node_modules into ${DEPS_TARBALL}"
|
|
tar -czf "${SPEC_DIR}/${DEPS_TARBALL}" node_modules
|
|
|
|
echo
|
|
echo "Done:"
|
|
echo " ${SPEC_DIR}/${SRC_TARBALL}"
|
|
echo " ${SPEC_DIR}/${DEPS_TARBALL}"
|