5 ms·
Yes this is true with all interpreted languages. But if you consider the use-case the OP was contrasting with (Docker) that not only has the Ruby runtime, but a
by specialp 5y ago
Yes this is true with all interpreted languages. But if you consider the use-case the OP was contrasting with (Docker) that not only has the Ruby runtime, but an entire Linux OS as well.
- anamexis 5y agoWouldn't a more natural point of comparison be installing the ruby interpreter?
- zem 5y agono, because you also need to install all your dependencies
- anamexis 5y agoWell, vendor them and tar it up. You could make a ruby script in a few lines that would load the dependencies and then execute the app all as one file.
- regularfry 5y agoThat is... uh... not a few lines.
- deleted 5y ago[deleted]
- anamexis 5y agoI'm fairly confident you could write a ruby script that would untar a folder and then execute the entry point in 2-3 lines. Then the trick is just making this script and the tar binary be in one single, executable file. You could do this trivially by encoding the binary in base64, but I'm fairly sure there would be a way to have it as straight binary in well, in a way that the ruby interpreter wouldn't complain about.
- regularfry 5y agoYou're skipping the fun part. What's in that tarball? In order to gather the dependencies into the tarball in the first place, they need to be installed. And not all your dependencies are handled by `bundler`. In any interesting project you're going to be depending on system libraries that Rubygems has no way to signal to the OS that it needs. You need to `apt install <foo>` for interesting values of `foo`. That means you've got a few choices: either you document what those OS packages are and rely on the operator knowing that they need to pay attention, or you try to automagically install them when you unpack your tarball, or you include everything you need from the build system in the artefact. This means running the application and finding all the files it touches via `dlopen` and hoping you exercised all the interesting code paths. Option 1: you're back to installing dependencies. Option 2: you're wishing you'd just used `dpkg` to build yourself a .deb, and you're still installing dependencies. Option 3: now you need to figure out how to swap out OS libraries after the ruby interpreter has started, and need to get all the configuration right to point into your untarred filesystem, and you're wishing you'd just used Docker.
- anamexis 5y agoIf you're using native extensions or external dependencies, it's a moot point, because the Ruby WASM compiler doesn't support them either.
- FooBarWidget 5y agoIf you require a runtime then it's not better than JRuby with a jar.