9 ms·
I think running your dev environment in a VM is the future on all platforms. As developers we trust so many different libraries. And it is important that they
by ccouzens 6y ago
I think running your dev environment in a VM is the future on all platforms.
As developers we trust so many different libraries. And it is important that they are safe when used in production code.
But we shouldn't have to worry about accidentally installing a library which uploads our emails or our browser data. By working from a VM we can prevent that.
The worst a malicious library can do from a VM is upload our SSH keys or source code (which is still bad).
- josephg 6y agoI hear what you're saying, but the last time I worked through a linux VM on my mac laptop, everything got much slower. Our nodejs service took 2-3x longer to start up or to build. I think the issue was filesystem overhead for some reason. The future might involve working from a VM when we have CPU cycles to spare. But right now I need every iota of speed my computer has for my rust compiler. I'd much rather we solve the security problems using better local sandboxing for software, like how it works on our phones. That would help end users as well, and it would stop crypto ransomware and all sorts of other attacks. Or alternatively, run my dev tools from a solaris zone or a freebsd jail or something, both of which have no performance impact.
- danieldk 6y agoFedora Toolbox is quite interesting from this perspective. It does not provide a proper security boundary, since it shares the home directory, but it is really nice to make ad-hoc development environments. Since it is built on podman/buildah, it does not require the Docker daemon and can be used by regular users.
- JimDabell 6y ago> the last time I worked through a linux VM on my mac laptop, everything got much slower. Our nodejs service took 2-3x longer to start up or to build. I think the issue was filesystem overhead for some reason. Docker on Mac has a lot of IO overhead. This is mentioned in the article: > The way I made it work is by having a full “dev environment” running virtually. That means that I check out repositories on the virtual disk and run everything from there. This has the slight inconvenience that I can’t easily access those files with Finder, but the upside is that there is no noticeable IO latency issues like when running Docker for Mac. If you just want improved performance with bind mounts instead, you can use :cached or :delegated flags.
- wdb 6y agoI have been wondering if using VMWare Fusion docker compatible solution that even comes with their free version of Fusion has better IO/disk performance when running containers https://blogs.vmware.com/teamfusion/2020/05/fusion-11-5-now-supports-containers.html https://blogs.vmware.com/teamfusion/2020/05/fusion-11-5-now-... I think Fusion comes with a driver for Docker
- bdcravens 6y agoSince the earliest days of Docker for Mac, I've found docker-sync to be very effective. (I've haven't done much follow-up over time to see if using those flags matches performance) To gain more speed, add folders you really don't care about to docker-sync's ignored folders, especially if they are high churn.
- tbrock 6y agoThis is why running something like VSCode on your Mac with the remote ssh dev setup is the best of all worlds. https://code.visualstudio.com/docs/remote/remote-overview https://code.visualstudio.com/docs/remote/remote-overview Virtualized Linux on x86 AND being able to run VSCode on your Mac for great fonts, WiFi, screen etc without having to fuss with drivers. Of course ssh and tmux also work well for this purpose.
- dijit 6y agoUgh, I don't want to descend into "that thread" again, but Wifi/Screen have not been an issue on linux (as long as you don't use nvidia) in over 10 years. Mixed scale DPI screens are not a problem if you use Wayland, which is basically the default now. Font rendering though? YMMV.
- acdibble 6y agoIf you use fractional scaling on Wayland, Chromium-based applications will render blurry. Obviously it's a Chromium issue but it's been around for a while and is a bad experience.
- rathboma 6y agoThis just got patched, so electron apps are slowly able to update and fix this. VSCode has a beta version with the fix already
- josephg 6y agoLinux generally works great. I'm typing this on a linux mint, using mixed scale DPI screens and generally it all works pretty well. I think all my hardware is fully supported - I haven't had to mess with drivers at all. ... Well, not recently. There were some zen3 bugs in the stable kernel releases a few months ago, but it all works fine now. And thats sort of the theme everywhere. Its super fast and I love it, and its mostly stable and mostly great. But tiny bugs shine through all over. I've been totally spoiled by Apple's spit and polish. For example, I get random graphics bugs after waking from sleep sometimes. Sometimes my mouse cursor is either invisible or for some reason duplicated, so I see a second stationary cursor hovering over my windows. And for some reason my second display doesn't vsync, so I get obvious tearing when I scroll or move windows around. I use a trackpad, and smooth scrolling works properly in most apps. But Firefox needs an obscure XInput environment variable to make it work. (That trick is only mentioned deep some a bug tracker). Smooth scrolling doesn't work at all in IntelliJ. Intellij also doesn't let me use the Meta key (Cmd / Start) as a shortcut modifier - so my muscle memory for navigation is all messed up and I can't rebind keys to fix it. I hate how Ctrl+C is copy everywhere except the terminal, which needs me to Ctrl+Shift+C instead. Etc etc. Forever. Its unbelievably responsive compared to my 2016 MBP though. If you haven't upgraded in awhile and you can afford it, its a fantastic time to get a new system. But linux on the desktop still isn't entirely pain free. Way better than it was a few years ago though.
- the8472 6y agoDid you use a native filesystem inside the VM or a host filesystem remoted into the VM?
- lovelyviking 6y ago>I need every iota of speed my computer has for my rust compiler If so, why do you need rust compiler in the first place? May be you don't? May be it's wrong compiler?
- ttiurani 6y agoPersonally pushing the edit, compile, run cycle time as low as possible has always been the reason I have stayed away from dev VMs. For 99% of computer uses a VM is fast enough but unfortunately for many programming tasks, it is not.
- nickjj 6y ago> I think running your dev environment in a VM is the future on all platforms. We probably have a long ways to go before we get there and it does come with its own sets of challenges and usability quirks even if the technical implementation is good. For example, 8 years ago I used to run Windows 7 with xubuntu running in a graphical vmware VM using Unity mode[0]. Basically a way to seamlessly run graphical Linux apps in Windows. Each GUI app you launched from the Linux VM would have its own floating window that you could move around like any other Windows window. As an aside, this feature has been removed from vmware for years now when it comes to Linux guests. It worked well enough for then, and I spent 99% of my time in that VM (browser, code editor, everything) and I only used Windows for recording / editing videos and playing games to avoid having to dual boot. But even with vmware's really good disk performance there were performance issues at times, you're also splitting your memory up between your main system and your VM, it's not that efficient. Then there's little quirks like your main OS not really fully being able to integrate with files and apps from the VM, so you have to do hacky things to get apps to launch from a taskbar, search doesn't work because your stuff is in a VM, etc.. Plus you always feel like you're split between 2 worlds, the main OS and the VM. It doesn't feel really nice and cohesive. To a lesser extent nowadays we have WSL 2 on Windows which is what I use. It solves a lot of the VM problems from above and running an X-server lets you run graphical apps very well, but you still feel like you're running 2 operating systems and the user experience suffers because you don't feel like you're running 1 streamlined OS. A prime example is having to put all of your files in WSL 2's file system to get good performance but having certain types of files there is an inconvenience or you may not want to do it because it doesn't make sense to put 100GB of storage files on your SSD. That happened to me because I have a podcast site which is mostly code, except for a ton of raw wav file recordings + mp3s. Instead of just having a git ignored directory in my project, I had to create a 2nd directory outside of WSL to store these files. There's many other examples like this too. I don't know what the Mac story is like, but I would imagine at minimum you're dealing with files being split into 2 worlds and will experience the unfriendly split OS feeling overall. Does Parallels let you seamlessly run floating windows across your VM and macOS? [0]: Here's a really old video of that set up https://nickjanetakis.com/blog/create-an-awesome-linux-development-environment-in-windows-with-vmware https://nickjanetakis.com/blog/create-an-awesome-linux-devel...
- 6y ago
- fpoling 6y agoA properly secured unprivileged Linux container is not particularly worse than VM from a security point of view, but its impact on performance is very minimal. The drawback is that one cannot use Mac or Windows as a host, but as long as one is OK with running Linux on machine and accessing, say, Windows occasionally via VM, this is a very nice setup.
- ccouzens 6y agoMy first attempt at this configuration was using a podman container (my laptop runs Fedora). It worked well, except that I occasionally want to run a container within my dev-environment. Running a container inside a container is possible, but not easy. I settled on running a Vagrant Libvirt VM. I do not know what the performance impact is- but I have not noticed either my laptop or the VM being slow.
- j1elo 6y agoI'm just now learning about the container technologies that are alternatives to Docker. More precisely, LXC, in case you had it in mind in your comment. Do you know of a set of settings or tips to follow for making containers as safe as a VM?
- fpoling 6y agoI use systemd-nspawn containers with max security options, like user namespaces, syscall filters, no-new-priveleges. Even with the user namespaces I do not run as a root in the user namespaces unless I need to install extra software inside the container.
- rowanG077 6y agoActually I think VMs for dev are evil. I hope it's a stop gap measure until tooling like nix catches up enough. Running an entire seperate OS just for development is completely bonkers to me.
- mpweiher 6y agoI'd phrase it this way: it is completely bonkers that this isn't bonkers.
- mcny 6y agoIf you think that's bonkers, I'll give you an even worse idea: a dedicated desktop machine. I have a dell optiplex running Intel i3-2100 with 8GB RAM and 1TB Samsung 860 Evo SSD. No display. Fedora runs like a dream with dnf automatic. Use cockpit if you'd like. You can use your windows or Mac laptop with visual studio code to do web development. ng serve works as if you ran it from your laptop. The biggest drawback I can think of is if you ever needed to leave the house. Thankfully, I have no life so I don't have this problem.
- cassianoleal 6y ago> The biggest drawback I can think of is if you ever needed to leave the house. Add ZeroTier to the equation and as long as you have Internet connection when you're outside the house you'll probably not even notice it.
- Tsiklon 6y agoHaving both your laptop and desktop on a WireGuard vpn with the gateway on your choice of cloud host would solve that problem, also it would solve having to deal with wandering IP addresses as you may find with a home internet connection
- rovr138 6y agoI see WireGuard and ZeroTier mentioned. I just use ssh. SSH to a VPS and map 22 to a port on the VPS. I have a really small VPS for this.
- the_duke 6y agoThe need for VMs or containers for security (on end user machines) is the fallout of insufficient OS security mechanisms. A better solution would be a desktop OS with proper application sandboxing. Mac OS is taking many steps in that direction. Linux - as usual - has a multitude of solutions, all of them problematic. (AppArmor, SeLinux, Firejail, Snap, Flatpak)
- millerm 6y agoI believe the real problem is that devs install random binaries, or modules, without any real concern for what malicious activities, even if unintentional, these artifacts may perform. Forget the fact that it’s on the dev’s machine, they move this stuff into production without proper security vetting. Many devs just blindly install things from npm, copy random snippets from GitHub gists, execute remote shell scripts via curl that they just copy and paste into the terminal because they read it in some blog post, and on and on. Anyway, just my worthless < 2 cents.
- wongarsu 6y agoMicrosoft tried to push for a better model in the Windows Store apps. But the world reacted with apathy. Now they seem to try to leverage their built-in hypervisor instead, for example with Sandbox [1] for temporary VMs with minimal overhead. 1: https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-sandbox/windows-sandbox-overview https://docs.microsoft.com/en-us/windows/security/threat-pro...
- m463 6y agoI believe VMs are not just for security - it might be the only way to run completely different operating systems (like macos on linux, or linux on windows, etc) Additionally, VMs might be a great help to complicated debugging. You can crash a VM without taking down your desktop. I'm not sure about things like kernel debugging, but it might be easier in a VM.
- StreamBright 6y agoI agree. We need something like Firecracker and quick boot times and something like Bottlerocket (immutable os) as the host. That woukd help my workflows very much.
- m463 6y agoI was going to say container or vm, but maybe ... Are containers a hack that will go away as VMs become lightweight or will containers replace VMs? I run proxmox, and when I first set things up I used VMs, but over time I moved most server kinds of things to containers. EDIT: docker is a special thing - creating an entire environment from one Dockerfile is pretty powerful.
- mikewhy 6y agoI've been playing with this stuff on and off for the past few weekends, getting an environment set up on my M1 air. I ended up going with a VM, as it still allows (IIRC) the thin client to be thinner. There's definitely bits of containers I miss, like I'm back to keeping notes in a markdown file for commands that would be added to a Dockerfile, but I'm also not having to do weird things to get something like my shell history to persist.
- hiq 6y agoI started doing exactly that. I've been reluctant to contribute to nodejs (e.g. electron) projects for some time, because I just don't want to run npm on a computer with any kind of remotely private data. Lately there were just too many itches to scratch, so I went for a VM replicating my normal setup (dotfiles etc.), and I just use x2go, locally. Quick and dirty setup which is good enough when used infrequently. My ideal setup would probably be closer to https://blog.jessfraz.com/post/docker-containers-on-the-desktop/ https://blog.jessfraz.com/post/docker-containers-on-the-desk..., but it's more setup than I could be bothered with at the time. Maybe one day.