Compare commits

...

2 Commits

Author SHA1 Message Date
CanbiZ (MickLesk) b8295a3613 add otp key 2026-04-27 10:48:09 +02:00
CanbiZ (MickLesk) 3a356b3165 fix(dawarich): run db:migrate before assets:precompile
In Rails production, eager loading during assets:precompile can execute
DB queries. Dawarich 1.7.0 adds new tables (monthly digest email
preferences, S3 storage settings). Running precompile before migrate
causes 'Operation not permitted' / exit code 1 when those tables do
not exist yet.

Reordered to: db:migrate -> assets:precompile -> data:migrate,
which is the correct Rails deployment sequence.

Fixes #14048
2026-04-27 08:52:19 +02:00
2 changed files with 7 additions and 1 deletions
+5 -1
View File
@@ -53,6 +53,10 @@ function update_script() {
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)" eval "$(/root/.rbenv/bin/rbenv init - bash)"
if ! grep -q "OTP_ENCRYPTION_PRIMARY_KEY" /opt/dawarich/.env; then
echo "OTP_ENCRYPTION_PRIMARY_KEY=$(openssl rand -hex 32)" >>/opt/dawarich/.env
fi
set -a && source /opt/dawarich/.env && set +a set -a && source /opt/dawarich/.env && set +a
$STD bundle config set --local deployment 'true' $STD bundle config set --local deployment 'true'
@@ -67,8 +71,8 @@ function update_script() {
$STD npm install $STD npm install
fi fi
$STD bundle exec rake assets:precompile
$STD bundle exec rails db:migrate $STD bundle exec rails db:migrate
$STD bundle exec rake assets:precompile
$STD bundle exec rake data:migrate $STD bundle exec rake data:migrate
msg_ok "Ran Migrations" msg_ok "Ran Migrations"
+2
View File
@@ -46,10 +46,12 @@ msg_ok "Set up Directories"
msg_info "Configuring Environment" msg_info "Configuring Environment"
SECRET_KEY_BASE=$(openssl rand -hex 64) SECRET_KEY_BASE=$(openssl rand -hex 64)
OTP_ENCRYPTION_PRIMARY_KEY=$(openssl rand -hex 32)
RELEASE=$(get_latest_github_release "Freika/dawarich") RELEASE=$(get_latest_github_release "Freika/dawarich")
cat <<EOF >/opt/dawarich/.env cat <<EOF >/opt/dawarich/.env
RAILS_ENV=production RAILS_ENV=production
SECRET_KEY_BASE=${SECRET_KEY_BASE} SECRET_KEY_BASE=${SECRET_KEY_BASE}
OTP_ENCRYPTION_PRIMARY_KEY=${OTP_ENCRYPTION_PRIMARY_KEY}
DATABASE_HOST=localhost DATABASE_HOST=localhost
DATABASE_USERNAME=${PG_DB_USER} DATABASE_USERNAME=${PG_DB_USER}
DATABASE_PASSWORD=${PG_DB_PASS} DATABASE_PASSWORD=${PG_DB_PASS}