home
themmj.dev

setup-helper

Repos:

intro

One trap programmers fall into is developing a tool/solution for a problem just because they can. Just a bit more research for existing solutions could have avoided a few hours of feverishly gobbling together a file format with a corresponding parser and code generator in bash.

basic idea

Track the whole set up of your system in a single config file. This includes directory structures, cloned repos, installed apps, enabled services, environment variables etc.

Platform tags allow different install instructions, apps etc. depending on the current platform.

Based on the selected platform the helper will parse the config file and generate a single bash script in a temporary folder. This script is executed if and only if the whole config file was parsed.

limitations

There is no form of syntax assistance or consistency checker. That means as long as the parser does not complain it will just execute what it has created. Since this may involve setting up folder structures and updating .env files this can really screw with the system in case of any config issues.

Although the platform tags are great in theory, maintaining it is a whole different story. Especially considering that there is no option to only execute parts of the config.

Errors during final script execution may get lost in command outputs. Not that it would give any advantage, since you cannot just retry parts of it.

alternatives

There are many alternatives for this exact problem. The one I chose for future endeavours is ansible.

summary

Despite all the shortcomings, it was still a fun project to get lost in for a few days. It even proved useful when migrating machines. It also gave a new sense of appreciation for the existing tools and their features.