turnkeylinux / tracker

TurnKey Linux Tracker
https://www.turnkeylinux.org
70 stars 16 forks source link

Mayan EDMS (& apps with PostgreSQL DB) TKLBAM Restore Issues when restoring an upgraded version #1640

Closed DocCyblade closed 8 months ago

DocCyblade commented 3 years ago

While testing TKLBAM restore on a v16.1 Mayan EDMS install I found that a restore left the system in an unusable state. After testing it seems when the database is being restored it has issues. I am trying to restore from an upgraded version (v16.1 ships with 3.5.5, I upgraded to 4.0.15)

I wrote on the forum (here) about my issue, and what I found.

I wrote here on how I upgraded my instance of Mayan

I think the fix would be to use a restore hook to remove or backup then remove the mayan database. I have not looked into how that works yet if I can find where to submit a pull request I will.

DocCyblade commented 3 years ago

I also tested backup restore from the same version 3.5.5 to 3.5.5 and had issues as well. The site comes up but will not show page previews. This could be something else with but the page does load unlike the issue I am having. That might be another issues but could be a config issue. I look into that later

JedMeister commented 3 years ago

After a closer look, it appears that TKLBAM doesn't support restoring a PostgreSQL DB if it has an updated schema (compared to the existing DB schema on the appliance).

So it should work fine for restoring a backup to the same machine, but as you noted, it will be problematic when restoring an updated DB to a fresh vanilla appliance.

Your suggested workaround of dropping the DB prior to restore is certainly reasonable IMO. As you also noted, it could certainly be scripted as a pre-restore TKLBAM hook.

On the downside, it would mean that it could only restore the full DB (rather than individual tables) but IMO that's a reaonalbe trade off!

Anyway, sorry for somewhat hijacking your issue to note that it's actually related to PostgreSQL apps in general, not specifically Mayan.


This one is specific to Mayan:

I also tested backup restore from the same version 3.5.5 to 3.5.5 and had issues as well. The site comes up but will not show page previews. This could be something else with but the page does load unlike the issue I am having. That might be another issues but could be a config issue. I look into that later

Was that related to the change of doc storage paths (as noted at the end of your writeup? I.e. this step:

mv /opt/mayan-edms/media/document_storage/* /opt/mayan-edms/media/document_file_storage/
mv /opt/mayan-edms/media/document_cache/* /opt/mayan-edms/media/document_file_page_image_cache/
JedMeister commented 2 years ago

FYI, re dropping the PostgreSQL DB:

(I'm using the DB name mayan - I didn't double check though, so perhaps that's not right...)

To manually dump the mayan DB (local backup):

pg_dump mayan > mayan_backup.sql

To drop the mayan DB (to allow for backup to restore):

su - postgres -c 'psql postgres -c "DROP DATABASE mayan;"
JedMeister commented 8 months ago

I'm pretty sure that this was resolved by https://github.com/turnkeylinux/tklbam/pull/17 - thus closing...