Scripts that utilize multiple files are not easy to distribute. We usually distribute those as archives and rely on the end user to unpack and run them from a predetermined location. To improve the experience we can instead prepare a single script with other files embedded inside it. Here are the goals: The first requirement … Continue reading "Bash Tips #6 – Embedding Files in a Single Bash Script"
Read MoreCategory: DevOps
Bash Tips #5 – Parallelism using xargs
Running things in parallel in bash scripts may seem like a difficult task, but thanks to great utility programs that are available out-of-the-box on most GNU/Linux distributions it is not. In this brief article, I would like to focus on using xargs to run operations in parallel in a convenient manner. This is an approach … Continue reading "Bash Tips #5 – Parallelism using xargs"
Read MoreBash Tips #4 – Error Handling in Bash Scripts
There is no single way to handle unexpected behavior in our bash scripts. By default, bash simply ignores any failed calls and proceeds with the execution. Therefore we have to explicitly implement behavior that would help us handle such events. I would like to present a few simple techniques that can be used in these … Continue reading "Bash Tips #4 – Error Handling in Bash Scripts"
Read MoreBash Tips #3 – Templating in Bash Scripts
Software deployment systems such as Ansible or Puppet come with a templating engine to help us create and manage configuration files. Such functionality can be also achieved using bash. It might not be as easy to use or feature-rich, but it is a mechanism that can be useful when you cannot or choose not to … Continue reading "Bash Tips #3 – Templating in Bash Scripts"
Read MoreBash Tips #2 – Splitting Shell Scripts to Improve Readability
Codebase grows over time and so do shell scripts. Those usually start small and serve a single purpose, but new features get added, unforeseen situations are handled, and suddenly shell scripts have hundreds of lines, losing readability in the process. From what I have observed when collaborating with other developers, it is in our nature to … Continue reading "Bash Tips #2 – Splitting Shell Scripts to Improve Readability"
Read MoreBash Tips #1 – Logging in Shell Scripts
A visual indication of steps performed by a shell script not only improves the experience of the user of the script, but a well detailed log helps to debug any problems that could occur and to confirm that the script performed the operations correctly. Introducing a proper logging to shell scripts can help with that. … Continue reading "Bash Tips #1 – Logging in Shell Scripts"
Read MoreSpring Tips #2: Layered JARs with Spring Boot 2.3
Sample code referred in this article is available on GitHub. Using Docker containers for deployment of Java applications becomes more and more popular these days. To ship a new version of application you just build a Docker image with new version of JAR file and push it to the repository, so the deployment team can … Continue reading "Spring Tips #2: Layered JARs with Spring Boot 2.3"
Read MoreAnsible – from tasks to roles
In this post I am going to introduce Ansible roles and walk you through a process of iterative refinement of an Ansible project. The goal here will be to automatically deploy and configure a simple repository serving static files. I will start from a playbook with multiple tasks and slowly build towards a better, more … Continue reading "Ansible – from tasks to roles"
Read MoreIntroduction to automated provisioning and deployment with Ansible
In this post, I am going to introduce one of the tools which we use here at Tratif for automating software installations. Most of our projects written in Java require a lot of third party services to function (e.g. MySQL, RabbitMQ, Redis). This imposes a mandatory installation step to be performed before we deploy our … Continue reading "Introduction to automated provisioning and deployment with Ansible"
Read More