I’ve got an application that I’m trying to snap, and it requires using PostgreSQL. I’m wondering what the recommended way of using PostgreSQL is for the snap. I see that the maas snap used to bundle PostgreSQL, but has removed that functionality: https://github.com/maas/maas/commit/b469e56
Is including PostgreSQL as a service in the snap no longer a recommended method, then? Would it make more sense to require the user to install PostgreSQL separately and configure the application that I’m snapping to talk to it?
This is a philosophical question. It completely depends on your vision for your snap. Consider your snap as a standalone product. You’re in complete control of the user experience. What do you want it to be?
If it helps, let me walk you through my thought process when I created the Nextcloud snap and decided to bundle MySQL with it instead of requiring that a database be installed and the snap configured to use it. I asked myself “Who is my target audience?” Did I want to target power users? Did I want to architect things to enable HA, or a scale-out architecture? No, I wanted to target home users, small business, and other folks that don’t have an IT department to maintain this thing. That turned my priority for UX into “as simple as humanly possible.” I wanted the snap up and running as soon as it was installed. As a result, I decided to bundle the database so I didn’t require the user to then go through the process of configuring it before it was running.
As a trade-off of this simplicity though, I sacrificed scalability. The Nextcloud snap is not architected to be HA in any way. You can’t set up database sharding, etc. I think kubernetes or juju would be a better fit for that type of architecture anyway.