Surprise!
I genuinely did not plan on making my first ever open source contribution today. In fact, I didn’t plan on a lot of things happening this week at all. I recently got an awesome opportunity to work on a site that is being hosted on a platform called Pantheon, which I had not come across before. They’re an opinionated platform, meaning you need to adhere to their workflow in order to maintain and develop on the platform.
![Photo by Michael Giugliano Pantheon Roman Temple in Rome](https://mattjones.tech/wp-content/uploads/2024/02/2928046.jpg)
The Lead In
Luckily enough, I agree with Pantheon’s opinions about workflow and pipeline, so it’s been a really exciting platform to learn! However, I will say the biggest downside of being introduced to the platform was the fact that it just so happened to be during an emergency, and we were in a situation in which we needed to restore a backup, and a rather large one at that.
According to the official Pantheon documentation, one of the requirements to restore large sites from a backup is to use their own proprietary command line tool called terminus
. I enjoy learning some new command line tricks as much as the next guy, but under stressful situations, it’s not as fun. As I was looking into all the steps required to install terminus
and get it up and running, there were quite a LOT of prerequisites. Most notibly, it doesn’t run natively on Windows. (This is only a bummer because my work computer is Windows. Otherwise, I’m Linux everything anyway, so it’s no big deal, Linux is actually preferred.)
I just so happened to have spent some time setting up Windows Subsystem for Linux (WSL) just a few weeks before, so I actually had a great foundation to be able to start making my way through the install process. According to the README on their Github repo, the install for Ubuntu/WSL is “TBD”! So definitely concerning. Long story short, I was finally able to compile all the requirements scattered throughout the web, various Pantheon docs, GitHub issues some years old, and other visits to StackOverflow, you know how it is.
The Need
That was a few weeks ago. Now I’m in a situation in which I’m guiding a coworker through this same exact process, trying to remember all the tricks and commands and ‘gotchas’ all along the way. After spending another hour and change getting my coworker set up, I knew I’d likely have to repeat this process for new coworkers in the future. So in an effort to help myself and other devs, I decided to write a shell script that would install all the dependencies and set up all the required files and permissions exactly so terminus
can run properly. (Why doesn’t this exist already?) Who knows. Doesn’t matter. Point is, I have a script I can use to install this tool quickly and easily without taking tons of time and running dozens of commands.
What I’ve learned
In going through this process, I ended up learning the importance of the &&
operator in bash scripting. This operator will only execute the code after it IF the code preceding it was successful. This is a great way to stop the script mid-way if something goes wrong or there’s an error somewhere.
On more of an “impostor syndrome” note, I’ve always been extremely intimidated by contributing to open source code. I’ve always assumed that everyone on GitHub is basically a rocket scientist and any pull request I make will just be laughed away and probably banned somehow… StackOverflow vibes? That. But I’m really glad I was able to come up with a script that can really help save myself and my coworkers’ time. At the very least, that’s enough for me. If my pull request get merged, that’s just icing.