Skip to content

Added weekly VACUUM FULL maintenance with cron scheduling for database optimization #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Miggets7
Copy link
Contributor

No description provided.

@Miggets7 Miggets7 requested a review from richturner May 28, 2025 09:14
@richturner
Copy link
Member

Fixes openremote/openremote#1423

@Miggets7 Miggets7 requested a review from richturner June 25, 2025 12:58
@richturner
Copy link
Member

I ran the current commit locally and with OR_ENABLE_VACUUM_FULL=true I get the following:

Starting cron service for scheduled database maintenance (OR_ENABLE_VACUUM_FULL=true)...
 * Starting periodic command scheduler cron
cron: can't open or create /var/run/crond.pid: Permission denied
   ...fail!

Please confirm functionality locally both with existing storage volume and without.

Copy link
Member

@richturner richturner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to deal with the crond file permission issue I mentioned in the comments

Comment on lines +3 to +4
# Log file for vacuum operations
LOG_FILE="/var/lib/postgresql/vacuum_full.log"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log to standard out

Comment on lines +6 to +7
# Check if VACUUM FULL schedule is set
if [ -n "${OR_VACUUM_FULL_CRON_SCHEDULE}" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this outer if in the entrypoint for ease of reading

@richturner
Copy link
Member

Additional tasks:

  • Update README
  • Update docker compose files and deploy.yml in main repo
  • Enable this option on deployments where desired

@richturner richturner assigned richturner and Miggets7 and unassigned richturner and Miggets7 Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Postgresql table bloat occurs over time (autovacuum is insufficient)
2 participants