Disposable development environments

Status
Not open for further replies.

hanser

Ars Legatus Legionis
43,847
Subscriptor++
Some people here (myself included) have been interested in creating disposable development environments. For the uninitiated, that means treating your development environment like a random head of cattle instead of a beloved pet. Infrastructure as code all the things.

I've made some progress, but I'm primarily a Windows developer:

- All settings are versioned in source control: Visual Studio, EditPlus, Notepad++, etc. This was the really low-hanging fruit

- Chocolatey brings an apt-like interface for most of the applications I use. Most utilities are a "choco install foo" away, so that's nice.

That's not really disposable though. In a perfect world, I'd like to be able to hydrate a development environment in one step, and I just haven't gotten there, and I don't see a path forward, either, but maybe there's hope on the horizon(?):

- SQL Server is dockerized (or will be dockerized, AFAIK)
- Visual Studio will probably be dockerized

I don't know about the standard office applications--I use Excel heavily, e.g.--but I would guess at some point they'll be containerized. I'm also not sure if Docker supports GUI applications; at one point it was CLI-only, which begs the question: which parts of SQL Server are being containerized?

I'm really interested to hear if any of the Linux or Mac developers have managed to fully automate their primary development environment environment. If so, what technologies are you using? How hard was it to get to that point?
 

Apteris

Ars Tribunus Angusticlavius
9,590
Subscriptor
I have a passing interest in this topic. TL;DR at this point I'm not convinced it's worth the effort.


If you're willing to write and maintain a sufficiently complex installation script (Bash and Powershell, in my case), it's very possible to automate setting up your developer environment from scratch. But some issues with this approach are:

1. assuming the OS is in a clean and known state. As in, you can't assume that. How do you correctly install Maven if 1 to n versions of Maven already exist? How, also, if the version you're trying to install exists? How do you correctly set the environment variables if they've been set previously?

2. many software packages install themselves system-wide by default. I'm reasonably confident in my ability to make Java work wherever it's installed on my machine, but that doesn't apply to all software, e.g. VMware or stuff.

3. in a sense, my entire machine is my developer environment. My fish config helps me get work done. My local clones of hard to find (albeit public) code repositories help me get work done. My text files with notes on various projects, ditto.


Perhaps it's possible to set up Docker or another container technology in such a way as to contain everything you need, encapsulated, at native performance. But considering how seldom modern hardware breaks for me (work MBP has been running for 2 years with no issues) I'm currently leaning towards "just set it up, push your commits, and take back-ups".
 

ramases

Ars Tribunus Angusticlavius
9,017
Subscriptor++
Some years ago and a dead hard disk ago I've started to maintain most of the setup of my workstation's in a puppet[0] manifest that is just applied locally, sans puppetmaster.

I've used Linux professionally almost exclusively for over a decade, so don't expect any insight on how that'd work out on Windows. :)

I use it, together with a couple lines of glue bash, to provision the following:
* Installed Debian packages
* Local database setup: rdbms (hopefully psql, sometimes mysql, unfortunately) installed and databases/permissions created, sans content
* Create the directory hierarchy in my $home I'm used to use
* Check out my config git repo and symlink things like vimrc,bashrc,... into place
* Download the tarballs of a couple of proprietary software packages into the folder I'm expecting them to be
* Same for a couple of other packages that can't be easily acquired via apt

This gets most of the things there, yet some (like my desktop environment setup) are missing and I don't feel like incorporating that'd be worthwhile.

Funnily enough, this includes my IntelliJ config, since most of the custom, manually configured stuff is just fonts and colours. Project config is just read from the maven/gradle model anyway, as it should be.

[0] Why puppet? At that time, simply because I knew it from the ops job I've had to pay for grad school; Saltstack/Ansible already existed at that point, but hadn't really taken off yet.

assuming the OS is in a clean and known state. As in, you can't assume that. How do you correctly install Maven if 1 to n versions of Maven already exist? How, also, if the version you're trying to install exists? How do you correctly set the environment variables if they've been set previously?

apt-get install maven ;)

