gravity-sync icon indicating copy to clipboard operation
gravity-sync copied to clipboard

Gravity Sync in combination with Dockers database locked

Open Graxo opened this issue 3 years ago β€’ 1 comments
trafficstars

Issue Description I got 2 pihole dockers running with a docker-compose file, added below (Pihole01). When i run a compare i get the message that there is a difference (which is true, i added a whitelist domain to Pihole02 for testing)

Compare output:

root@pihole01:/opt/pihole01# gravity-sync compare
∞ Initializing Gravity Sync (4.0.4)
βœ“ Loading gravity-sync.conf
βœ“ Detecting local Pi-hole installation
βœ— Detecting remote Pi-hole installation
βœ“ Gravity Sync remote peer is configured
βœ“ Evaluating arguments: COMPARE
Β» Remote target <user>@<Pihole02 ip>
βœ“ Validating pathways to Pi-hole
βœ“ Validating pathways to DNSMASQ
βœ“ Hashing the remote Gravity Database
βœ“ Comparing to the local Gravity Database
! Differences detected in the Gravity Database
βœ“ Hashing the remote DNS Records
βœ“ Comparing to the local DNS Records
! Differences detected in the DNS Records
! 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 4 seconds

When i try to push i get the following output:

∞ Initializing Gravity Sync (4.0.4)
βœ“ Loading gravity-sync.conf
βœ“ Detecting local Pi-hole installation
βœ— Detecting remote Pi-hole installation
βœ“ Gravity Sync remote peer is configured
βœ“ Evaluating arguments: PUSH
Β» Remote target <user>@<Pihole02 ip>
βœ“ Validating pathways to Pi-hole
βœ“ Validating pathways to DNSMASQ
βœ“ Hashing the remote Gravity Database
βœ“ Comparing to the local Gravity Database
! Differences detected in the Gravity Database
βœ“ Hashing the remote DNS Records
βœ“ Comparing to the local DNS Records
! Differences detected in the DNS Records
! 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 local Gravity Databasee∞ Performing backup of local Gravity Database
∞ Checking Gravity Database copy integrityError: in prepare, database is locked (5)
βœ“ Checking Gravity Database copy integrity
βœ— Integrity check has failed for the remote Gravity Database
βœ“ Removing failed copies Gravity Database
∞ Gravity Sync PUSH exited after 12 seconds

Configuration Details The only difference is the 1 or 2 in the name/folder paths Docker-compose file:

version: "3"

# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
  pihole:
    container_name: Pihole01
    image: pihole/pihole:latest
    # For DHCP it is recommended to remove these ports and instead add: network_mode: "host"
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp" # Only required if you are using Pi-hole as your DHCP server
      - "82:80/tcp"
    environment:
      TZ: 'Europe/Amsterdam'
      # WEBPASSWORD: 'set a secure password here or it will be random'
    # Volumes store your data between container upgrades
    volumes:
      - '/opt/pihole01/etc-pihole:/etc/pihole'
      - '/opt/pihole01/etc-dnsmasq.d:/etc/dnsmasq.d'
    #   https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
#    cap_add:
#      - NET_ADMIN # Required if you are using Pi-hole as your DHCP server, else not needed
    restart: unless-stopped

gravity-sync.conf

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

REMOTE_HOST='<remote ip of Pihole02'
REMOTE_USER='<special user>'

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

# Pi-hole Folder/File Customization - Only need to be customized when using containers
LOCAL_PIHOLE_DIRECTORY='/opt/pihole01/etc-pihole'
REMOTE_PIHOLE_DIRECTORY='/opt/pihole02/etc-pihole'

LOCAL_DNSMASQ_DIRECTORY='/opt/pihole01/etc-dnsmasq.d'
REMOTE_DNSMASQ_DIRECTORY='/opt/pihole02/etc-dnsmasq.d'

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='Pihole01'
REMOTE_DOCKER_CONTAINER='Pihole02'

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

I have no clue why im getting these errors and im kinda out of options of throubleshooting. I followed the Wiki to install everything.

Graxo avatar Oct 04 '22 20:10 Graxo

would this be the reason I can not delete a whitelist domain from within the pihole webui?

edit: actually, I am unable to add or delete anything from the webui

I should add that I am using pihole's docker env variable to set container UID and GID to something friendly to my system. As an expiriment, I chown'd the gravity.db to the set UID and GID and was able to modify the mentioned lists. Subsequent gravity-sync reset the file ownership to UID=999 and GID=docker group.

tigerkzr avatar Nov 07 '22 16:11 tigerkzr

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.

vmstan avatar Jul 26 '24 18:07 vmstan