Backup manuale da riga di comando e ripristino

Ciao,

ho un forum Discourse rotto che vorrei spostare su un altro server. Ho un backup nella cartella:

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

Sul mio nuovo server provo a caricare il backup ma fallisce:

$ ./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
Starting restore: forum-2019-05-06-033420-v20180920042415.tar.gz
[STARTED]
'system' ha avviato il ripristino!
Segnalo il ripristino come in corso...
Verifica che esista /var/www/discourse/tmp/restores/default/2019-05-08-180427...
Copia dell'archivio nella directory tmp...
Decompressione dell'archivio, questo potrebbe richiedere del tempo...
tar: EOF inaspettato nell'archivio
tar: Errore non recuperabile: uscita immediata
Nessun file di metadati da estrarre.
Convalida dei metadati...
  Versione corrente: 20190508135348
  Versione ripristinata: 20180920042415
tar: EOF inaspettato nell'archivio
tar: Errore non recuperabile: uscita immediata
Estrazione del file dump...
ECCEZIONE: /var/www/discourse/lib/backup_restore/restorer.rb:264:in `block in extract_dump': Impossibile estrarre il file dump.
tar: EOF inaspettato nell'archivio
tar: Errore non recuperabile: uscita immediata
/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>'
Tentativo di rollback...
Non è stato necessario eseguire un rollback
Pulizia dei file temporanei...
Rimozione della directory tmp '/var/www/discourse/tmp/restores/default/2019-05-08-180427'...
Ripresa di sidekiq...
Segnalo il ripristino come completato...
Notifica a 'system' della fine del ripristino...
Completato!
[FAILED]

Non so perché, ma il backup del forum precedente è danneggiato e non riesco più ad accedere all’interfaccia utente, solo alla riga di comando.

Come posso recuperare manualmente il database e i file dal vecchio Discourse e spostarli su quello nuovo?

Il backup tar contiene quanto segue:

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 Mi Piace

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 Mi Piace

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 Mi Piace

nice, thx :slight_smile:

2 Mi Piace

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