           '/home/#{user}/#{app}/releases/#{vsn}/boot'
   end
 
-  defp make_current(conn, user) do
-    L.info "Marking release as current..."
+  defp make_current(conn, user, ip) do
+    L.info "Marking release as current on #{ip}..."
     app = Mix.Project.get!.project[:app]
     vsn = Mix.Project.get!.project[:version]
     {:ok, _, 0} = SSH.run conn,

    {:ok, conn} = :ssh.connect(ip, 22,
                        [{:user,user},{:silently_accept_hosts,true}], 5000)

    place_files conn, user
    make_current conn, user
    cleanup_old_releases conn, user
    :ok
  end

  # Decompress release file, put it in place, and make needed movements
  #
  defp place_files(conn, user) do
    L.info "Settling files..."
    vsn = Mix.Project.get!.project[:version]
    app = Mix.Project.get!.project[:app]
    SSH.cmd! conn, 'mkdir -p /home/#{user}/#{app}/releases/#{vsn}'

                            ' /home/#{user}/#{app}/current'
  end

  defp cleanup_old_releases(conn, user, ip) do
    L.info "Cleaning up old releases on #{ip}..."
    app = Mix.Project.get!.project[:app]
    {:ok, res, 0} = SSH.run conn, 'ls -t /home/#{user}/#{app}/releases'
    excess_releases = res |> String.split("\n") |> Enum.slice(5..-2)
