Class: Mrsk::Commands::Traefik
- Defined in:
- lib/mrsk/commands/traefik.rb
Constant Summary collapse
- DEFAULT_IMAGE =
"traefik:v2.9"
- CONTAINER_PORT =
80
- DEFAULT_ARGS =
{ 'log.level' => 'DEBUG' }
Constants inherited from Base
Base::DOCKER_HEALTH_LOG_FORMAT, Base::DOCKER_HEALTH_STATUS_FORMAT
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #follow_logs(host:, grep: nil) ⇒ Object
- #info ⇒ Object
- #logs(since: nil, lines: nil, grep: nil) ⇒ Object
- #port ⇒ Object
- #remove_container ⇒ Object
- #remove_image ⇒ Object
- #run ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Methods inherited from Base
#container_id_for, #initialize, #run_over_ssh
Constructor Details
This class inherits a constructor from Mrsk::Commands::Base
Instance Method Details
#follow_logs(host:, grep: nil) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/mrsk/commands/traefik.rb', line 43 def follow_logs(host:, grep: nil) run_over_ssh pipe( docker(:logs, "traefik", "--timestamps", "--tail", "10", "--follow", "2>&1"), (%(grep "#{grep}") if grep) ).join(" "), host: host end |
#info ⇒ Object
33 34 35 |
# File 'lib/mrsk/commands/traefik.rb', line 33 def info docker :ps, "--filter", "name=^traefik$" end |
#logs(since: nil, lines: nil, grep: nil) ⇒ Object
37 38 39 40 41 |
# File 'lib/mrsk/commands/traefik.rb', line 37 def logs(since: nil, lines: nil, grep: nil) pipe \ docker(:logs, "traefik", (" --since #{since}" if since), (" --tail #{lines}" if lines), "--timestamps", "2>&1"), ("grep '#{grep}'" if grep) end |
#port ⇒ Object
58 59 60 |
# File 'lib/mrsk/commands/traefik.rb', line 58 def port "#{host_port}:#{CONTAINER_PORT}" end |
#remove_container ⇒ Object
50 51 52 |
# File 'lib/mrsk/commands/traefik.rb', line 50 def remove_container docker :container, :prune, "--force", "--filter", "label=org.opencontainers.image.title=Traefik" end |
#remove_image ⇒ Object
54 55 56 |
# File 'lib/mrsk/commands/traefik.rb', line 54 def remove_image docker :image, :prune, "--all", "--force", "--filter", "label=org.opencontainers.image.title=Traefik" end |
#run ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/mrsk/commands/traefik.rb', line 10 def run docker :run, "--name traefik", "--detach", "--restart", "unless-stopped", "--publish", port, "--volume", "/var/run/docker.sock:/var/run/docker.sock", *env_args, *config.logging_args, *label_args, *, image, "--providers.docker", *cmd_option_args end |
#start ⇒ Object
25 26 27 |
# File 'lib/mrsk/commands/traefik.rb', line 25 def start docker :container, :start, "traefik" end |
#stop ⇒ Object
29 30 31 |
# File 'lib/mrsk/commands/traefik.rb', line 29 def stop docker :container, :stop, "traefik" end |