Skip to content
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

Run gravity update on the primary #53

Open
mentalsoup opened this issue Oct 6, 2022 · 7 comments
Open

Run gravity update on the primary #53

mentalsoup opened this issue Oct 6, 2022 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@mentalsoup
Copy link

What feature would you like added?

With the upcoming feature completion on issue #28 I noticed that while the targets received and successfully processed a gravity update, the primary did not. Would it be possible to run a gravity update on the primary as either a pre sync step or post sync completion?

Version

1.2.2-beta.0

Log output

No response

@PromoFaux
Copy link

I think the assumption here is that you will already have run gravity on your primary Pi-hole instance after adding new lists, no need to automate this.

Thinking out loud, and maybe this would be a seperate issue @mattwebbio, however I wonder if it might not be better to have an option to only run gravity on the remote if it is detected that a list was added or removed. I've not yet dug into the internals of this project, so it might be more complex than meets the eye.

My thinking is: Pi-hole already runs gravity on a schedule once a week, which to be honest is more than enough. The only time that gravity should need to be run manually is after a change to the lists being used on the instance - or it a list maintainer resolves an issue with their list. Other than that, list contents don't change all that often - so running gravity every INTERVAL_MINUTES may just be overkill :)

@mattwebbio
Copy link
Owner

@PromoFaux

if it might not be better to have an option to only run gravity on the remote if it is detected that a list was added or removed

Taking this a step further, I would love to only perform a sync when changes are detected on the primary (as opposed to blindly uploading backups to the secondaries at the interval).

Right now, Orbital doesn't know anything about the state of the PiHoles it's syncing or the contents of the backups. If that problem were solved (though I'm not sure what the best approach to this would be), it would be much easier to control "when" things happen. I don't have much time to investigate this unfortunately, but ideas and PRs are definitely welcome 🙂

@PromoFaux
Copy link

Only things I can think of off the top of my head right now:

  • Take a teleporter backup from both the primary and secondary, extract them, and then compare the file contents.
  • Keep the previous teleporter backup from the primary in memory/file somewhere, and use that to compare against the newer backup - if there are no changes - no need to restore to secondary. If there are changes, is it just black/whitelist items? If so, just sync and do nothing. If there are adlist changes, then sync and also do gravity run.

In an ideal world, we would get off our arses and design some sort of HA functionality into Pi-hole directly - but it's finding the time! Never say never, though.

@JvdMaat
Copy link

JvdMaat commented Jan 31, 2023

Yeah, please do not do a gravity update on the primary. I have two piholes. Primary is in docker, the backup is on a Pi Zero W. (low power, cause it's just backup DNS and serves only about 25% of all queries). But the gravity update kills the Zero W, and the orbital sync was failing (timeout on gravity update). So I switched the orbital sync config around so the Pi Zero W is the "primary", and syncs changes to the docker container without issues.
Doesn't pihole automatically do a regular gravity update? As PromoFaux said, if you update the adlist, you should do your own manual gravity update.

And also seconding the only do a gravity update if there was a change. But that would require retaining the backup, unzipping it, inspecting it, etc. So that's quite a bit of work.

And extrapolating on that, if you keep backups of both primary and secondary (and tertiary, etc), you can theoretically make a change on any of the piholes, and it will sync out to the others. No need for primary or secondary. They're all equal.

@mattwebbio mattwebbio added the enhancement New feature or request label Mar 22, 2024
@ForsakenRei
Copy link

@PromoFaux

if it might not be better to have an option to only run gravity on the remote if it is detected that a list was added or removed

Taking this a step further, I would love to only perform a sync when changes are detected on the primary (as opposed to blindly uploading backups to the secondaries at the interval).

Right now, Orbital doesn't know anything about the state of the PiHoles it's syncing or the contents of the backups. If that problem were solved (though I'm not sure what the best approach to this would be), it would be much easier to control "when" things happen. I don't have much time to investigate this unfortunately, but ideas and PRs are definitely welcome 🙂

With that said, can we have some kind of environment variable to disable the gravity update on the secondary PiHole? I'm not really making changes to the adlist that often so the random schedule update PiHole has is more than enough, update gravity every time is kinda overkill.

@mobilemike
Copy link

With that said, can we have some kind of environment variable to disable the gravity update on the secondary PiHole?

See https://github.com/mattwebbio/orbital-sync/blob/master/src/config/schema.ts#L275-L288

I added UPDATE_GRAVITY: false to my compose and it's working as expected.

@ForsakenRei
Copy link

With that said, can we have some kind of environment variable to disable the gravity update on the secondary PiHole?

See https://github.com/mattwebbio/orbital-sync/blob/master/src/config/schema.ts#L275-L288

I added UPDATE_GRAVITY: false to my compose and it's working as expected.

Thank you! I will give it a try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants