YunoHost-Apps / archivist_ynh

GNU General Public License v3.0
12 stars 4 forks source link

Backup error for app seafile #34

Closed agaAdams closed 3 years ago

agaAdams commented 3 years ago

Hello everyone, when I try to backup my apps, archivist has this error when creating a temporary backup for the app seafile.

Traceback (most recent call last):                                                                                             │# type=Choose between one of the scripts in the "senders" directory.
  File "/usr/bin/yunohost", line 72, in <module>                                                                               │# destination directory=Directory where to put the backup in the other side.
    parser=parser                                                                                                              │# encrypt=Override main option for encryption. (true/false) (Optionnal option)
  File "/usr/lib/moulinette/yunohost/__init__.py", line 29, in cli                                                             │# specific option for type=See the chosen script to know what's the options.
    top_parser=parser                                                                                                          │# exclude backup=Exclude a backup file or a directory from the backup. This option can be duplicated. (Optionnal option)
  File "/usr/lib/python2.7/dist-packages/moulinette/__init__.py", line 120, in cli                                             │# include backup=Choose the only file or directory which be send. This option can be duplicated. (Optionnal option)
    args, output_as=output_as, timeout=timeout                                                                                 │
  File "/usr/lib/python2.7/dist-packages/moulinette/interfaces/cli.py", line 477, in run                                       │> recipient name=Fritzbox NAS
    ret = self.actionsmap.process(args, timeout=timeout)                                                                       │type=local
  File "/usr/lib/python2.7/dist-packages/moulinette/actionsmap.py", line 592, in process                                       │destination directory=/mnt/fritzbox/TimeMachine/yh-backups
    return func(**arguments)                                                                                                   │# encrypt=false
  File "/usr/lib/moulinette/yunohost/backup.py", line 2062, in backup_create                                                   │# pre_backup=
    backup_manager.backup()                                                                                                    │# post_backup=
  File "/usr/lib/moulinette/yunohost/backup.py", line 730, in backup                                                           │# exclude backup=/exclude/dir
    method.mount_and_backup()                                                                                                  │# include backup=
  File "/usr/lib/moulinette/yunohost/backup.py", line 1574, in mount_and_backup                                                │
    self.backup()                                                                                                              │# > recipient name=local example
  File "/usr/lib/moulinette/yunohost/backup.py", line 1745, in backup                                                          │# type=local
    shutil.copytree(source, dest)                                                                                              │# destination directory=/my/local/backup
  File "/usr/lib/python2.7/shutil.py", line 231, in copytree                                                                   │# encrypt=false
    raise Error, errors                                                                                                        │# pre_backup=
shutil.Error: [('/opt/yunohost/seafile/ccnet/ccnet.sock', '/home/admin/temp/ynh_backup/temp/apps/seafile/backup/opt/yunohost/se│Backup_list.conf                                                                                             122,1          76%
afile/ccnet/ccnet.sock', "[Errno 6] No such device or address: '/opt/yunohost/seafile/ccnet/ccnet.sock'")]                     │
>>> The temporary backup failed..

In my Backup_list.conf I added a pre-backup action to stop both seafile services: seafile and seahub.

ynh_app_pre_backup=/etc/backups/services-stop.sh
ynh_app_post_backup=/etc/backups/services-start.sh
ynh_app_backup=archivist
ynh_app_backup=seafile do_not_backup_data

Backing up the seafile app via command line BACKUP_CORE_ONLY=1 yunohost backup create --app seafile works flawlessly.

Any ideas or suggestions what is going wrong?

maniackcrudelis commented 3 years ago

Common mistake with sockets. To try to backup or copy a socket is usually the best way to fail a command. Sockets aren't regular files.

The backup itself is no different than running manually the command, archivist does quite the same.

Such error is usually because of the backup script of the app that doesn't take care of specific files.

However, I can see that the backup script of the app ask to stop the service before performing the backup (instead of doing it...) to bypass the error. What could have happen in your situation, if you did stop the service then run the backup manually is that archivist did the same way faster than you did, not letting enough time for the service to stop.

If so, you can add a sleep after the stop. Or open an issue in seafile_ynh repo to ask to better handle that part of the script, app scripts for YunoHost have a function to stop a service and be sure it's stopped before going further. That's the better way to handle such issue.

agaAdams commented 3 years ago

I'll try a sleep command in the pre-script and will open an issue in seafile_ynh.

Thanks for your help!

agaAdams commented 3 years ago

Adding 10sec of sleep did not help. I opened an issue in seafile_ynh.