YunoHost-Apps / hubzilla_ynh

Hubzilla Hub package for YunoHost
https://zotlabs.org/page/hubzilla/hubzilla-project
GNU General Public License v3.0
14 stars 9 forks source link

resorting of backup did not work #153

Open rocky-III opened 1 year ago

rocky-III commented 1 year ago

After a not correct working update and deleting of the HZ App - the resorting of the backup did not work

WARNING - /var/cache/yunohost/app_tmp_work_dirs/app_mvszbjej/restore: line 30: db_user: unbound variable

https://paste.yunohost.org/raw/elejoviheb

@ericgaspar please have a look and help... hope my Hub is not lost

Thanks so much

rocky-III commented 1 year ago

I will try to install the backup manualy - after i unpacked the .tar file.

By my try to unpack the .tar archive manual locally on the server with

tar -xvf archives/hubzilla-8.0.tar -C hz-save

i stated a process which is running now since 10 hours -

would be

tar -xf archives/hubzilla-8.0.tar -C hz-save

quid faster ?

dragondaddy commented 1 year ago

You probably don't need to extract the full archive. I think that if you could edit the script/restore file, and remove line 30 (ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd). If you're able to do that, maybe you'll be able to restore to your backup.

rocky-III commented 1 year ago

thanks - that was that good hint... still it was harder than i thought

Took me a while to understand how to do it but now i found a fix.

During the YNH backup process somehow the variable "db_user" was not stored - it is missing in the file "settings.yml" where all the variables are stored in for restoring a YNH app backup file

So here is what i did and what you can try if you came in to a similar situation:


YNH App backup archives are stored in /home/yunohost.backup/archives/

With your SFTP client make a save copy of your not working backup archive to your local hard drive - just in case...

Rename the backup archive on your server from "hubzilla-pre-upgrade2.tar" to something like "hubzilla-save.tar" so that YNH will not overwrite this archive by any other backup operation.

Go by ssh to /home/yunohost.backup

$ cd /home/yunohost.backup/

extract the file "settings.yml" from the backup .tar archive

$ tar -xf archives/hubzilla-save.tar apps/hubzilla/settings/settings.yml

(all this tar commands will take a while, depending how large your archive is, so be patient till the operation is done)

You find the extracted file under /home/yunohost.backup/apps/hubzilla/settings/settings.yml

Edit the extracted file "settings.yml" by adding the line "db_user: hubzilla" and save the file. My SFTP client can do this within the app. If your SFTP Client can't do this you have to first download the file, use a text editor for editing, and upload it again by FTP.

Delete the original file "settings.yml" whin the .tar achieve

$ tar --delete -f archives/hubzilla-save.tar apps/hubzilla/settings/settings.yml

add the new edited file "settings.yml" to the .tar achiv

$ tar -uf archives/hubzilla-save.tar apps/hubzilla/settings/settings.yml

Now the YNH restore script can find the variable "$db_user" the and the restoring of the backup archive will work. Just select the renamed archive in the YNH webAdmin interface

or do in this case (archivename = hubzilla-save ) by command line

$ yunohost backup restore hubzilla-save --apps hubzilla --debug