Top Level Namespace

Defined Under Namespace

Modules: Capistrano

Instance Method Summary collapse

Instance Method Details

#pureauthd_run(host) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# 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) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# 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