pygmystack / pygmy-legacy

Use pygmystack/pygmy instead
https://github.com/pygmystack/pygmy
MIT License
25 stars 16 forks source link

Do not pass `--restart always` to services. #40

Closed mglaman closed 1 year ago

mglaman commented 5 years ago

https://docs.docker.com/engine/reference/run/#restart-policies---restart

Several of the services are set to always restart whenever the Docker engine restarts.

When using various local development stacks (or any local development) this causes conflicts.

Related issue from DDEV from a year ago (they had explicit restart: always previously)

Proposal: remove restart policy from the definitions.

ssh_agent.rb

    def self.run_cmd
      "docker run -d " \
      "--restart=always " \
      "--name=#{Shellwords.escape(self.container_name)} " \
      "#{Shellwords.escape(self.image_name)}"
    end

haproxy.rb

    def self.run_cmd
      "docker run -d " \
      "-p 80:80 -p 443:443 " \
      "--volume=/var/run/docker.sock:/tmp/docker.sock " \
      "--restart=always " \
      "--name=#{Shellwords.escape(self.container_name)} " \
      "#{Shellwords.escape(self.image_name)}"
    end

mailhog.rb

    def self.run_cmd(domain = self.domain, addr = self.addr)
      "docker run --restart=always -d -p 1025:1025 --expose 80 -u 0 --name=#{Shellwords.escape(self.container_name)} " \
      '-e "MH_UI_BIND_ADDR=0.0.0.0:80" ' \
      '-e "MH_API_BIND_ADDR=0.0.0.0:80" ' \
      '-e "AMAZEEIO=AMAZEEIO" ' \
      "#{Shellwords.escape(self.image_name)}"
    end
mglaman commented 5 years ago

This is mitigated by ensuring you run pygmy down versus pygmy stop.

mglaman commented 5 years ago

Copying in some notes. This is a nice feature if you're only on this kind of stack.

Maybe the default run cmd could be --restart no and add a --persist or --autostart flag to pygmy start for those who <3 this

ocean90 commented 5 years ago

Just noticed the same. After a system restart I still had something bind to port 443. And it was indeed the HAProxy service from pygmy.

The dnsmasq service doesn't use the restart argument (probably due to the sudo requirements) so pygmy isn't fully started.

Feng-Shui commented 4 years ago

Would also like to see the ability have this configurable.

tobybellwood commented 1 year ago

https://github.com/pygmystack/pygmy supports this