fix: set HOME=/root for rbenv installs to prevent path mismatch

When running in certain LXC environments (e.g. systems with desktop
packages or non-en locales), the HOME variable may resolve to '/'
instead of '/root'. rbenv installs to $HOME/.rbenv, so if HOME is
wrong it ends up in /.rbenv while all service files and PATH exports
hardcode /root/.rbenv, causing 'env: ruby: No such file or directory'.

Explicitly set HOME=/root for all setup_ruby calls that run as root,
and replace all $HOME/.rbenv references in PATH exports and install
steps with /root/.rbenv literals.

Affected scripts:
- ct/sure.sh + install/sure-install.sh (fixes #14479)
- ct/dawarich.sh + install/dawarich-install.sh
- ct/docuseal.sh + install/docuseal-install.sh

Also add TimeoutStartSec=300 to sure.service so db:prepare on first
start does not get killed by the default 90s systemd timeout.
This commit is contained in:
MickLesk
2026-05-17 20:27:13 +02:00
parent 131a9d60f1
commit ebf755031b
6 changed files with 10 additions and 9 deletions

View File

@@ -45,12 +45,12 @@ function update_script() {
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "dawarich" "Freika/dawarich" "tarball" "latest" "/opt/dawarich/app"
RUBY_VERSION=$(cat /opt/dawarich/app/.ruby-version 2>/dev/null || echo "3.4.6")
RUBY_VERSION=${RUBY_VERSION} RUBY_INSTALL_RAILS="false" setup_ruby
RUBY_VERSION=${RUBY_VERSION} RUBY_INSTALL_RAILS="false" HOME=/root setup_ruby
msg_info "Running Migrations"
cd /opt/dawarich/app
source /root/.profile
export PATH="/root/.rbenv/shims:/root/.rbenv/bin:$PATH"
export PATH="/root/.rbenv/shims:/root/.rbenv/bin:${PATH}"
eval "$(/root/.rbenv/bin/rbenv init - bash)"
if ! grep -q "OTP_ENCRYPTION_PRIMARY_KEY" /opt/dawarich/.env; then

View File

@@ -48,7 +48,7 @@ function update_script() {
msg_info "Building Application"
cd /opt/docuseal
export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
export PATH="/root/.rbenv/bin:/root/.rbenv/shims:${PATH}"
eval "$(rbenv init - bash)" 2>/dev/null || true
export RAILS_ENV=production
export NODE_ENV=production

View File

@@ -64,7 +64,7 @@ EOF
fi
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "Sure" "we-promise/sure" "tarball" "latest" "/opt/sure"
RUBY_VERSION="$(cat /opt/sure/.ruby-version)" RUBY_INSTALL_RAILS=false setup_ruby
RUBY_VERSION="$(cat /opt/sure/.ruby-version)" RUBY_INSTALL_RAILS=false HOME=/root setup_ruby
msg_info "Updating Sure"
source ~/.profile

View File

@@ -72,12 +72,12 @@ msg_ok "Configured Environment"
NODE_VERSION="22" setup_nodejs
RUBY_VERSION=$(cat /opt/dawarich/app/.ruby-version 2>/dev/null || echo "3.4.6")
RUBY_VERSION=${RUBY_VERSION} RUBY_INSTALL_RAILS="false" setup_ruby
RUBY_VERSION=${RUBY_VERSION} RUBY_INSTALL_RAILS="false" HOME=/root setup_ruby
msg_info "Installing Dawarich"
cd /opt/dawarich/app
source /root/.profile
export PATH="/root/.rbenv/shims:/root/.rbenv/bin:$PATH"
export PATH="/root/.rbenv/shims:/root/.rbenv/bin:${PATH}"
eval "$(/root/.rbenv/bin/rbenv init - bash)"
set -a && source /opt/dawarich/.env && set +a
$STD gem install bundler

View File

@@ -31,7 +31,7 @@ $STD apt install -y \
msg_ok "Installed Dependencies"
NODE_VERSION="22" NODE_MODULE="yarn" setup_nodejs
RUBY_VERSION="4.0.1" RUBY_INSTALL_RAILS="false" setup_ruby
RUBY_VERSION="4.0.1" RUBY_INSTALL_RAILS="false" HOME=/root setup_ruby
PG_VERSION="17" setup_postgresql
PG_DB_NAME="docuseal" PG_DB_USER="docuseal" setup_postgresql_db
@@ -82,7 +82,7 @@ msg_ok "Configured DocuSeal"
msg_info "Building Application"
cd /opt/docuseal
export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
export PATH="/root/.rbenv/bin:/root/.rbenv/shims:${PATH}"
eval "$(rbenv init - bash)" 2>/dev/null || true
export RAILS_ENV=production
export NODE_ENV=production

View File

@@ -26,7 +26,7 @@ fetch_and_deploy_gh_release "Sure" "we-promise/sure" "tarball" "latest" "/opt/su
PG_VERSION="$(sed -n '/postgres:/s/[^[:digit:]]*//p' /opt/sure/compose.example.yml)" setup_postgresql
PG_DB_NAME=sure_production PG_DB_USER=sure_user setup_postgresql_db
RUBY_VERSION="$(cat /opt/sure/.ruby-version)" RUBY_INSTALL_RAILS=false setup_ruby
RUBY_VERSION="$(cat /opt/sure/.ruby-version)" RUBY_INSTALL_RAILS=false HOME=/root setup_ruby
msg_info "Building Sure"
cd /opt/sure
@@ -73,6 +73,7 @@ ExecStartPre=/opt/sure/bin/rails db:prepare
ExecStart=/opt/sure/bin/rails server
Restart=always
RestartSec=5
TimeoutStartSec=300
StandardOutput=journal
StandardError=journal