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

Integrating Containers Into JavaScript

Integrating Containers Into JavaScript

Lucas Santos

May 14, 2021
Tweet

More Decks by Lucas Santos

Other Decks in Technology

Transcript

  1. Integrating containers in
    JavaScript
    the good, the bad, and the ugly

    View Slide

  2. cloud advocate_
    who am I_
    [email protected]
    {twitter, facebook, linkedin…}.lsantos.dev

    View Slide

  3. containers are a thing_

    View Slide

  4. it’s easy to control them

    View Slide

  5. if you are human_

    View Slide

  6. what if you’re not?

    View Slide

  7. then we use containerd
    - High-level runtime (runtime
    manager) created by the Open
    Container Initiative
    - Powers Docker
    - Created to be manipulated
    through code

    View Slide

  8. not so easy for JS devs

    View Slide

  9. Golang predominance

    View Slide

  10. Then I came across this article_

    View Slide

  11. What if I did this using
    Node.js?

    View Slide

  12. The first attempt
    sometimes good, mostly bad, but always ugly

    View Slide

  13. use child-process

    View Slide

  14. pros
    - Super easy
    - Takes advantage of ctr’s built
    in features
    - Faster implementation
    - Can be integrated with any
    external API

    View Slide

  15. so easy that I built this

    View Slide

  16. to the code

    View Slide

  17. cons
    - heavily dependent on
    environment
    - no complete control over the
    process
    - Limited to parsing the string
    outputs
    - Error handling is poor
    - Needs sudo
    - Input sanitizing

    View Slide

  18. conclusion: we can integrate
    containers into JS

    View Slide

  19. but I wanted a real integration

    View Slide

  20. The second attempt
    mostly good, sometimes bad, kinda pretty

    View Slide

  21. containerd was meant to be extended

    View Slide

  22. but you need to know how to do it

    View Slide

  23. View Slide

  24. View Slide

  25. but it is possible

    View Slide

  26. to the code

    View Slide

  27. pros
    - Proper error handling
    - Proper return codes
    - Allows you full control of the
    pipeline
    - Does not need to be in the
    same machine
    - Does not require sudo
    - Native (gRPC module)

    View Slide

  28. cons
    - Requires a LOT of knowledge
    in containers
    - Sparse documentation both
    for gRPC and containerd
    - Harder
    - Might be a problem to connect
    to external servers
    - CRT certificates and so on

    View Slide

  29. Next steps
    what can we do next?

    View Slide

  30. let’s make this a good tool

    View Slide

  31. Let’s add more knowledge
    to the Web!

    View Slide

  32. refs_
    - github.lsantos.dev/containerd-integration-example
    - github.lsantos.dev/js-containerd-example
    - github.lsantos.dev/containerd-js
    - Mark’s article bit.ly/containerd-grpc-web
    These Slides:
    - slides.lsantos.dev/integrating-containers-into-javascript

    View Slide

  33. thank you_
    info.lsantos.dev

    View Slide