Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

containers are a thing_

Slide 4

Slide 4 text

it’s easy to control them

Slide 5

Slide 5 text

if you are human_

Slide 6

Slide 6 text

what if you’re not?

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

not so easy for JS devs

Slide 9

Slide 9 text

Golang predominance

Slide 10

Slide 10 text

Then I came across this article_

Slide 11

Slide 11 text

What if I did this using Node.js?

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

use child-process

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

so easy that I built this

Slide 16

Slide 16 text

to the code

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

conclusion: we can integrate containers into JS

Slide 19

Slide 19 text

but I wanted a real integration

Slide 20

Slide 20 text

The second attempt mostly good, sometimes bad, kinda pretty

Slide 21

Slide 21 text

containerd was meant to be extended

Slide 22

Slide 22 text

but you need to know how to do it

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

but it is possible

Slide 26

Slide 26 text

to the code

Slide 27

Slide 27 text

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)

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

Next steps what can we do next?

Slide 30

Slide 30 text

let’s make this a good tool

Slide 31

Slide 31 text

Let’s add more knowledge to the Web!

Slide 32

Slide 32 text

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

Slide 33

Slide 33 text

thank you_ info.lsantos.dev