mattwebbio / orbital-sync

Synchronize multiple Pi-hole instances
http://orbitalsync.com
MIT License
635 stars 20 forks source link

Initial delay variable #147

Open modem7 opened 1 year ago

modem7 commented 1 year ago

What feature would you like added?

Currently, if OS and Pihole start at the same time, due to the delay difference in waiting for Pihole to come up, a failure occurs:

Failure: The host "http://<ip>/admin" refused to connect. Is it down?

Requesting that a variable for delay in seconds be implemented so that on container start, OS will wait x period before doing the first operations.

JonMills-MRWA commented 1 year ago

Just make it dependent on the pihole container (& it being healthy)

depends_on:
  pihole:
    condition: service_healthy
acmor commented 1 year ago

Thank you for your comment, but it did not work for me. On system boot I get sync failed e-mail.

On my pi3b I have 4 containers running:

So I tried it with

depends_on:
  pihole:
    condition: service_healthy
  watchtower:
    condition: service_started
  portainer_agent:
    condition: service_started

but it didn't work for me neither... On system boot I still get sync failed e-mail.

BuxtonCalvin commented 8 months ago

Do you have a health check on your pi container? Here's a simple check that will delay startup until there is container connectivity:


healthcheck:
    test: ["CMD", "dig", "+norecurse","+retry=0","@127.0.0.11","pi.hole"," || exit 1"]
    interval: 1m05s
    timeout: 10s
    retries: 0
    start_period: 40s```
acmor commented 8 months ago

Do you have a health check on your pi container? Here's a simple check that will delay startup until there is container connectivity:

No, I haven't had that yet. Your HC seems to be working, thank you very much!

EDIT: it only works when creating the stack via docker compose; when restarting the Pi I get errors again...

Orbital Sync ⚠ Failed An unexpected error was thrown:

I am now trying to vary the start_period a little...

BuxtonCalvin commented 8 months ago

Make sure that "pi.hole" is your FQDN for your pihole container. The dig command doesn't seem to work with "docker domain names" ie container names. I use Cnames in pi-hole to this, and it looks something like pihole.local.foo.com mapped to the FQDN of the server that the container stack sits on. This should give you a healthy container status, which in turn will be picked up by your "depends on" "condition: service_healthy" clauses in your other containers. Once the stack is created, you should be able to start and stop via portainer or the like without issue.

acmor commented 8 months ago

Just to be clear: the pihole container is healthy, I have no problem with that. pihole/pihole:latest "/s6-init" 43 hours ago Up About a minute (healthy)

When deploying the DockerCompose it works wonderfully, the first sync runs without errors. Only when I reboot do I get the error message and the first sync fails.