On a more serious note, for stuff that can't be handled via apt, I'm just using convention. Lets assume that maven was not available in apt, here's how it'd work:
0) Tarball is downloaded into ~/software (which is just the directory I've decided to use for all tarball-based installs in my home) and extracted
1) A symlink ~/software/maven is created that points to the extracted directory
2) All other stuff, like aliases and environment variables, just assumes that it'll find whatever version is in use under ~/software/maven

If I'd want to install a new maven version, I'd just have puppet download and extract it alongside to whatever is there into ~/software, and adjust the ~/software/maven symlink target.

That'd way, there's no need for downstream concerns to know the actual path, and therefore there's also no need to adjust it.
 
D

Deleted member 43669

Guest
I have a Puppet manifest which installs the software I use, dependencies, etc.

I'm moving towards Docker for running the "daemons" required to run the software I develop; RDBMS, RabbitMQ/Redis/etc. I only use it for runtimes I cannot get easily with my OS package manager (i.e. Python 2.6). Used to use Vagrant for similar purposes, but Docker's way nicer.

I would love to give it a whirl to get DC-hosted VM and run everything there *except* for the editor (I'm not a vim/emacs head- I prefer Eclipse); use sshfs/syncthing to work on my home folder locally so I have a nice local editing experience but even switching from one box to another is seamless (git is not enough- I don't want to have to remember committing halfway changes).
 

fitten

Ars Legatus Legionis
55,634
Subscriptor++
The best environment that I've used was when we had a development VM. Any third party dependencies, apps, whatever were installed on the master VM and everyone else got copies of it. We also had testing VMs, server VMs, etc. New hire? Just let them copy the VM and they're set. Developers can replicate a testing environment on their own machine. You can use snapshots to maintain several lines of work... different snapshot branch for different bugs, for example. Once the bug is fixed, checkin the code, delete all snapshots in that branch. It's great for 'what if', too, of course. Take a snapshot, make some changes, test it out, if it doesn't work, revert back to the snapshot. For my main development VM, I tended to have 30+ snapshots in probably 4 to 8 branches at any given time. The great thing about the VM, too, is that you start off with a clean slate. You don't taint your host with source. Start out each new project/bug/whatever with a snapshot from clean. The machine is always clean to start... missing dependencies are easy to find as are installations from scratch (just fire up a clean testing machine, install the software, and run... if you have any missing third party dependencies, you'll know about it quickly).
 
[url=http:/civis/viewtopic.php?p=32153515#p32153515:2q96sdpd said:
fitten[/url]":2q96sdpd]The best environment that I've used was when we had a development VM. Any third party dependencies, apps, whatever were installed on the master VM and everyone else got copies of it. We also had testing VMs, server VMs, etc. New hire? Just let them copy the VM and they're set. Developers can replicate a testing environment on their own machine. You can use snapshots to maintain several lines of work... different snapshot branch for different bugs, for example. Once the bug is fixed, checkin the code, delete all snapshots in that branch. It's great for 'what if', too, of course. Take a snapshot, make some changes, test it out, if it doesn't work, revert back to the snapshot. For my main development VM, I tended to have 30+ snapshots in probably 4 to 8 branches at any given time. The great thing about the VM, too, is that you start off with a clean slate. You don't taint your host with source. Start out each new project/bug/whatever with a snapshot from clean. The machine is always clean to start... missing dependencies are easy to find as are installations from scratch (just fire up a clean testing machine, install the software, and run... if you have any missing third party dependencies, you'll know about it quickly).

I don't know if I'd say it was the "best" environment I've ever used, but I've been in a similar situation before when I was consulting. Every developer was given a copy of a VM with SQL Server, VS, IIS configured etc (this was for developing an ASP.NET Application). Our dev boxes were not powerful enough to make it seemless, and we didn't have the IT/dev-ops/whatever support to make it as seamless as it could have been (the grey-area of licensing kept this from being fully supported or standardized, the other devs repeatedly didn't learn the lesson of making backups). I certainly see the appeal and would at least consider it if I ever become a decision maker on such matters.
 

foetusinc

