You’ve been asked to keep dependencies current across the fleet. The team installs the GitHub App, points it at one repo, and the first wave of onboarding PRs lands. Six months later, no one knows whether updates are still flowing because the daily run is silent on success, the bot has wide write access to every repo it was installed on, the App private key was pasted into a Slack DM, npm rate limits trigger every Sunday morning, and the team has started ignoring Renovate PRs because most are stale by the time a human looks.
What’s happening
A self-hosted Renovate that is actually production-ready needs more than the GitHub App default. Renovate runs under a dedicated unprivileged user with its own PAT stored in a root-owned env file, not in shell history; a systemd timer fires on a deterministic schedule so runs correlate with downstream failures; a central renovate-config repo holds the org-wide renovate.json and per-repo overrides — committing config per-repo is how policy drifts; the bot’s egress reaches only the registries it needs; Node.js is a recent LTS, not whatever the distro ships; logs are retained at least 30 days because “did Renovate skip a CVE?” gets asked a quarter late; and the schedule respects working hours. The bot is cheap to run but it touches every repo — its blast radius is the merge button.
How to verify
The Renovate timer should be active and the last run recent and clean:
systemctl list-timers renovate.timer
# renovate.timer Mon 2026-05-18 06:00:00 EDT ...
journalctl -u renovate.service --since '24 hours ago' --no-pager | tail -50
A dry-run for a single repo reports what it would do without opening PRs:
sudo -u renovate -i bash -lc \
'RENOVATE_DRY_RUN=full RENOVATE_LOG_LEVEL=debug renovate yourorg/somerepo'
The bot’s identity on the Git host should be a real service account, not a person:
curl -fsS -H "Authorization: token $RENOVATE_TOKEN" https://api.github.com/user | jq .login
# renovate-bot
If the token belongs to a person, the audit trail is wrong — fix that before next run.
The fix
Save the script below as /root/setup-renovate-ubuntu22.sh, then run it. It runs on a fresh Ubuntu 22.04 VM: apt update, unattended-upgrades, sysctl/FD tuning, SSH hardening, Node.js 20 LTS from NodeSource, a dedicated renovate user with home /var/lib/renovate, a clone of a configurable renovate-config repo, a root-owned /etc/renovate/renovate.env for the PAT, the renovate CLI installed globally via npm, a systemd service + timer with LimitNOFILE=64000, and a config-parse smoke test that exits non-zero on failure.
#!/usr/bin/env bash
set -euo pipefail
### Ubuntu 22.04 self-hosted Renovate Bot installer
### Node.js 20 LTS + global renovate CLI
### Dedicated renovate user, systemd timer
### Config sourced from a renovate-config Git repo
### Keeps root SSH key login enabled
### Disables SSH password login
### No local backups; assumes VM-level backup of /var/lib/renovate and /etc/renovate
if [[ "$(id -u)" -ne 0 ]]; then
echo "Run as root."
exit 1
fi
: "${RENOVATE_PLATFORM:?Set RENOVATE_PLATFORM to: github | gitea}"
: "${RENOVATE_ENDPOINT:?Set RENOVATE_ENDPOINT (e.g. https://api.github.com or https://git.example.com/api/v1)}"
: "${RENOVATE_TOKEN:?Set RENOVATE_TOKEN (PAT for the renovate-bot account)}"
: "${RENOVATE_CONFIG_REPO:?Set RENOVATE_CONFIG_REPO (e.g. https://git.example.com/ops/renovate-config.git)}"
: "${RENOVATE_AUTODISCOVER_FILTER:?Set RENOVATE_AUTODISCOVER_FILTER (e.g. yourorg/* or *)}"
RENOVATE_USER="renovate"
RENOVATE_HOME="/var/lib/renovate"
RENOVATE_CACHE="/var/cache/renovate"
RENOVATE_CONFIG_DIR="/etc/renovate"
RENOVATE_SCHEDULE="${RENOVATE_SCHEDULE:-*-*-* 06,12,18:00:00}"
echo
echo "========================================"
echo "Self-hosted Renovate Ubuntu 22.04 Setup"
echo "Platform: ${RENOVATE_PLATFORM}"
echo "Endpoint: ${RENOVATE_ENDPOINT}"
echo "Schedule: ${RENOVATE_SCHEDULE}"
echo "========================================"
echo
export DEBIAN_FRONTEND=noninteractive
echo "==> Updating base OS"
apt-get update
apt-get -y upgrade
apt-get -y install \
ca-certificates curl gnupg lsb-release \
vim chrony fail2ban unattended-upgrades \
iproute2 lsof tcpdump dnsutils tar gzip unzip jq git
echo "==> Enabling time sync"
systemctl enable --now chrony
timedatectl set-ntp true
echo "==> Applying sysctl tuning"
cat > /etc/sysctl.d/99-renovate.conf <<'SYSCTL'
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
net.core.somaxconn = 4096
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_syncookies = 1
net.ipv4.ip_local_port_range = 10240 65535
kernel.dmesg_restrict = 1
kernel.kptr_restrict = 2
fs.file-max = 2097152
SYSCTL
modprobe tcp_bbr || true
echo tcp_bbr > /etc/modules-load.d/bbr.conf
sysctl --system
echo "==> Setting file limits"
cat > /etc/security/limits.d/99-renovate.conf <<'LIMITS'
* soft nofile 64000
* hard nofile 64000
root soft nofile 64000
root hard nofile 64000
LIMITS
echo "==> Hardening SSH"
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak.$(date +%F-%H%M%S)
set_sshd_option() {
local key="$1"
local value="$2"
if grep -qE "^[#[:space:]]*${key}[[:space:]]+" /etc/ssh/sshd_config; then
sed -i "s|^[#[:space:]]*${key}[[:space:]].*|${key} ${value}|" /etc/ssh/sshd_config
else
echo "${key} ${value}" >> /etc/ssh/sshd_config
fi
}
set_sshd_option PermitRootLogin prohibit-password
set_sshd_option PasswordAuthentication no
set_sshd_option PubkeyAuthentication yes
set_sshd_option KbdInteractiveAuthentication no
set_sshd_option X11Forwarding no
set_sshd_option ClientAliveInterval 300
set_sshd_option ClientAliveCountMax 2
set_sshd_option MaxAuthTries 4
sshd -t
systemctl restart ssh
echo "==> Configuring fail2ban"
mkdir -p /etc/fail2ban/jail.d
cat > /etc/fail2ban/jail.d/sshd.local <<'FAIL2BAN'
[sshd]
enabled = true
port = ssh
backend = systemd
maxretry = 4
findtime = 10m
bantime = 1h
FAIL2BAN
systemctl enable --now fail2ban
echo "==> Enabling unattended-upgrades for security"
cat > /etc/apt/apt.conf.d/20auto-upgrades <<'AUTOUPG'
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
APT::Periodic::AutocleanInterval "7";
AUTOUPG
echo "==> Installing Node.js 20 LTS from NodeSource"
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | \
gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" \
> /etc/apt/sources.list.d/nodesource.list
apt-get update
apt-get -y install nodejs
echo "==> Creating renovate system user"
getent passwd "${RENOVATE_USER}" >/dev/null || \
useradd --system --create-home --home-dir "${RENOVATE_HOME}" --shell /bin/bash "${RENOVATE_USER}"
install -d -o "${RENOVATE_USER}" -g "${RENOVATE_USER}" -m 0750 "${RENOVATE_HOME}"
install -d -o "${RENOVATE_USER}" -g "${RENOVATE_USER}" -m 0750 "${RENOVATE_CACHE}"
install -d -o root -g "${RENOVATE_USER}" -m 0750 "${RENOVATE_CONFIG_DIR}"
echo "==> Installing Renovate CLI globally"
npm install -g renovate
echo "==> Cloning org-wide renovate-config repo"
sudo -u "${RENOVATE_USER}" -H git clone --depth 1 "${RENOVATE_CONFIG_REPO}" \
"${RENOVATE_CONFIG_DIR}/config" || \
( cd "${RENOVATE_CONFIG_DIR}/config" && sudo -u "${RENOVATE_USER}" git pull --ff-only )
if [[ ! -f "${RENOVATE_CONFIG_DIR}/config/config.js" && ! -f "${RENOVATE_CONFIG_DIR}/config/config.json" ]]; then
echo "==> No config.js or config.json found; seeding a minimal config.js"
cat > "${RENOVATE_CONFIG_DIR}/config/config.js" <<'CFG'
module.exports = {
platform: process.env.RENOVATE_PLATFORM,
endpoint: process.env.RENOVATE_ENDPOINT,
autodiscover: true,
autodiscoverFilter: (process.env.RENOVATE_AUTODISCOVER_FILTER || '*').split(','),
onboarding: true,
onboardingConfig: {
extends: ['config:recommended', ':semanticCommits'],
},
prHourlyLimit: 4,
prConcurrentLimit: 10,
branchConcurrentLimit: 20,
schedule: ['after 6am and before 6pm every weekday'],
timezone: 'America/Toronto',
labels: ['dependencies'],
dependencyDashboard: true,
logFileLevel: 'info',
};
CFG
chown -R "${RENOVATE_USER}:${RENOVATE_USER}" "${RENOVATE_CONFIG_DIR}/config"
fi
echo "==> Writing /etc/renovate/renovate.env (tokens, root-only)"
cat > "${RENOVATE_CONFIG_DIR}/renovate.env" <<ENV
RENOVATE_PLATFORM=${RENOVATE_PLATFORM}
RENOVATE_ENDPOINT=${RENOVATE_ENDPOINT}
RENOVATE_TOKEN=${RENOVATE_TOKEN}
RENOVATE_AUTODISCOVER_FILTER=${RENOVATE_AUTODISCOVER_FILTER}
RENOVATE_CONFIG_FILE=${RENOVATE_CONFIG_DIR}/config/config.js
RENOVATE_BASE_DIR=${RENOVATE_CACHE}
RENOVATE_CACHE_DIR=${RENOVATE_CACHE}/cache
RENOVATE_LOG_FILE=${RENOVATE_HOME}/log/renovate-%DATE%.log
RENOVATE_LOG_FILE_LEVEL=info
RENOVATE_PERSIST_REPO_DATA=true
NODE_OPTIONS=--max-old-space-size=2048
ENV
chmod 640 "${RENOVATE_CONFIG_DIR}/renovate.env"
chown root:"${RENOVATE_USER}" "${RENOVATE_CONFIG_DIR}/renovate.env"
install -d -o "${RENOVATE_USER}" -g "${RENOVATE_USER}" -m 0750 "${RENOVATE_HOME}/log"
echo "==> Installing systemd service and timer"
cat > /etc/systemd/system/renovate.service <<'UNIT'
[Unit]
Description=Self-hosted Renovate Bot run
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
User=renovate
Group=renovate
EnvironmentFile=/etc/renovate/renovate.env
ExecStart=/usr/bin/renovate
WorkingDirectory=/var/lib/renovate
LimitNOFILE=64000
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=full
ProtectHome=read-only
TimeoutStartSec=2h
Nice=10
UNIT
cat > /etc/systemd/system/renovate.timer <<TIMER
[Unit]
Description=Run Renovate Bot on a schedule
[Timer]
OnCalendar=${RENOVATE_SCHEDULE}
RandomizedDelaySec=5m
Persistent=true
Unit=renovate.service
[Install]
WantedBy=timers.target
TIMER
systemctl daemon-reload
systemctl enable renovate.timer
echo "==> Validating config (dry-run)"
set +e
sudo -u "${RENOVATE_USER}" -H \
env $(grep -v '^#' "${RENOVATE_CONFIG_DIR}/renovate.env" | xargs) \
RENOVATE_DRY_RUN=full RENOVATE_LOG_LEVEL=info \
renovate --print-config >/dev/null
DR=$?
set -e
if [[ $DR -ne 0 ]]; then
echo "Renovate config did not parse cleanly. Fix ${RENOVATE_CONFIG_DIR}/config before enabling the timer."
exit 1
fi
systemctl start renovate.timer
echo "==> Adding logrotate for Renovate logs (30-day retention)"
cat > /etc/logrotate.d/renovate <<'LOGROT'
/var/lib/renovate/log/*.log {
daily
rotate 30
compress
delaycompress
missingok
notifempty
copytruncate
su renovate renovate
}
LOGROT
echo
echo "========================================"
echo "DONE"
echo "========================================"
echo
echo "Kernel:"
uname -r
echo
echo "Services:"
systemctl is-active renovate.timer chrony fail2ban || true
systemctl list-timers renovate.timer --no-pager || true
echo
echo "Renovate version:"
sudo -u "${RENOVATE_USER}" -i renovate --version
echo
echo "Config:"
ls -l "${RENOVATE_CONFIG_DIR}/config/" || true
echo
echo "Token file (root:renovate, 0640):"
ls -l "${RENOVATE_CONFIG_DIR}/renovate.env"
echo
echo "First on-demand run:"
echo " systemctl start renovate.service"
echo " journalctl -u renovate.service -f"
echo
echo "Edit config in Git and pull:"
echo " sudo -u ${RENOVATE_USER} -H git -C ${RENOVATE_CONFIG_DIR}/config pull"
Make it executable and run it:
chmod 700 /root/setup-renovate-ubuntu22.sh
RENOVATE_PLATFORM=gitea \
RENOVATE_ENDPOINT=https://git.example.com/api/v1 \
RENOVATE_TOKEN=... \
RENOVATE_CONFIG_REPO=https://git.example.com/ops/renovate-config.git \
RENOVATE_AUTODISCOVER_FILTER='yourorg/*' \
/root/setup-renovate-ubuntu22.sh
The first manual run with systemctl start renovate.service opens onboarding PRs on every repo the filter matches; merging them is when a repo starts receiving updates. Keep the org-wide config.js in renovate-config behind branch protection — changes there change behaviour everywhere. Host-level backups are out of scope: /var/lib/renovate and /etc/renovate are the stateful paths, with VM snapshot assumed at the cloud layer.
Renovate is one piece of the deploy-pipeline surface — when it lives next to your CI, your registry and your GitOps controller on a Stack Harbor-managed environment, the audit story for “are we patched?” gets short: Deployment management →.