vmstan / gravity-sync

💫 The easy way to synchronize the DNS configuration of two Pi-hole 5.x instances.
https://vmstan.com/gravity-sync/
GNU General Public License v3.0
2.3k stars 131 forks source link

Fails at "Pushing the local Gravity Database". (Pull works on other side) #435

Closed rr326 closed 3 months ago

rr326 commented 9 months ago

Issue Description I have a new install. Two docker containers. One will be master. Slave is empty. When I push from master, it fails at "Pushing the local Gravity Database". No explanation why. When I pull from slave, it succeeds. Both are configured.

Push:

 gravity-sync push
∞ Initializing Gravity Sync (4.0.7)
✓ Loading gravity-sync.conf
✓ Detecting local Pi-hole installation
✓ Detecting remote Pi-hole installation - docker
✓ Gravity Sync remote peer is configured
✓ Evaluating arguments: PUSH
» Remote target pi@192.168.1.129
✓ Validating pathways to Pi-hole
✓ Validating pathways to DNSMASQ
∞ Hashing the remote Gravity Databasemd5sum: /etc/pihole/gravity.db: No such file or directory
✓ Hashing the remote Gravity Database
✓ Comparing to the local Gravity Database
! Differences detected in the Gravity Database
! DNS Records not detected on the remote Pi-hole
! DNS CNAMEs not detected on the local Pi-hole
! Static DHCP Addresses not detected on the local Pi-hole
! Replication of Pi-hole settings is required
✓ Performing backup of remote Gravity Database
✓ Performing backup of local Gravity Database
✓ Checking Gravity Database copy integrity
✗ Pushing the local Gravity Database

You can see four "! xxx" which I assume are not problems, just showing sync needs to happen.

When I run 'gravity-sync compare' from master:

 gravity-sync compare
∞ Initializing Gravity Sync (4.0.7)
✓ Loading gravity-sync.conf
✓ Detecting local Pi-hole installation
✓ Detecting remote Pi-hole installation - docker
✓ Gravity Sync remote peer is configured
✓ Evaluating arguments: COMPARE
» Remote target pi@192.168.1.129
✓ Validating pathways to Pi-hole
✓ Validating pathways to DNSMASQ
∞ Hashing the remote Gravity Databasemd5sum: /etc/pihole/gravity.db: No such file or directory
✓ Hashing the remote Gravity Database
✓ Comparing to the local Gravity Database
! Differences detected in the Gravity Database
! DNS Records not detected on the remote Pi-hole
! DNS CNAMEs not detected on the local Pi-hole
! Static DHCP Addresses not detected on the local Pi-hole
! Replication of Pi-hole settings is required
∞ Gravity Sync COMPARE completed after 2 seconds

Configuration Details

Master

gravity-sync info
∞ Initializing Gravity Sync (4.0.7)
✓ Loading gravity-sync.conf
✓ Detecting local Pi-hole installation
✓ Detecting remote Pi-hole installation - docker
✓ Gravity Sync remote peer is configured
✓ Evaluating arguments: INFO
Local Software Versions
Pi-hole
  Pi-hole version is v5.17.3 (Latest: v5.17.3)
  web version is v5.21 (Latest: v5.21)
  FTL version is v5.24 (Latest: v5.24)
Debian GNU/Linux 12
Linux 6.1.0-rpi7-rpi-2712 aarch64
bash 5.2.15(1)-release
OpenSSH_9.2p1 Debian-2+deb12u1, OpenSSL 3.0.11 19 Sep 2023
rsync  version 3.2.7  protocol version 31
Sudo version 1.9.13p3
git version 2.39.2
Docker version 24.0.7, build afdd53b

Global Instance Settings
SSH Port: 22 (default)
SSH Key: /etc/gravity-sync/gravity-sync.rsa
Automated Replication: Disabled

Local Instance Settings
Local Hostname: pi5-seattle
Local Pi-hole Type: docker
Local Pi-hole Config Directory: /home/pi/dev/docker/pihole/etc-pihole
Local DNSMASQ Config Directory: /home/pi/dev/docker/pihole/etc-dnsmasq.d
Local Gravity Sync Binary: /usr/local/bin/gravity-sync
Local Gravity Sync Config Directory: /etc/gravity-sync
Local Pi-hole Container Name: pihole
Local Docker Binary Directory: /usr/bin/docker
Local File Owner Settings: 999:999

