Closed niawag closed 2 months ago
Yes I intended to build a Docker version, but I've just not had time the last couple weeks. Happy to take contributions.
Great! I'll report my progress here and I may ask for your help!
So, I've been making progress on this, here is my Dockerfile:
FROM debian
MAINTAINER niawag
RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf \
&& echo "search companydomain" >> /etc/resolv.conf \
&& apt-get update \
&& apt-get install -y systemctl git rsync curl sudo \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf \
&& echo "search companydomain" >> /etc/resolv.conf \
&& curl -sSL https://gravity.vmstan.com | GS_DOCKER=1 bash
CMD tail -f /dev/null
There are lines related to dns (first 2 lines of RUN cmd) that may not be necessary on other system or if built by githib. The CMD command is to keep the container running
Here is the config file:
# REQUIRED SETTINGS ##########################
REMOTE_HOST='192.168.0.44'
REMOTE_USER='pi'
# CUSTOM VARIABLES ###########################
# Pi-hole Folder/File Customization - Only need to be customized when using containers
LOCAL_PIHOLE_DIRECTORY='/etc/pihole' # Local Pi-hole data directory
REMOTE_PIHOLE_DIRECTORY='/home/pi/dockers/pihole/pihole' # Remote Pi-hole data directory
LOCAL_DNSMASQ_DIRECTORY='/etc/dnsmasq.d/' # Local DNSMASQ/FTL data directory
REMOTE_DNSMASQ_DIRECTORY='/home/pi/dockers/pihole/etc-dnsmasq.d' # Remote DNSMASQ/FTL data directory
LOCAL_FILE_OWNER='999:999' # Local file owner for Pi-hole
REMOTE_FILE_OWNER='999:999' # Remote file owner for Pi-hole
# Pi-hole Docker/Podman container name - Docker will pattern match anything set below
# LOCAL_DOCKER_CONTAINER='' # Local Pi-hole container name
# REMOTE_DOCKER_CONTAINER='' # Remote Pi-hole container name
# HIDDEN FIGURES #############################
# See https://github.com/vmstan/gravity-sync/wiki/Hidden-Figures
And the docker-compose.yml file:
services:
gravitysync:
build:
context: /storage/gravity/
container_name: "gravitysync"
restart: "unless-stopped"
volumes:
- "/storage/dockers/gravity-sync/gravity-sync.conf:/etc/gravity-sync/gravity-sync.conf:rw"
- "/storage/dockers/gravity-sync/gravity-sync.rsa:/etc/gravity-sync/gravity-sync.rsa:rw"
- "/storage/dockers/pihole/pihole:/etc/pihole/:rw"
- "/storage/dockers/pihole/etc-dnsmasq.d:/etc/dnsmasq.d/:rw"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
When running gravity-sync info from the container I'm getting:
root@899faae51831:/# /etc/gravity-sync/.gs/gravity-sync info
β Initializing Gravity Sync (4.0.4)
β Loading gravity-sync.conf
β Detecting local Pi-hole installation
β Detecting remote Pi-hole installation
β Gravity Sync falling back to peerless mode
! Please configure Gravity Sync on remote host
β Evaluating arguments: INFO
Local Software Versions
Pi-hole
Debian GNU/Linux 11
Linux 4.9.269 aarch64
bash 5.1.4(1)-release
OpenSSH_8.4p1 Debian-5, OpenSSL 1.1.1n 15 Mar 2022
rsync version 3.2.3 protocol version 31
Sudo version 1.9.5p2
git version 2.30.2
Global Instance Settings
SSH Port: 22 (default)
SSH Key: /etc/gravity-sync/gravity-sync.rsa
ERROR:systemctl:Unit gravity-sync.timer could not be found.
Automated Replication: Disabled
Local Instance Settings
Local Hostname: 899faae51831
Local Pi-hole Type: none
Local Pi-hole Config Directory: /etc/pihole
Local DNSMASQ Config Directory: /etc/dnsmasq.d/
Local Gravity Sync Binary: /usr/local/bin/gravity-sync
Local Gravity Sync Config Directory: /etc/gravity-sync
Local File Owner Settings: 999:999
Remote Instance Settings
Remote Hostname/IP: 192.168.0.44
Remote Username: pi
Remote Pi-hole Type: docker
Remote Pi-hole Config Directory: /home/pi/dockers/pihole/pihole
Remote DNSMASQ Config Directory: /home/pi/dockers/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
So almost everything seems ok, I'll get back to the local pihole detection later. And here is when I'm trying a push:
root@899faae51831:/# /etc/gravity-sync/.gs/gravity-sync push
β Initializing Gravity Sync (4.0.4)
β Loading gravity-sync.conf
β Detecting local Pi-hole installation
β Detecting remote Pi-hole installation
β Gravity Sync falling back to peerless mode
! Please configure Gravity Sync on remote host
β Evaluating arguments: PUSH
Β» Remote target pi@192.168.0.44
β 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
β Hashing the remote DNS CNAMEs
β Comparing to the local DNS CNAMEs
! Differences detected in the DNS CNAMEs
β Hashing the remote Static DHCP Addresses
β Comparing to the local Static DHCP Addresses
! Differences detected in the Static DHCP Addresses
! Replication of Pi-hole settings is required
β Performing backup of remote Gravity Database
β Integrity check has failed for the remote Gravity Databaseity Database copy integrity
β Removing failed copies Gravity Databaserm: cannot remove '/etc/pihole/gravity.db.gsb': No such file or directory
β Removing failed copies Gravity Database
So it seems to be failing when creating the backup, it may be a problem with rights but I'm not sure.
About β Detecting local Pi-hole installation
, I've checked the code and it's normal that it fails as the docker command won't work inside the container. Is there a way to improve this ?
There is already a Docker Image available -> https://hub.docker.com/r/nhmike94/gravity-sync-docker
It hasn't been updated for 4.x and I haven't seen @nh-mike around lately.
Thatβs why i opened an issue today -> https://github.com/nh-mike/gravity-sync-docker/issues/9 ;)
Hi all Apologies I've been travelling a lot for work lately to places where internet is little more than a memory and have been unable to maintain the project lately.
I'll get back to you all in a few days. I know there's been a lot of large changes I will need to accommodate for.
Cheers.
To add to this, it would be great to publish a docker container for use with unRAID: https://forums.unraid.net/topic/87144-ca-application-policies-notes/
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.
Hi, gravity-sync seems to be exactly what I need but I'm trying to run it on a CoreElec install and the install script is failing (no sudo). Being able to run gravity-sync in a docker container could be great to help users (me included) on weird systems. I'm used to docker as a user but not as an image creator, anyway I've started to create a Dockerfile to build my own image and I think I might succeed but I've also seen that a Dockerfile is available in this repo.
Are you planning to create a docker image and offer it as one of the installation system ? If so I'd be glad to help you develop it and/or test it. If not I will keep trying on my side and "offer" my Dockerfile here so other can do the same.