Skip to content

Commit

Permalink
nixos/librenms: fix optimizations and view cache on new installations (
Browse files Browse the repository at this point in the history
  • Loading branch information
NetaliDev authored Dec 27, 2024
2 parents c39ee68 + b4e9af0 commit 0922100
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions nixos/modules/services/monitoring/librenms.nix
Original file line number Diff line number Diff line change
Expand Up @@ -603,15 +603,10 @@ in
''
)
+ ''
# clear cache after update and regenerate optimizations
# clear cache after update (before migrations)
OLD_VERSION=$(cat ${cfg.dataDir}/version)
if [[ $OLD_VERSION != "${package.version}" ]]; then
rm -r ${cfg.dataDir}/cache/*
${artisanWrapper}/bin/librenms-artisan view:clear
${artisanWrapper}/bin/librenms-artisan optimize:clear
${artisanWrapper}/bin/librenms-artisan view:cache
${artisanWrapper}/bin/librenms-artisan optimize
echo "${package.version}" > ${cfg.dataDir}/version
fi
# convert rrd files when the oneMinutePolling option is changed
Expand All @@ -623,6 +618,15 @@ in
# migrate db
${artisanWrapper}/bin/librenms-artisan migrate --force --no-interaction
# regenerate cache after migrations after update
if [[ $OLD_VERSION != "${package.version}" ]]; then
${artisanWrapper}/bin/librenms-artisan view:clear
${artisanWrapper}/bin/librenms-artisan optimize:clear
${artisanWrapper}/bin/librenms-artisan view:cache
${artisanWrapper}/bin/librenms-artisan optimize
echo "${package.version}" > ${cfg.dataDir}/version
fi
'';
};

Expand Down

0 comments on commit 0922100

Please sign in to comment.