Remote Instance Settings
Remote Hostname/IP: 192.168.1.129
Remote Username: pi
Remote Pi-hole Type: docker
Remote Pi-hole Config Directory: /etc/pihole
Remote DNSMASQ Config Directory: /etc/dnsmasq.d
Remote Pi-hole Container Name: pihole
Remote Docker Binary Directory: /usr/bin/docker
Remote File Owner Settings: pihole:pihole
∞ Gravity Sync INFO exited after 2 seconds

Slave

❯ gravity-sync info
∞ Initializing Gravity Sync (4.0.7)
✓ Loading gravity-sync.conf
✓ Detecting local Pi-hole installation
✓ Detecting remote Pi-hole installation - docker
✓ Gravity Sync remote peer is configured
✓ Evaluating arguments: INFO
Local Software Versions
Pi-hole
  Pi-hole version is v5.16.2 (Latest: v5.17.3)
  AdminLTE version is v5.19 (Latest: null)
  FTL version is v5.22 (Latest: v5.24)
Debian GNU/Linux 11
Linux 5.10.103-v7l+ armv7l
bash 5.1.4(1)-release
OpenSSH_8.4p1 Debian-5+deb11u3, OpenSSL 1.1.1w  11 Sep 2023
rsync  version 3.2.3  protocol version 31
Sudo version 1.9.5p2
git version 2.30.2
Docker version 24.0.7, build afdd53b

Global Instance Settings
SSH Port: 22 (default)
SSH Key: /etc/gravity-sync/gravity-sync.rsa
Automated Replication: Disabled

Local Instance Settings
Local Hostname: pi-seattle
Local Pi-hole Type: docker
Local Pi-hole Config Directory: /home/pi/dev/docker/pihole/etc-pihole
Local DNSMASQ Config Directory: /home/pi/dev/docker/pihole/etc-dnsmasq.d
Local Gravity Sync Binary: /usr/local/bin/gravity-sync
Local Gravity Sync Config Directory: /etc/gravity-sync
Local Pi-hole Container Name: pihole
Local Docker Binary Directory: /usr/bin/docker
Local File Owner Settings: 999:999

Remote Instance Settings
Remote Hostname/IP: 192.168.1.138
Remote Username: pi
Remote Pi-hole Type: docker
Remote Pi-hole Config Directory: /home/pi/dev/docker/pihole/etc-pihole
Remote DNSMASQ Config Directory: /home/pi/dev/docker/pihole/etc-dnsmasq.d
Remote Pi-hole Container Name: pihole
Remote Docker Binary Directory: /usr/bin/docker
Remote File Owner Settings: 999:999
∞ Gravity Sync INFO exited after 2 seconds
vmstan commented 9 months ago

Remote Pi-hole Config Directory: /etc/pihole

This doesn't appear to be correct for how the primary would view the secondary.

rr326 commented 9 months ago

That was the clue I needed.

I followed the installation scripts - primary then secondary, and for some reason it didn't fill in the remote info on the primary configuration.

I fixed those manually and it worked.

I'm not sure why, but maybe this:

During the installation at some point it was failing. I realized I didn't have authorized_keys set up to allow ssh from primary to secondary. I fixed it.

Maybe that was the issue? Perhaps "I can properly ssh to remote" isn't working properly in the requirements validation phase?

My problem is solved. (thanks.) Let me know if you want any more info from me, otherwise I can close this.

# REQUIRED SETTINGS ##########################

REMOTE_HOST='192.168.1.129'
REMOTE_USER='pi'

# CUSTOM VARIABLES ###########################

# Pi-hole Folder/File Customization - Only need to be customized when using containers
LOCAL_PIHOLE_DIRECTORY='/home/pi/dev/docker/pihole/etc-pihole'
# REMOTE_PIHOLE_DIRECTORY=''                # Remote Pi-hole data directory
LOCAL_DNSMASQ_DIRECTORY='/home/pi/dev/docker/pihole/etc-dnsmasq.d'
# REMOTE_DNSMASQ_DIRECTORY=''               # Remote DNSMASQ/FTL data directory
LOCAL_FILE_OWNER='999:999'
# REMOTE_FILE_OWNER=''                      # Remote file owner for Pi-hole

# Pi-hole Docker/Podman container name - Docker will pattern match anything set below
LOCAL_DOCKER_CONTAINER='pihole'
# REMOTE_DOCKER_CONTAINER=''                # Remote Pi-hole container name

# HIDDEN FIGURES #############################
# See https://github.com/vmstan/gravity-sync/wiki/Hidden-Figures
vmstan commented 3 months ago

Effective July 26, 2024, this project has been retired. Thank you for your use and enthusiasm for a project that began as a few lines of bash in a Slack channel and envolved into something far more complex, and used by many thousands of Pi-hole enthusiasts over the last four years.