Replaced Kamal::Commands::Proxy::Exec with Kamal::Commands::App::Proxy and Kamal::Commands::Accessory::Proxy
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
class Kamal::Commands::Accessory < Kamal::Commands::Base
|
class Kamal::Commands::Accessory < Kamal::Commands::Base
|
||||||
include Kamal::Commands::Proxy::Exec
|
include Proxy
|
||||||
|
|
||||||
attr_reader :accessory_config
|
attr_reader :accessory_config
|
||||||
delegate :service_name, :image, :hosts, :port, :files, :directories, :cmd,
|
delegate :service_name, :image, :hosts, :port, :files, :directories, :cmd,
|
||||||
@@ -111,10 +111,6 @@ class Kamal::Commands::Accessory < Kamal::Commands::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def proxy_deploy_command_args(target:)
|
|
||||||
proxy.deploy_command_args(target: target)
|
|
||||||
end
|
|
||||||
|
|
||||||
def service_filter
|
def service_filter
|
||||||
[ "--filter", "label=service=#{service_name}" ]
|
[ "--filter", "label=service=#{service_name}" ]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
module Kamal::Commands::Proxy::Exec
|
module Kamal::Commands::Accessory::Proxy
|
||||||
delegate :proxy_container_name, to: :config
|
delegate :proxy_container_name, to: :config
|
||||||
|
|
||||||
def deploy(target:)
|
def deploy(target:)
|
||||||
proxy_exec :deploy, service_name, *proxy_deploy_command_args(target: target)
|
proxy_exec :deploy, service_name, *proxy.deploy_command_args(target: target)
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove
|
def remove
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
class Kamal::Commands::App < Kamal::Commands::Base
|
class Kamal::Commands::App < Kamal::Commands::Base
|
||||||
include Assets, Containers, Execution, Images, Logging, Kamal::Commands::Proxy::Exec
|
include Assets, Containers, Execution, Images, Logging, Proxy
|
||||||
|
|
||||||
ACTIVE_DOCKER_STATUSES = [ :running, :restarting ]
|
ACTIVE_DOCKER_STATUSES = [ :running, :restarting ]
|
||||||
|
|
||||||
@@ -76,14 +76,6 @@ class Kamal::Commands::App < Kamal::Commands::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def service_name
|
|
||||||
role.container_prefix
|
|
||||||
end
|
|
||||||
|
|
||||||
def proxy_deploy_command_args(target:)
|
|
||||||
role.proxy.deploy_command_args(target: target)
|
|
||||||
end
|
|
||||||
|
|
||||||
def latest_image_id
|
def latest_image_id
|
||||||
docker :image, :ls, *argumentize("--filter", "reference=#{config.latest_image}"), "--format", "'{{.ID}}'"
|
docker :image, :ls, *argumentize("--filter", "reference=#{config.latest_image}"), "--format", "'{{.ID}}'"
|
||||||
end
|
end
|
||||||
|
|||||||
16
lib/kamal/commands/app/proxy.rb
Normal file
16
lib/kamal/commands/app/proxy.rb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
module Kamal::Commands::App::Proxy
|
||||||
|
delegate :proxy_container_name, to: :config
|
||||||
|
|
||||||
|
def deploy(target:)
|
||||||
|
proxy_exec :deploy, role.container_prefix, *role.proxy.deploy_command_args(target: target)
|
||||||
|
end
|
||||||
|
|
||||||
|
def remove
|
||||||
|
proxy_exec :remove, role.container_prefix
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def proxy_exec(*command)
|
||||||
|
docker :exec, proxy_container_name, "kamal-proxy", *command
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user