All-in-One Gaming, NAS, Docker with UnRaid

All-in-One Gaming, NAS, Docker with UnRaid

How did I chose the on-prem setup?

Although I ply my skills in the data science space, I think being a well-rounded, self-sufficient computer expert is a neccessity to stay ahead of the game. One way I stay ahead is to run my own server to find the latest techniques and get my hands dirty. I am also into fast-twitch FPS PC games, so I have some good gaming hardware and wanted to maintain the performance. We travel a lot, so I needed to find some way to make these happen with a physically small footprint. I had a few options:

Option 1 - Cloud Computing

Perhaps one of the more obvious and future-forward options is to do everything on the cloud! This was very appealing since we push our clients this way. However, I chose against cloud because of

  1. High Cost. Although AWS Calculator shows nominal individual costs for stoage, compute, and other resources. It's prohibitively expensive to maintain 24/7 access to a wide range of services.
  2. Lack of Flexability. It is much easier to play around, forget about, then re-learn tools and techniques when it's on your own hardware.

Option 2 (my choice)- On-premises hardware with UnRaid

I already had fast hardware and large drives, so I wanted to take advantage of that without further monthly costs of cloud. There were quite a few options for on-prem hardware and software, most of them revolved around simply hosting files. I entertained the idea of FreeNAS but ultimately found it to be a bit limited especially compared to my ultimate choice, Lime-Technology UnRaid.

UnRaid features

UnRaid has diverse offerings, most of which the others did not offer:

  • NAS (Network Attached Storage) - This involves combining storage (typically TeraByte-size hard disk drives) and hosting volumes for sharing files with devices inside the home network. High-end options allow for some failover with parity, mirroring, or other backup methods with or without a RAID setup--this is probably where UnRaid gets its name, because it is not a RAID setup- more on that below.
  • VM (Virtual Machine) - This ability allows hosting one or more operating systems on a single hardware structure. This allows one to allocate different amounts of CPU cores, various amounts of RAM, and other resources such as USB devices and graphical resources. Unraid does something unique and allows assignment of complete resources, so, say an entire GPU can be allocated at the hardware level giving full performance
  • Docker- This one was new for me when I started, and I have become a big fan. Docker is similar to VM in that it allows virtualization but goes so much further. It has operating-system-level virtualization called containerization that allows configuring, duplicating, sharing, etc. of entire application stacks. In this way, one installs a stripped down Unix base image (usually something with CentOS or a variety of very small footprint installs), configures all necessary software which usually involves Ngix or Apache for a web interface, and configures a base application like MySQL (or MariaDB) that is ready to use out-of-the-box. These are typically single-use images so that if you wanted to install a web application like Wordpress, you would install the Wordpress base Docker container and install separately the MySQL container for that Wordpress. This allows easier configuration and makes it more error-proof, since one container can go down without bringing down everything else.

My UnRaid Setup

You can see my UnRaid stack below:

  • Bare Metal Rig - Contains a 4-core i5 (early model), 16 GB of DDR3 RAM, Nvidia 1070 EVGA FTW (use it for 4k gaming!), 500 GB EVO SSD, and three 2 TB Seagate HDDs.
  • UnRaid OS - Mentioned above, includes the NAS, Docker, and VM. But breaks down into a numer of components:
    • Volumes - includes the NAS and file sharing component. This works with 4 TB available to share, and the remaining 2 TB is used as a parity drive for disaster recovery. I opted for this because even if one drive goes down I still retain all of my data, either on the 2 data drives or by recreating the bad drive from the parity.
    • Docker Containers - This is my fleet of containers. I have a Ghost container for this blog, Nextcloud for my home backup and phone photo auto-uploading, a Wordpress container for giggles, and two MariaDB (MySQL) containers one for Nextcloud and one for Digikam photo management software installed on my workstations. Forgot to include one more- I have a container to update my IP address.
    • Windows 10 VM - This is my gaming machine. I have allocated 3 physical cores to this machine, leaving 1 for UnRaid/Docker/NAS, given 400GB of my SSD, mounted the entire GPU, and shared a volume for large game file storage. This has given me near bare metal performance. More on how I set it up below.

Hoes UnRaid work??

UnRaid works on a Debian OS, MergerFS for pooling disks, SnapRAID for the parity drive, and Docker for the containers. Read the Perfect Media Server article for the whole setup--it's so impressive. I opted to pay $60 for the Lime-Tech UnRaid license to use UnRaid and am very happy with the choice.
UnRaid installs as the base OS and works as a headless server. This way I just press start and forget about it. I SSH into it for special configuration but use the web interface for day-to-day tasks and monitoring including installing containers, managing shares, etc.

Using Windows 10 VM as a Gaming Machine with UnRaid - Bare metal performance

I had a hard time believing it, so I needed to try it myself. I get near-perfect performance running my Win10 VM with the above specs as I do using it as a whole system. I got my computer set up thanks to many online resources which I will share:

  • First - you have to check out this multi-user gaming machine article. It shows how, with UnRaid, you can install 4 GPUs on an i9 10-core system with 64 GB of RAM to let 4 Win10 VMs each have a VR headset to play video games. They assign 4 logical cores, 8GB RAM, and 1 GPU to each instance.
  • UnRaid video guide showing how to do the entire setup. I skipped the physical install portion to get to the meat of the setup.
    • Tip: In your BIOS, set your onboard video as the default so UnRaid OS will use it, leaving your discrete video free for the VM environment
  • An issue I had was there was no USB controller to pass through to the VM - UnRaid OS had claimed them all. This post saved me - UnRaid pass through USB controller for keyboard and mouse.
    • Tip: I had to add a line to the UnRaid syslinux.cfg file. It make my keyboard and mouse unavailable to the UnRais OS, but since it's headless it doesn't matter. I was then able to assign the controller to my VM. The line is vfio-pci.ids=8086:a12f where 8086:a12f is the vender ID of the onboard USB port, which can be found in the UnRaid Tools > System Info.

After all the setup, it works like magic. I hit the Power button on my computer, it takes a minute to boot into UnRaid, then my Win10 VM auto-starts and boots. I have full control on my keyboard, mouse, and monitor just like any normal workstation! I leave the computer running 24/7. My Win10 VM has crashed a few times, but it was mostly due to running out of memory in the UnRaid OS because of large Docker containers (GitLab!!). I fixed it by allocating 10 GB to the VM and didn't notice a hit in performance. Though, I have since dropped a local GitLab CE in favor of BitBucket and am back to the 12GB VM.

Final words - You will love it

The whole idea here is that you can have your NAS and gaming machine on the same hardware. This allows you to double-down your money on one set of hardware to maximize its capabilities without sacrificing performance.