How to trigger a container restart based on successful update/image change of another container? - eviltoast

Basically have watchtower monitor and update containers whenever new images are released. I’ve recently noticed that with searxng (using redis as db), hosted through nginx proxy manager, will have a steady downtime of about 15mins post update then come back online.

This is extremely frequent for searxng’s case as I have watchtower run every day and my preferred way of running most of my containers is with the latest tag. The way out of this downtime in my experience is a restart of NPM which brings back the searxng service.

I’m looking for a way to automate a restart of the NPM container after a successful update of searxng’s container.

I have checked the docs for watchtower, and the lifecycle hooks (a way to run sh scripts pre/post update) are able to run only from the applied container and not from the host system.

  • gobbling871@lemmy.worldOP
    link
    fedilink
    English
    arrow-up
    1
    arrow-down
    1
    ·
    1 year ago

    Sounds like trying to use a rolled up newspaper to kill a fly.

    Isn’t this what tech/sysadmin solutions are all about now? 😆

    You can do it with janky restarts of your reverse proxy container, which results in down time of all apps

    Yet to see if this solution breaks up my other services but it currently fixes the downtime I’ve recently been having with the searxng docker + NPM setup.

    Use something like traefik, where you can allow it to connect to your docker socket (just like watchtower), and automatically wire up the new container’s reverse proxy when it comes back online.

    NPM covers most of my needs plus traefik doesn’t work for me (due to other reasons unrelated to the tech).

    • chiisana@lemmy.chiisana.net
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      Yeah. We reach for what works, and sometimes they’re great, other times there may be better solutions. When a reverse proxy container restarts, there will be a brief disconnect/outage of everything it is proxying until it comes back. I think I’m this case there are other solutions available, but I trust you’ve also weighted the pros and cons of your decision. Hope you find the right tool that meets your objectives!