This may be the coolest thing that I have ever built. As a web developer one of the most challenging things can be getting a nice dev environment setup. I have a local dev environment setup on my laptop using Vagrant and it is nice. However, I wanted to have something that I could use anywhere even if I didn't have access to my laptop.
The Pi Zero was the perfect solution!
Note: This is NOT a copy paste how-to. It is an overview. I will include reference articles thoughout that I used during the setup.
I have converted the Pi Zero into a mini dongle computer. I got the inspiration for this project by watching this video.
I really didn't want to mess with soldering so I went to Amazon and found everything I needed.
Parts List:
Setup:
- Install Raspbian Buster to SD card
- Follow the steps 3-4 on this video.
- Assemble Add-on board/case
- Insert SD card
- Plug into laptop
Depending on whether you are on Windows, Mac, or Linux you may have to install drivers. Since I am on Linux I only had to tweak the USB Ethernet settings to "Link-Only" and I was up and running. I haven't been able to get the setup to use the host machine's internet connection so I also had to enable Wi-Fi on the Pi Zero.
At this point I had a mini dongle computer that I can SSH into using the following command.
ssh pi@raspberrypi.local
For the dev environment I simply installed a basic LAMP stack. I didn't want to deal with any "/etc/hosts" settings so I put all of my web projects into directories inside the "/var/www/html" directory. Now I can visit each site using the following URL structure where "My-Awesome-Site" is the website's directory inside "/var/www/html". Check out this tutorial on installing a LAMP stack on a Raspberry Pi. (Build a LAMP Web Server with WordPress) Just skip the WordPress specific stuff unless you would like to set that up as well.
http://raspberrypi.local/My-Awesome-Site
I took things one step further and created a custom "project list" page so I could easily access all of my projects from a single page as well as many other tools that I use during development.
Since all the projects are setup in GitHub this is truly a portable dev environment. I can just plug it into any computer and I have a full dev environment on the go.
Updates:
I have created a new Dev-Dashboard build tool for setting up a RPI Powered Portable Dev Server. It can also be used to create a similar setup using Vagrant. Check it out here: Dev Dashboard Build Tool