Sauvegarde manuelle avec ligne de commande et restauration

Bonjour,

J’ai un forum Discourse corrompu que je souhaite déplacer vers un autre serveur. J’ai une sauvegarde dans le dossier :

$ ls /var/discourse/shared/standalone/backups/default
$ forum-2019-05-06-033420-v20180920042415.tar

Sur mon nouveau serveur, j’essaie de charger la sauvegarde, mais cela échoue :

$ ./launcher enter app
$ discourse enable_restore
$ gzip public/backups/default/forum-2019-05-06-033420-v20180920042415.tar
$ discourse restore forum-2019-05-06-033420-v20180920042415.tar.gz
Démarrage de la restauration : forum-2019-05-06-033420-v20180920042415.tar.gz
[DÉBUTÉ]
'system' a démarré la restauration !
Marquage de la restauration comme en cours...
Vérification de l'existence de /var/www/discourse/tmp/restores/default/2019-05-08-180427...
Copie de l'archive vers le répertoire temporaire...
Décompression de l'archive, cela peut prendre un certain temps...
tar: Fin de fichier inattendue dans l'archive
tar: L'erreur n'est pas récupérable : arrêt immédiat
Aucun fichier de métadonnées à extraire.
Validation des métadonnées...
  Version actuelle : 20190508135348
  Version restaurée : 20180920042415
tar: Fin de fichier inattendue dans l'archive
tar: L'erreur n'est pas récupérable : arrêt immédiat
Extraction du fichier dump...
EXCEPTION : /var/www/discourse/lib/backup_restore/restorer.rb:264:in `block in extract_dump': Échec de l'extraction du fichier dump.
tar: Fin de fichier inattendue dans l'archive
tar: L'erreur n'est pas récupérable : arrêt immédiat
/var/www/discourse/lib/discourse.rb:29:in `execute_command'
/var/www/discourse/lib/backup_restore/restorer.rb:264:in `block in extract_dump'
/usr/local/lib/ruby/2.6.0/fileutils.rb:128:in `chdir'
/usr/local/lib/ruby/2.6.0/fileutils.rb:128:in `cd'
/var/www/discourse/lib/backup_restore/restorer.rb:263:in `extract_dump'
/var/www/discourse/lib/backup_restore/restorer.rb:58:in `run'
script/discourse:141:in `restore'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
script/discourse:282:in `<top (required)>'
/usr/local/lib/ruby/2.6.0/bundler/cli/exec.rb:74:in `load'
/usr/local/lib/ruby/2.6.0/bundler/cli/exec.rb:74:in `kernel_load'
/usr/local/lib/ruby/2.6.0/bundler/cli/exec.rb:28:in `run'
/usr/local/lib/ruby/2.6.0/bundler/cli.rb:463:in `exec'
/usr/local/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/usr/local/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/usr/local/lib/ruby/2.6.0/bundler/cli.rb:27:in `dispatch'
/usr/local/lib/ruby/2.6.0/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/usr/local/lib/ruby/2.6.0/bundler/cli.rb:18:in `start'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.2/exe/bundle:30:in `block in <top (required)>'
/usr/local/lib/ruby/2.6.0/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-1.17.2/exe/bundle:22:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tentative de retour en arrière...
Aucun besoin de retour en arrière
Nettoyage...
Suppression du répertoire temporaire '/var/www/discourse/tmp/restores/default/2019-05-08-180427'...
Reprise de sidekiq...
Marquage de la restauration comme terminée...
Notification à 'system' de la fin de la restauration...
Terminé !
[ÉCHEC]

Je ne sais pas pourquoi, mais la sauvegarde provenant du forum précédent est corrompue et je n’ai plus accès à l’interface utilisateur, uniquement à la ligne de commande.

Comment puis-je récupérer manuellement la base de données et les fichiers de l’ancien Discourse vers le nouveau ?

La sauvegarde tar contient ceci :

It looks like the backup file has been damaged. Maybe something happened to the file during the transfer to the new server. How did you transfer the file between your servers? Try comparing the checksums of the file on both servers. Are they the same?

3 « J'aime »

You should do what @gerhard said.

Also, if you can access the command line on the old server you can

cd /var/discourse
./launcher enter app
discourse backup

to create a new backup.

You could also rsync the uploads and do an SQL-only backup.

3 « J'aime »

The problem is that the old Discourse is broken. The docker version was to old and the ubuntu was to old too. When rebuilding is was not possible to launch the discourse again. So I cannot do automatic backup only manually.

I try to copy the standalone folder to the new discourse instance and also the app.yml file and rebuild the app but all I have is this page:

Any idea how can I rebuild the discourse with the previous data ?

I’d try rsyncing the whole /var/discourse folder to the new machine (delete the current one on the new machine first and destroy the current docker image).

EDIT: you could be somewhat selective like not copying logs, but simple is simple.

4 « J'aime »

nice, thx :slight_smile:

2 « J'aime »

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.