Hello to you all, this is my 1st post, 1 of many, I hope. The idea of this post is to share my experience and my thoughts regarding the web development with the help of Linux and why it might be the best option.
The point of this post is to capture the main idea and the reasoning behind it, I’m suggesting you to Google the terms you are not sure about. I want to introduce you to WSL and its capabilities. Realistically speaking it’s not the introduction nor it is a full explanation is just a summary of my analysis for you to look into further for yourself if you’re interested in that kind of information.
Nowadays (and as it always been) web is deeply tied to Linux operating system. Servers that handle the requests of your browser when you surf the internet are built on Linux not without the reason. It’s just what these types of systems are very good at. Although Apache, Nginks and other servers work well on Unix based type systems, it seams that is not the best thing for the blind developers. In fact, I thought to completely switch into Linux (Ubuntu to be specific), but there was one thing that stopped me completely. I played with Ubuntu for quite a bit until I realized that screen reader called Orca is not as good as we have those on Windows (NVDA and JAWS). Surfing the net, navigating various GUIs looked quite slow to me and as a matter of fact it would slow me down as a programmer, because in a company what actually matters is your knowledge, skill and speed. It is important for a very simple reason – you have to ship the code and do that on schedule that’s planned for you (at least that happens when you’re working according to Agile / Scrum principles). You might think oh, what’s the problem of not being able to work on Linux environment. It sounds like you can install all the tools directly on Windows OS (I mean Apache, MySQL, PHP, even Docker with Docker Compose, Kubernetes, GIT and so on and so forth… Huh, actually you can, but sometimes things do not fit together just like that. I think the simplest explanation could be just one word, – configuration. Companies configure their environment and organize their development workflow to be as similar to the production environment as possible to be able to maintain all the services and write the code without worrying about inconsistencies. For example, if you write code in PHP on Windows, capitalization doesn’t matter, you might use backslashes for your paths instead of slashes, some libraries might work on one and don’t work on another system and there are plenty of other problems that can kick in and you get stuck.
I was looking for a good solution quite a long time and my first discovery that could help was the virtual machines. I can actually run a virtual Linux machine on my Windows computer and start Orca screen reader from there. I thought that I’ll do all the browsing on my Windows and write and test my code straight on Linux so I can be faster at browsing and Orca will be needed for coding only. Yeah, it might sound nice, but actually I even struggled with a proper integrated development environment (IDE) which is really important for every developer to be successful.
Secondly, switching between two operating systems like that is not so easy. For the sake of completeness, I must say that loading virtual machines is really resource heavy operation in terms of processor and RAM, sharing resources between 2 operating systems might be a nightmare due to totally different per missioning systems, file handling and so on. So, without longer exploration, I through this idea away!
Then I discovered Vagrant. This tool really saved me plenty times in the journey of a development. Basically, Vagrant is an abstraction layer for headless (without GUI, just terminal) virtual machine management. Usually when you’re dealing with virtual machines, you need to install software that handles all the process and virtualizes stuff behind a scene for you. Such a software might be paid or free (it depends what you actually need), but the really famous for such tasks are VMWare and VirtualBox. Well you can learn how to manage your virtual machines at the software basis (I mean how to manage VMWare or VirtualBox machines), but Vagrant just simplifies these tasks by providing command line interface (CLI) and giving you a vagrant file configuration file, where you can set up your environment by forwarding ports, making a static IP for your guest system (host system is the one your PC runs on), takes care of shared folders for you (it lets you to specify a folder on Windows in which you will put your files that they would be accessible from your Virtual machine, aka Linux environment or in other words – guest machine). When you think of it, this is quite simple to catch on. You put some new file to that specified folder and Vagrant just does the job to let your Linux VM to know about it (I think it copies it or does some other magic anyway). That way you can write your code on Windows with your favorite IDE and execute it on your Linux environment. Since web typically related to the servers, Apache or Nginks can serve the content / output for you and with the proper setup you can access your web apps from you Windows to test how they work.
It seams quite a good way to deal with OS, but I knew that company that I was planning to work in uses a Dockerized environment and there was a pain to my head again, because I didn’t know about containerization and Docker images. Actually, that environment is quite tricky to set up (even if it’s only on Linux, because it is Vagrant we’re talking about), and here again, is the Docker. I thought to install Docker on Windows and build that project I needed to work on, but since my colleagues didn’t know Windows at all, they suggested me to install Docker on the top of Vagrant, which is as you remember, on the top of Windows. I thought that might cause a lag, but it actually didn’t. So, everything ran smoothly enough, but of course we spent great deal of time to make things work. Actually, sometimes weird issues had happened, for instance you restart your PC and port forwarding just fails. After few failures I discovered that I should not completely shut down the VM system, there’s enough to suspend it (let’s say switch it into hibernates mode). I access all the Linux machine and my Docker through the terminal by utilizing the power of GitBash on Windows. Since it has ssh (secure shell) connection, I can control my Linux on Windows with my favorite screen reader (which is NVDA in my case).
I didn’t stop here, because by the year ago, I found out about WSL (Windows subsystem for Linux) technology. First version of this fantastic thing was only an abstraction mechanism that actually imitated Linux and that caused many problems for developers, because if Microsoft doesn’t release an update for some specific thing, like POSIX functions for instance, you get compilation errors in your app. However, those days are over!
Quite recently Microsoft released WSL 2, the second version of a Windows subsystem for Linux! Why am I sound so excited about this? The answer is pretty simple, it finally has Linux Kernel instead of imitation. It uses Hyper virtualization technology to run Linux alongside Windows, so basically Linux is lightweight virtual machine that you can control on your Windows. It was made especially for a developer, because Microsoft knows the benefits of creating apps on Linux. You can choose the distro you want, for me Ubuntu just works so I didn’t even bother to install any other distro, but you definitely have a choice here. I control that Ubuntu through a terminal and that bash just works without problems.
Since Windows and WSL are both Microsoft products, they really know how to achieve good results and WSL 2 is fully integrated with Windows, as such, you can access all the Linux files directly from Windows and vice versa. You can even make yourself comfortable with virtual hard drive (as a network location) to quickly access your Linux distro on your Windows Explorer app and open files with whatever you want including but not limited to Notepad, Notepad++, Eclipse, Visual Studio Code, and so on.
Since finally it is modified, but true Linux we’re talking about, there’s no problems with file permissions and other things that could be an issue before WSL 2 came along. But wait, wait, where is Docker? It is so important!
Finally, since WSL 2 uses Linux Kernel, all that you need to do is just install Docker on Windows, check the checkbox that it would utilize WSL and you can access Docker and Docker Compose directly on your Linux machine, because here Docker works as a client through CLI to control real Docker on your host system (Windows) and then leverages Linux to run your containers, it is powerful and much faster than it was in the past.
So, I hope you enjoyed the content, and it was useful to you. Here at TechVB we suggest to all readers to give feedback by using contact form or suggest new ideas, that way you are contributing to the TechVB content.