Skip to content

Latest commit

 

History

History
131 lines (100 loc) · 6.07 KB

README.md

File metadata and controls

131 lines (100 loc) · 6.07 KB

DevzBox

Batteries included, automated deployment of disposable dev envs based on Ubuntu 20.04

About

Currently, it's tested only for Windows because IMHO Win users have the worst dev experience so it's worth solving this first. It uses Vagrant as a platform to run and provision VMs.
VMs use NoMachine remote desktop to deliver blazing fast, low latency experience.
This is mainly for local usage with 16GB RAM+ but you can use it on remote dedicated servers with a lot of resources or big VMs too.

Without any customization it will spawn VM with:

  • Ubuntu 20.04 LTS Desktop upgraded to latest version
  • additional apt packages: make gcc g++ gettext-base pwgen wget curl
  • Golang from snap (automatically updated)
  • Node.js 14.x LTS from apt repo (upgradable with apt-get)
  • Docker from official apt repo (upgradable with apt-get) and docker-compose as a container
  • k8s cluster with
    • kind from go get
    • kubectl and helm from snap (automatically updated)
  • NoMachine remote desktop server exposed only via local network
  • JetBrains Toolbox with selected dark skin and no analytics selected, for easily installation and one-click upgrades of IntelliJ IDEA etc.

You can easily add your custom scripts to install in provision/custom

Setup

To use it, you first need to:

Windows

  • Enable Hyper-V - tutorial
  • Create Virtual Switch in Hyper-V and rebooted after tutorial
  • Install Vagrant - download
  • Install Git - download
  • Install gsudo (optional), just run this in Powershell without admin perms:
    PowerShell -Command "Set-ExecutionPolicy RemoteSigned -scope Process; iwr -useb https://raw.githubusercontent.com/gerardog/gsudo/master/installgsudo.ps1 | iex"

Usage

Create VM

With all prerequisites installed, just

  1. Clone and enter this repo
    git clone https://github.com/SystemZ/devzbox
    cd devzbox
  2. Copy template of VM and create your own VM with name like niceproject and enter it.
    cd vm
    cp -r _template niceproject
    cd niceproject
  3. Edit vm/niceproject/Vagrantfile to your liking. Probably you just want to uncomment some lines that are installing tools. There are !!! CHANGE ME !!! blocks in places that you should edit
  4. Start and provision VM
    # use Hyper-V on Windows
    # after launching you will be asked about Hyper-V Virtual Switch, just enter number with proper ID
    sudo vagrant up --provider=hyperv
  5. Wait until "Provisioning complete!" is shown, note your username vagrant and fresh random password for SSH and virtual desktop

Connect to VM

Remote desktop

  1. Install NoMachine (NX for short) and connect with it - download link.
  2. Launch NoMachine client on your main OS.
    Your VM should be visible after launching, just double click it to connect. Select "Change the remote display resolution to match the window" when prompted on first connect about "Display resolution". Change resolution will allow to resize your remote desktop freely as you please just by resizing remote desktop window
  3. Make sure that Windows isn't blurring your remote desktop by enforcing 100% scaling on NX player
  4. If you need even more low latency, there are additional graphic options worth noting:

    Hi,

    NoMachine automatically adapts to network conditions, so I wouldn’t change many of the default options. In particular I’d leave H.264 as it could leverage hardware encoding and decoding. In the Display settings panel I’d change display quality to max, choose to request 60 frame per second and select ‘Disable frame buffering on decoding’ along with ‘Disable client side image post-processing’. You may also want to disable UDP by clicking to Edit the connection and selecting Advanced settings.

    fra81

SSH

Protip If don't remember commands for Vagrant, check out this Vagrant cheatsheet

sudo vagrant ssh

Start VM next sessions after first run

Vagrant is quite slow as a CLI.
If you use VM mainly for remote desktop, you can skip Vagrant part for booting and just run VM itself from Hyper-V manager GUI or

# 
# VM name visible here is from Vagrantfile "vmname" variable
sudo Start-VM -Name awesomeproject

Password reset

TODO

Remove VM

Enter vm/niceproject and execute:

sudo vagrant destroy -f

Notes

Login screen on desktop can blink when password is accepted, just wait about a 30 seconds and you will be logged in eventually.

Maintenance

Update your virtualized OS as you would normally do.
Almost all apps are updated by apt.

Origin

After few years of Ubuntu usage as a main driver, author of this project moved to Windows due to a bunch of time wasted on dual booting for games and few apps like Adobe suite. Unfortunately Windows didn't offer everything I wanted, so I decided to make an easy-to-use VM factory to store complete dev environments for few separate projects that I work on.

With this approach I have support for all apps I need without dualbooting, and a power and flexibility of FOSS apps on Ubuntu. You just suspend or turn off VMs if you need some free time in games :) The only drawback are infamous Windows updates that can crash your OS, but fortunately I didn't encounter them myself.