$30 off During Our Annual Pro Sale. View Details »

App::RemoteCommand 2018

Shoichi Kaji
February 09, 2018
8

App::RemoteCommand 2018

2018.02.09 kichijojipm 13
(original https://www.slideshare.net/skaji/appremotecommand)

Shoichi Kaji

February 09, 2018
Tweet

Transcript

  1. App::RemoteCommand
    2018.02.09 Shoichi Kaji

    View Slide

  2. Me
    • Shoichi Kaji


    • github/PAUSE: skaji


    • Perl5: cpm


    • Perl6: mi6

    View Slide

  3. Contents
    • What is App::RemoteCommand?


    • Why did I create it?


    • Features


    • DEMO


    • Internals

    View Slide

  4. What is
    App::RemoteCommand?

    View Slide

  5. A simple remote command
    launcher via SSH

    View Slide

  6. Why did I created it?
    • We have a lot of tools that support IT
    automation, such as chef, ansible, capistrano,
    fabric, …


    • OTOH, we sometimes want to do ad hoc
    operation. Then such IT-automation tools are
    obtrusive. But ssh(1) is powerless.


    • So I created App::RemoteCommand, which is
    simple, and at the same time, powerful.

    View Slide

  7. Features
    • Execute remote command in parallel


    • Remember sudo pass
    fi
    rst, never ask again


    • You may specify a local script
    fi
    le


    • Append host and time to each output line


    • Sane signal handling

    View Slide

  8. DEMO
    https://asciinema.org/a/119109

    View Slide

  9. Internals
    • a) Built on top of Net::OpenSSH


    • b) Using its own event loop

    View Slide

  10. Built on top of Net::OpenSSH
    • Net::OpenSSH is a wrapper around ssh(1),
    created by Salvador Fandiño.


    • Because it is a wrapper for ssh(1),

    it can use the complicated ~/.ssh/con
    fi
    g 😎


    • It multiplexes SSH connections.


    • It provides sophisticated I/F for SSH operation,
    including I/F for event oriented programming.

    View Slide

  11. Using its own event loop
    • Thanks to Net::OpenSSH, we can easily write an application
    working with SSH in event oriented programming.


    • In fact, App::RemoteCommand uses its own event loop; it
    watches:


    • SSH: connected,
    fi
    nished-command, disconnected


    • IO: readable


    • Process:
    fi
    nished


    • Signals: catched

    View Slide

  12. Try it now!


    ❯ cpm install -g App::RemoteCommand

    View Slide