Making It Easier To Add New Apps!

Share

The most recent major change to Nassella was to refactor (re-do) the way end-user apps (like NextCloud, or Ghost) are added to Nassella. The original way I created for adding apps worked but was very tedious and error prone. I always start out by just doing things the straightforward way instead of trying to abstract them from the beginning, so this was not unexpected.

But generally once you've done something a few times you have a much better idea for how it "should" be done, and this was no exception. Previous to this update it could take 1-3 days of work to add a new app but after the update I was able to add support for Wordpress in just two hours. And since adding Wordpress I've already added three more apps!

The work is not complete as I mostly focused on improving the "low level" aspect of adding new apps, but I did not significantly change the way apps get added at the web app level. Well, I did move the apps to their own normalized table, which was a huge improvement over the hard-coded column names, but otherwise the UI specification and config variable generation code is still very manual. I'm OK with that for now as the "core" of it is greatly improved and I started work on a config file format that the web app can read to generate or enforce more constraints later on, when I get more time to work on it, and it seems worth the effort.


If you are interested in the more technical details, then feel free to keep reading, but otherwise that's the update!

As far as how I did this, it was mostly a matter of moving files and Makefile code snippets around. Previous to the update I had one giant Makefile with all the rules for all of the apps. To make the process better I made it so the main Makefile no longer has any app specific rules in it. Instead, the main Makefile imports Makefiles from each app's specification folder. This way everything about how to run or configure an app is isolated to its own app specific folder. It took some learning of how to do some more things with 'make' but it wasn't too bad and it feels quite elegant now.

I did the same thing with the Caddyfile. Previously, the load balancer used a Caddyfile that was hard-coded with all of the supported apps. Again, I refactored it so each app specifies their own Caddyfile snippet and the main Makefile is responsible for combining them all into the final Caddyfile that Caddy will actually use.

Another huge improvement was that I added app configuration versioning. Now everything about an app is also isolated to the specific app version that is targeted. The main Makefile just specifies a way to extract only the user's selected app version before executing all of the app specific rules. This will make updating much easier since you no longer have to worry about being backwards compatible at the config level. And, of course, this will eventually enable Nassella to offer the feature of being able to select which app version you want to use and even hold back on updating an app if you would like.