Best virtualized environments for freelance web dev?



  • So I'm dealing with a common problem, and that is creating dev environments to match client environments. The projects are basically either clones of websites, or custom apps or scripts.

    I'd say 80% of the time, the environments are common, either a PHP 5.6 or 7.0+ web server using relatively late model Apache/Nginx and MySQL.

    But what I'm trying to sort out is:

    1. Unique dev environment for each client to hold their project.
    2. Ability to easily access this environment and do work from any location (at least 3; home, office, laptop/mobile).
    3. Ability to spec the environment to match the client's. Namely this would boil down to which versions of the web stack are used.
    4. Ability to package up and archive the projects, or spring them back into action if further work is ever needed.
    5. Provide limited access to the project into the public, for example giving client access to particular parts of the project, or a final build folder, etc. Ability to provide a public URL to let them test things out and see progress.
    6. Easy to maintain and manage. Starting a new project and choosing the environment shouldn't take a half day of writing scripts and configs and fooling around trying to get it to work. Backing them up, archiving, restoring, changing the environment even, should be easy to do.

    So this sounds like a job for virtual machines. Of course, something like Vagrant, VirtualBox, etc. But I have to wonder, just to get an alternate version of PHP and Apache, do I really require an entire virtual computer? I definitely don't want overkill as the solution.
    But I also want to be able to possibly work on multiple projects at once. If I can somehow have a PHP 7 project open over here and a PHP 5.6 project open over there, without conflicting between them. So they MUST be virtualized somehow into a container, but I do wonder if it must be the entire virtual hardware and operating system. But maybe it should? One client might be on CentOS and one on Ubuntu, so that has to be taken into account.

    I know that hosting companies now let you do things like switch PHP version on a per folder basis, but they still share the same on the rest of the stack.

    I also want this to be portable, as mentioned, so doing Vagrant on my home desktop doesn't really help if I want to work on my laptop at the coffee shop.

    But then you might say, the Vagrant config is portable, so store that in the cloud somewhere, then you can just pull it from the laptop and create the VM. Yes but then I also need to pull the data too. So maybe the data within each VM also is sent to a Git server and then I can pull and push to my heart's content and pull and push Vagrant configs and bla bla.
    This is not sounding fun.

    I could move the entire thing to the cloud. Use VULTR or similar and just pop up a new box for every client, then use a provisioning service or something to get the correct stack of tools installed.
    This way at least I could access it from any computer. But doing the backups and archiving and remote access to client and everything else. Still a pain to do all this manually on a fresh VM.

    So then there are provisioning services that go in the middle of me and my VPSes. All the ones I've seen cost a bit to use.
    If I'm going to create this entire unique environment for each client, I can't be spending hundreds a month to manage each one. Nor spend anything while the project is idle, archived, etc.

    There are other technologies like Docker and Bitnami and non VM type container systems, but I don't know if those are just for apps, or if they contain the entire LAMP stack. And even so, it has to meet all the other criteria.

    So that is what I'm researching, how to create containerized environments for client projects without a ton of complexity, or being locked to a particular workstation, etc. With the main goal being to match their production environment, create separation between projects, and manage active and inactive projects, backups, and archives that can be activated again for future work. And provide client some degree of access for testing and pulling out the assets when finished.



  • I think containers are probably what you'll want to go for. Set up a Linux VM and use Docker or LXD for the containers. There are ways to make them persistent so that things like your /var/www/html folder in the container doesn't get wiped to nothing when you reboot your VM. That goes beyond my realm of knowledge though.



  • https://mangolassi.it/topic/12641/understanding-state-machines-for-devops-style-system-administration

    I'm not well versed in either SaltStack or Ansible, but this sounds like a perfect use for them. There are tons of guides if you search tags for "ansible" or "salt"







  • VMs make sense to me. Whether you do this on the desktop with VirtualBox or a server with KVM or LXC, whatever works. But you don't want a million versions of things installed onto ap hysical box and the pain of things interacting while you test.


Log in to reply