module DockerRailsProxy::Rsync
Attributes
exclusions[RW]
exclusions_from_container_to_host[RW]
exclusions_from_host_to_container[RW]
Public Class Methods
included(base)
click to toggle source
# File lib/docker_rails_proxy/concerns/rsync.rb, line 8 def included(base) base.extend(ClassMethods) end
Public Instance Methods
sync(source:, reverse: false, silent: false)
click to toggle source
# File lib/docker_rails_proxy/concerns/rsync.rb, line 30 def sync(source:, reverse: false, silent: false) _rsync.sync source: source, reverse: reverse, silent: silent end
Private Instance Methods
_rsync()
click to toggle source
# File lib/docker_rails_proxy/concerns/rsync.rb, line 51 def _rsync @_rsync ||= Sync.new(rsync_host: _rsync_host) end
_rsync_host()
click to toggle source
# File lib/docker_rails_proxy/concerns/rsync.rb, line 36 def _rsync_host @_rsync_host ||= begin ip = ENV.fetch('DOCKER_HOST') { '127.0.0.1' }.to_s.sub('tcp://', '').sub(/:\d+$/, '') port = '10873' loop do break if (port = %x(kubectl get svc "#{APP_NAME}" -o jsonpath='{.spec.ports[?(@.name=="rsync")].nodePort}' 2> /dev/null).strip).present? sleep 5 logger.info 'Waiting for rsync port ...' end if Docker.kubernetes_running "rsync://#{ip}:#{port}" end end