7 ms·
Alpine Linux in the Browser (2020)
- robotnikman 4y agoUnrelated but still a coincidence, there is also a post on the front page about Alpine.js, and I ended up getting the 2 mixed up for a sec.
- c0balt 4y agoNot really unrelated, this url was referenced in one of the comments in the alpine.js thread.
- detrites 4y agoIs this letting anyone use the owners internet?
- reginaldo 4y agoYes, but [1]: "Can I access to the network from the virtual machine ? Yes it is possible. It uses the websocket VPN offered by Benjamin Burns (see his blog[2]). The bandwidth is capped to 40 kB/s and at most two connections are allowed per public IP address. Please don't abuse the service. " [1] https://bellard.org/jslinux/faq.html https://bellard.org/jslinux/faq.html [2] http://www.benjamincburns.com/2013/11/10/jor1k-ethmac-support.html http://www.benjamincburns.com/2013/11/10/jor1k-ethmac-suppor...
- allanrbo 4y agoToo bad there isn't a way to use the network of the machine running the browser... Maybe one could write some code that intercepts any outgoing network traffic from the VM, and instead of sending it via websockets to that 3rd party VPN, instead just finds packets that are part of a HTTP call and rewrites them to XMLHttpRequests. Would obviously only work for HTTP traffic, but that's probably a big majority. Might not work for HTTPS though. Oh, and DNS would have to respond with some sort of fantasy IP's that the Javascript host would have to keep track of.
- ratorx 4y agoHTTP support seems possible, but it’s unlikely to be useful by itself. HTTPS is probably the majority and that’s a lot trickier (you’d have to MITM TLS in JS). DNS is comparable to HTTP probably, since you could just use DNS-over-HTTPS and intercept DNS packets.
- ahachete 4y agoWait until the emulator can run a modern kernel with eBPF support. Then use eBPF to intercept the SSL calls pre encryption, push via a map the requests to userspace, and then translate them to HTTP as you wish. Simple! ;P
- lxgr 4y agoI'm sure it can run modern kernels just fine, but how would eBPF help with TLS (which is almost exclusively implemented in userspace)?
- saagarjha 4y agoYou’d probably be looking for something like https://en.wikipedia.org/wiki/Slirp https://en.wikipedia.org/wiki/Slirp.
- skrowl 4y agoThis tech appears to have not changed since 2019 - https://bellard.org/tinyemu/ https://bellard.org/tinyemu/ Why is it noteworthy / in the new page here?
- ilaksh 4y agoI have heard that Alpine is really light on resources. Would it be practical for Rust, Node, Python projects in general? Or am I better off sticking with Ubuntu? I know that projects often have extra dependencies and I believe Ubuntu is still very good as far as those being easily available with the package manager. Or maybe about the same thing goes for Debian.
- zitterbewegung 4y agoYou can also run Python in the browser https://www.anaconda.com/blog/pyscript-python-in-the-browser https://www.anaconda.com/blog/pyscript-python-in-the-browser
- tyingq 4y agoAside from packaging, do also look into any potential issues with musl libc. It's fixed now, but the malloc in musl made Python noticably slower for some real world tasks roughly three years ago and earlier. This fixed it: https://git.musl-libc.org/cgit/musl/commit/?id=ea6d7847ac128f02d1f01ffd01e68341df34ac6e https://git.musl-libc.org/cgit/musl/commit/?id=ea6d7847ac128...
- hardwaregeek 4y agoI'd run it mostly for cloud projects that need to be lightweight. I just ran into a quite unpleasant issue with Alpine and Go where Go compiled as a shared library with musl cannot work in Alpine. In fact it segfaults and doesn't give any indication as to why it segfaults (the stack is even corrupted if you try to use gdb). You can read about it here: https://github.com/golang/go/issues/13492 https://github.com/golang/go/issues/13492 Of course one could argue that's mostly Go's fault...
- minimaxir 4y agoFor code that compiles into a binary like Rust, distroless is another option for a minimal image that doesn't run into the compiling issues of Alpine. (Python and Node are supported but lose benefits rapidly depending on any added dependencies) https://github.com/GoogleContainerTools/distroless https://github.com/GoogleContainerTools/distroless
- ashton314 4y agoThis guy again?! Fabrice Bellard gives me serious imposter syndrome. He's built QEMU, ffmpeg, and the Tiny C Compiler that can run off of a floppy. Ugh. If I build one thing in my career that's as cool as any one of those, I'll be delighted.
- mrtweetyhack 4y ago[dead]
- manmal 4y agoI feel similarly. At the same time, comparing oneself to one of the, what, top ten (?) hackers alive might not be a recipe for happiness. Fabrice seems to know an insane amount about how computers work, knows all the CS stuff, has a tight grasp of all kinds of algorithms, great math intuition, and a lot of time on his hands to write OSS code. I bet he spent a lot of time learning the basics.
- ant6n 4y agoThe „a lot of time“ part is key. If you have young kids…
- lxgr 4y agoTo add on to that, JSLinux was written in 2011, in pure JavaScript (i.e. before both Emscripten (2014?) and asm.js (2013)).
- williamstein 4y agoEmscripten has been under active development since at least 2010. Here's the commit frequency history https://github.com/emscripten-core/emscripten/graphs/contributors https://github.com/emscripten-core/emscripten/graphs/contrib... and an article from 2012 about using it https://www.webpronews.com/easily-port-c-to-html5javascript-with-emscripten https://www.webpronews.com/easily-port-c-to-html5javascript-...
- dathinab 4y ago
- lxgr 4y agoHow about any x86 OS in the browser, with JIT translation to WASM and including network access? https://copy.sh/v86/ https://copy.sh/v86/ To be fair, I believe Bellard's JS x86 emulator predates this (and WASM, and to my knowledge also possibly emscripten) by several years :) It has a very interesting history itself: > I wrote the initial version of JSLinux[...] in Javascript > [...] I modified it to use the asm.js Javascript subset [...] > [...] so I converted the JSLinux asm.js code to C and converted it back to Javascript with emscripten! [1] https://bellard.org/jslinux/tech.html https://bellard.org/jslinux/tech.html
- gnarbarian 4y agoso I've played with this a few times and it's awesome. but how do I enable network access? whenever I try and ping 8.8.8.8 I get network unreachable.
- pacoverdi 4y agoThe VPN websocket service (wss://relay.widgetry.org/) is probably overloaded. I sometimes get this error but not all the time. Both versions seem to use the same service. Related links: https://github.com/copy/v86/blob/master/docs/networking.md https://github.com/copy/v86/blob/master/docs/networking.md Network section in https://bellard.org/jslinux/faq.html https://bellard.org/jslinux/faq.html
- piyh 4y agobenchmark.py is 100x slower in browser than native on my 16 inch macbook.
- keewee7 4y agoIt's worth mentioning that the initial version of this didn't use WebAssembly. Bellard literally implemented i386/PC emulation in pure JavaScript (ES5) back in 2011.
- deleted 4y ago[deleted]
- jchw 4y agoIt did require W3C Typed Arrays to perform decently, but I remember with polyfills it even ran in the contemporary version of Internet Explorer (9 if memory serves correctly?)