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

Fix: GS_SSH_PORT can be changed now via 'gravity-sync config <NEW_PORT>' when already set in gravity-sync.conf. Fix: Initial sync of static DHCP and CNAME to 'empty pihole' now works. Enhancement: Various settings now settable via ENV vars (for Docker) #384

Merged
merged 8 commits into from
May 18, 2023

Conversation

systemofapwne
Copy link
Contributor

This PR contains several changes and fixes.

Fix:: GS_SSH_PORT can be changed now via gravity-sync config <NEW_PORT> when already set in gravity-sync.conf.
When a custom SSH port has been once set earlier and written to gravity-sync.conf, using gravity-sync config <NEW_PORT> had no effect on the new port: The old port remained until manually changed in gravity-sync.conf. This is now fixed.

Fix: Initial sync of static DHCP and CNAME to 'empty pihole' now works.
This fixes #377 by simply using "sudo touch " on the files it want to sync on the remote end.

Enhancement: Various settings now settable via ENV vars (for Docker)
Almost all config variables in gravity-sync rely on default-values set in the gravity-sync script itself, that then can be overwritten by the gravity-sync.conf file (if present). This is in principle absolutely fine but makes using Docker and docker-compose more demanding, since the easiest "docker-way" of setting config parameters is via ENVs.
The modifications now respect ENVs set by a container for various settings. If an ENV for a setting does not exist, the default value as stated in the gravity-sync script will be used. Finally, a gravity-sync.conf file still has highest priority over the settings value.

…ty-sync.conf (if set) when calling 'gravity-sync config NEW_SSH_PORT'. Docker enhancements: Made many config-variables settable via ENV vars
@systemofapwne
Copy link
Contributor Author

Short additional information: I require these changes in order to supply a Docker image, that bundles pihole with gravity sync with most flexibility in terms of configuration.
In the past few days, I integrated all required components for gs-sync ontop of the official pihole image and just since a few minutes, everything works so well, that I have a working Dockerfile+config for pihole-with-gravity-sync.

Regarding that pihole-with-gravity-sync Docker image I am working on: I think, it would also make sense, to supply that image officially from here.

  • Yes, this is in principle against the unix & docker philosophy (one "program"/"container", that does one job very well)
  • Yes, I have seen, you created a rudimentary Dockerfile, that at least runs gravity-sync. But that container looks stale.
  • Yes, I am aware about the gravity-sync-docker project (https://github.com/nh-mike/gravity-sync-docker), that currently seems to be outdated (Update to 4.0.4 nh-mike/gravity-sync-docker#9)
  • Overall, having gravity-sync directly integrated in the Docker container, that runs pihole makes most sense to me: Those who ran the official pihole container before now just need to switch to the pihole-with-gravity-sync container in order to link all their piholes together. No need for an additional container, permission fixing etc.

If you have any ideas for or against this idea, please elaborate. I really would like to proceed soon and if your opinion regarding that pihole-with-gravity-sync container "to rule them all" is against your philosophy for this awesome project, I will just create a new github project for that.

@vmstan vmstan merged commit d77d9bb into vmstan:4.0.5 May 18, 2023
vmstan added a commit that referenced this pull request Jul 10, 2023
* Simple fix for podman to work; whitespace clean up (#396)

* Fix set_pihole_exec to match full container names (#390)

Fix set_pihole_exec to match full container names, rather
than their substrings, by adding begin and end anchors to
the 'docker ps -qf name=PATTERN' being used.

Signed-off-by: William Blew <william@kulian.org>

* Fix the detect_xxx_pihole routines. (#389)

Fix the detect_xxx_pihole routines to respect the configurable
PIHOLE_CONTAINER_IMAGE variable.

The ghcr.io/pi-hole/pihole image is also released by the Pi-hole
project, just as the pihole/pihole image.

This commit enables ghcr.io image usage by adding the following
to the /etc/gravity-sync.conf file:

PIHOLE_CONTAINER_IMAGE='ghcr.io/pi-hole/pihole'

Signed-off-by: William Blew <william@kulian.org>
Co-authored-by: Michael Stanclift <mx@vmstan.com>

* Make check for sudo privileges more accurate (#375)

* Make check for sudo privileges more accurate

The existing method of checking if the Gravity Sync user has sudo rights is flawed, in that it will break if the user is not in the `sudo` group (on Debian based distros) or the `wheel` group (on CentOS/RHEL distros).

A more accurate way of checking if a user has sudo privileges is using `sudo --validate` or `sudo -n true`; both of which return `0` if the user has sudo privileges.

This commit updates the `validate_sudo_status` function to use `sudo --validate` so that Gravity Sync is actually checking if a user has sudo privileges, rather than just checking group memberships.

* Fix bug in patch

---------

Co-authored-by: llamalump <29816026+llamalump@users.noreply.github.com>

* Fix: GS_SSH_PORT can be changed now via  'gravity-sync config <NEW_PORT>' when already set in gravity-sync.conf. Fix: Initial sync of static DHCP and CNAME to 'empty pihole' now works. Enhancement: Various settings now settable via ENV vars (for Docker) (#384)

* SSH custom port: Fixed bug, where GS_SSH_PORT is overwritten by gravity-sync.conf (if set) when calling 'gravity-sync config NEW_SSH_PORT'. Docker enhancements: Made many config-variables settable via ENV vars

* Fixing initial push of CNAME and Static DHCP entries to an 'empty' remote (fixes #377)

* Removing unecessary 'export' keyword

* Fixed 'md5_recheck' for the bug #377

* Adding ENV documentation

* Fixing typo

* Fixed type and nicely formatted tables with emacs

---------

Co-authored-by: Michael Stanclift <mx@vmstan.com>

* Update VERSION

* Update gravity-sync

---------

Signed-off-by: William Blew <william@kulian.org>
Co-authored-by: Matt Woodson <mwoodson@gmail.com>
Co-authored-by: William Blew <william@kulian.org>
Co-authored-by: Seb Thomson <29816026+rst-ack@users.noreply.github.com>
Co-authored-by: llamalump <29816026+llamalump@users.noreply.github.com>
Co-authored-by: Klaus Zipfel <30482165+systemofapwne@users.noreply.github.com>
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.

CNAME initial sync
3 participants