Tuesday, February 9, 2021

Dev environment in GitHub (Not codespaces)

After scripting my dev machine setup, naturally, my next aim became scripting specific application environments. Below are some reasons

Why we need to script out per application environment?

  • Different applications require different SDK versions, prerequisites. Making sure all apps are using the same version is time-consuming. 
  • Setting up the environment for one app to run may make another app fail.

The obvious answer I came to is containerization. The next question is where to run the container. It is GitHub codespaces. But it requires an invitation or we would be in the queue. So the next place is my own machine.


Finally ended up following multiple blog posts mentioned in references and reached to get it working. First I made my Hugo based personal website containerized. Below is the link to 2 files that are required to containerize.


One easy thing now in VS Code is an extension called "Remote Development" that packs multiple extensions required to run dev containers.

Hot reload / live-reload issue when using WSL2 backed containers in Windows

The problem I faced with this is the hot reload/live-reload is not working by just following the tutorials. This seems a known issue. One of the answers I have seen is to keep the file also in the Linux system. Another workaround people are suggesting is to use WSL1. 2 more are there. One to increase "fs.inotify.max_user_watches" property and the last one to use polling instead of subscribing to events to do hot reload.

More details can be found in the official documentation below.



I am yet to test all those workarounds.



No comments: