How do I Handle Updates

So I’m packing my (open source) LAMP app as a snap (upon request) and so far I’ve just about mangled the “classic” Nextcloud example into building my app

My Actual Question
Because im a special kind of special I didn’t use a framework with lots of nice DB upgrading tools (thanks 20 year old me)

So as a result typically when I release an upgrade Ill put in the UPGRADING.md something like this

cd /var/www/LxdMosaic

git fetch

git checkout v0.7.0

npm i

composer install

mysql < sql/0.7.0.sql

systemctl restart apache2

and people run it manually :face_vomiting:

If I have a “only current version and previous version are supported” policy can I just dump these commands into my “pre-refresh” hook - assuming I make sure the scripts don’t fail if run more than once ? (Each version changing the commands in the pre-refresh hook)

Side Track / My “Developer” Expeirence Drivel
Im not a hater - I get what your trying todo, it just hurts trying to do it

Please documentation writers bless me us the universe with a LAMP stack example that doesn’t involve compiling Apache & MySQL is it 2004? Its crashed my machine so many times building MySQL + its increased the build time to 11 minutes (normal install script (using apt repos) in LXC container is 2/3 minutes) - I am aware of the clean some-element-only -s part but its not always possible (I.E trying hooks out - 11 minutes to test a pre-refresh hook because you have to rebuild is odious)

For comparison of time & energy drain - I spent 2 days learning cloud-init before I could build my bigger app with it - I spent 4 days building this and am to “scared” to bump it to the stable channel because I don’t really understand what Ive made ?

For comparison of size, the next-cloud repo comes with one file to control Apache that would be as long as a cloud-init for my whole app - Ive taken on responsibility for a script that I don’t really even want to understand & that’s one script of a few!

(Plus think of all those extra apps that could be snaped with ease if you just made a LAMP plugin)