Forking and Interruption in ZIO
Introduction I recently encountered a bug in my application that caused it to hang during startup. The only change made was upgrading ZIO from version 2.0.x to 2.1.0. After some investigation, I discovered the issue was related to how I was forking fibers and a change in the behavior of Reloadable introduced in the new version. Let me explain what happened because I was very much surprised by the unexpected change....
Automatic Rebase of Last Commit in Git
Introduction I often find myself in the situation where I have just pushed a branch with my changes and created a pull request, only to later realize that I forgot to add a file or made a typo in my code. In such cases, my goal is to make a small change while maintaining a clean Git history, so I opt to rebase the last commit to essentially hide it. Of course this wouldn’t work if there was a chance that someone already used my branch or I cooperated with someone on it....
Multiple SSH Keys for Git and Using 1Password SSH Agent
You might have the need to use multiple SSH keys for your Git repositories. For example, you might have a personal GitHub account and a work GitHub account. I got to this exact situation and this is how I solved it. I presume you have two different SSH keys stored in ~/.ssh. You can use the combination of core.sshCommand setting and includeIf conditional include statement to achieve this. You can set your personal SSH key as the default one and then override it for your work account....
"No More Orphans" in Practice
A few weeks ago, I came across a tweet from Jakub Kozlowski that caught my attention. It linked an older blog article from 7mind called No More Orphans, which describes a pattern for achieving two vital goals in libraries: comfort of use and avoiding dependency hell. Specifically, I am talking about providing instances of typeclasses, such as JSON serialization. The best approach is to provide these instances in the companion objects of your types....
Running Scala Steward On-premise
This blog post was originally published at Avast’s Engineering blog. Scala Steward is a bot that helps you keep your project’s dependencies and SBT plugins always up-to-date. It is a very useful tool because the world of Scala is evolving rapidly and it can become quite hard to keep up with all the updates. And most of the updates are just small so it is worth the effort to automate this process....
Scala Server Toolkit – Creating HTTP Server
This blog post was originally published at Avast’s Engineering blog. In the previous post I introduced and explained the rationale behind Scala Server Toolkit. Today I would like to continue and get into more detail of some of the offered modules. Getting Started Our goal is to initialize and start a simple HTTP server using http4s. There are four basic things you will need in order to achieve that:...
Introducing Scala Server Toolkit
This blog post was originally published at Avast’s Engineering blog. Today I would like to introduce a new project called Scala Server Toolkit. In short it is culmination of years of Scala server development at Avast representing the best practices we have gained. We decided we want to share it with everyone because we believe it could be very useful not just to us. Let me describe to you the genesis of this project, the rationale behind it and show you what it offers....