Ars Scholae Palatinae
1,409
Subscriptor++
I've been working 90% in a VM (Parallels on MacOS) for several years now and I'd never go back. I can snapshot my dev environment before an update, or before trying some wacky idea. I can back the whole thing up by copying a single file to an external drive. I can reboot when things get cranky without shutting down other apps like mail or Chrome. I can stick a long build on my second monitor, flip the primary back to the Mac desktop, and do something entirely different while msbuild churns away. If my machine dies or needs replacing, I can just grab a backup off the external drive and be back in business in 30 minutes instead of days.

Our IT department is a royal pain to work with too, so being able to be completely self service with my dev environment and keep it off the domain (and out of their GPO settings) is a big bonus.

I am super excited for .editorconfig support in VS15, though. Working on different projects with different teams that have different ideas about things like tabs vs spaces or 1TBS will get a lot easier.
 

gregatron5

Ars Legatus Legionis
13,005
Subscriptor++
Anyone do this for Java stacks? I use IDEA, so kinda wondering how you would handle the IDE. Ideally, I'd run IDEA natively in OS X (for keybindings and prettier GUI, etc.) while connecting to the source in the VM, but I'm not sure the best way to do that. I'm doing some web dev now, too, so I have a similar question for SPAs developed via npm.

In the past I've used VMWare Fusion, but don't have a license for the current version. I have Veertu, but haven't really gotten into using it yet.
 

drogin

Ars Tribunus Angusticlavius
8,283
Subscriptor++
[url=http:/civis/viewtopic.php?p=32177615#p32177615:wc3kusoe said:
vafarmboy[/url]":wc3kusoe]Anyone do this for Java stacks? I use IDEA, so kinda wondering how you would handle the IDE. Ideally, I'd run IDEA natively in OS X (for keybindings and prettier GUI, etc.) while connecting to the source in the VM, but I'm not sure the best way to do that. I'm doing some web dev now, too, so I have a similar question for SPAs developed via npm.

In the past I've used VMWare Fusion, but don't have a license for the current version. I have Veertu, but haven't really gotten into using it yet.

Not sure what you mean by connecting to the source exactly, but pretty much all virtualization solutions have some form of "map directories" feature. So, the path /foo/bar/baz on the host machine shows up inside the VM as /bof/bif/baz or whatever is appropriate.
 

ramases

Ars Tribunus Angusticlavius
9,017
Subscriptor++
Usually the IDE and checked out repository is on my host OS as well, though I've sometimes had use-cases where there was a requirement that the code was only allowed to be checked out inside specific VMs. (in the later case, if you're lucky you're given a RDP session. If you are unlucky, you're given vnc or X-Forwarding over shitty connections and you switch to vim/emacs)

If the IDE/repo is on my host OS, I usually prefer something along the lines of the following, instead of mapping the folder:

Code:
./gradlew <targets> && scp <artifact> devvm: && ssh devvm '~/bin/redeploy.sh <targetEnv> <artifact>'
 

Apteris

Ars Tribunus Angusticlavius
9,590
Subscriptor
in the later case, if you're lucky you're given a RDP session. If you are unlucky, you're given vnc or X-Forwarding over shitty connections and you switch to vim/emacs
Ew. I hope that gig paid well.

If the IDE/repo is on my host OS, I usually prefer something along the lines of the following, instead of mapping the folder:

Code:
./gradlew <targets> && scp <artifact> devvm: && ssh devvm '~/bin/redeploy.sh <targetEnv> <artifact>'
I can see that working, especially if gradlew is called automatically. Me, I like shared folders because I don't need to do anything except start the application server after I've run my deploy job; the stuff is just there.
 

ramases

Ars Tribunus Angusticlavius
9,017
Subscriptor++
[url=http:/civis/viewtopic.php?p=32181255#p32181255:251qoj1p said:
Apteris[/url]":251qoj1p]
in the later case, if you're lucky you're given a RDP session. If you are unlucky, you're given vnc or X-Forwarding over shitty connections and you switch to vim/emacs
Ew. I hope that gig paid well.

It was certainly instructive on the finer points of human language, like the fact that the words 'well' and 'enough' represent orthogonal concepts in relation to 'pay'.
 
Status
Not open for further replies.