gravity-sync
gravity-sync copied to clipboard
Gravity Sync in combination with Dockers database locked
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.
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.
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.