class Object

Public Instance Methods

pureauthd_run(host) click to toggle source
# File lib/pureftpdinator/built-in.rb, line 63
def pureauthd_run(host)
  warn "Starting a new container named #{fetch(:pureauthd_container_name)} on #{host}"
  execute(
    "docker", "run", "--tty", "--detach",
    "--name", fetch(:pureauthd_container_name),
    "--restart", "always",
    "--memory", "#{fetch(:pureauthd_container_max_mem_mb)}m",
    "--memory-swap='-1'",
    "-e", "RAILS_ROOT=#{current_path}",
    "--workdir", current_path,
    "--volume", "#{fetch(:deploy_to)}:#{fetch(:deploy_to)}:rw",
    "--volume", "/home/#{fetch(:pureftpd_username)}:/home/#{fetch(:pureftpd_username)}:rw",
    "--volume", "#{fetch(:pureftpd_socket_dir)}:#{fetch(:pureftpd_socket_dir)}:rw",
    "--volume", "/etc/passwd:/etc/passwd:ro",
    "--volume", "/etc/group:/etc/group:ro",
    fetch(:pureftpd_custom_vol_mounts),
    fetch(:pureftpd_custom_env_vars),
    "--entrypoint", fetch(:pureauthd_entrypoint),
    fetch(:pureftpd_image_name),
    "--socket", fetch(:pureauthd_socket_file),
    "--pidfile", fetch(:pureauthd_pid_file),
    "--run", fetch(:pureauthd_program)
    # "--uid", unix_user_get_uid(fetch(:pureftpd_username)), # won't communicate over socket unless run as root for some reason
    # "--gid", unix_user_get_gid(fetch(:pureftpd_username))
  )
end
pureftpd_run(host) click to toggle source
# File lib/pureftpdinator/built-in.rb, line 31
def pureftpd_run(host)
  warn "Starting a new container named #{fetch(:pureftpd_container_name)} on #{host}"
  execute(
    "docker", "run", "--tty", "--detach",
    "--name", fetch(:pureftpd_container_name),
    "--restart", "always",
    "--memory", "#{fetch(:pureftpd_container_max_mem_mb)}m",
    "--memory-swap='-1'",
    "-e", "RAILS_ROOT=#{current_path}",
    "--volume", "#{fetch(:deploy_to)}:#{fetch(:deploy_to)}:rw",
    "--volume", "/home/#{fetch(:pureftpd_username)}:/home/#{fetch(:pureftpd_username)}:rw",
    "--volume", "#{fetch(:pureftpd_socket_dir)}:#{fetch(:pureftpd_socket_dir)}:rw",
    fetch(:pureftpd_tls_volume_options),
    fetch(:pureftpd_custom_vol_mounts),
    fetch(:pureftpd_custom_env_vars),
    fetch(:pureftpd_ports_options),
    fetch(:pureftpd_port_range_options),
    "--entrypoint", fetch(:pureftpd_entrypoint),
    fetch(:pureftpd_image_name),
    "-0", "-4", "-A", "-E",
    "-g", fetch(:pureftpd_pid_file),
    "-G", "-k", "90",
    "-O", "clf:#{shared_path.join('log', 'pure-ftpd.log')}",
    "-l", "extauth:#{fetch(:pureauthd_socket_file)}",
    "-p", fetch(:pureftpd_passive_port_range),
    "-R", "-S", "0.0.0.0,",
    "-P", Resolv::DNS.new(:nameserver => ['8.8.8.8', '8.8.4.4']).getaddress(fetch(:domain)).to_s,
    "-u", "999", "-U", fetch(:pureftpd_umask),
    "-Y", fetch(:pureftpd_tls_mode)
  )
end