Manage External Services with pifpaf

Learn to manage external services with pifpaf.

If writing shell scripts is not your favorite pastime, rest assured you are normal. The error handling in this kind of script is often wonky, the verbosity painful, and the tools available to help to build your workflow are very restricted. So while shell scripts are handy to use and write, they are a pain to maintain. They can become way too convoluted to handle.

Therefore, this chapter will include some shameless promotion of a tool I started to write a few months ago and that I use in many of my applications nowadays to facilitate integration testing. It is called pifpaf.

The problem that pifpaf solves is precisely the one covered in the previous lesson: how to start and stop systems needed to test integration with your applications.

pifpaf is a command line tool that allows starting any daemon from the command line, without having to set it up on your system, nor be an administrator. As long as the software is already installed, pifpaf is able to start it. For example, to start PostgreSQL, you can just run pifpaf run postgresql.

To run pifpaf in the terminal provided below, click on the terminal and wait for PostgreSQL to install. Then, run eval `pifpaf run postgresql` . Run echo $PIFPAF_URL to see pifpaf URL and psql to launch PostgreSQL.

Get hands-on with 1200+ tech skills courses.