Copia de seguridad manual con línea de comandos y restauración

Hola,

Tengo un foro de Discourse roto que quiero migrar a otro servidor. Tengo una copia de seguridad en la carpeta:

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

En mi nuevo servidor intento cargar la copia de seguridad, pero falla:

$ ./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 iniciado la restauración.
Marcando la restauración como en ejecución...
Asegurando que existe /var/www/discourse/tmp/restores/default/2019-05-08-180427...
Copiando el archivo comprimido al directorio temporal...
Descomprimiendo el archivo comprimido, esto puede tardar un rato...
tar: Fin de archivo inesperado en el archivo comprimido
tar: El error no es recuperable: saliendo ahora
No hay archivo de metadatos para extraer.
Validando metadatos...
  Versión actual: 20190508135348
  Versión restaurada: 20180920042415
tar: Fin de archivo inesperado en el archivo comprimido
tar: El error no es recuperable: saliendo ahora
Extrayendo el archivo volcado...
EXCEPCIÓN: /var/www/discourse/lib/backup_restore/restorer.rb:264:in `block in extract_dump': Error al extraer el archivo volcado.
tar: Fin de archivo inesperado en el archivo comprimido
tar: El error no es recuperable: saliendo ahora
/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>'
Intentando revertir...
No fue necesario revertir
Limpieza de elementos...
Eliminando el directorio temporal '/var/www/discourse/tmp/restores/default/2019-05-08-180427'...
Reanudando sidekiq...
Marcando la restauración como finalizada...
Notificando a 'system' del fin de la restauración...
¡Finalizado!
[FALLÓ]

No sé por qué, pero la copia de seguridad del foro anterior está dañada y ya no puedo acceder a la interfaz de usuario, solo a la línea de comandos.

¿Cómo puedo obtener manualmente la base de datos y los archivos del Discourse anterior y transferirlos al nuevo?

La copia de seguridad en formato tar contiene lo siguiente:

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?

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.

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.

nice, thx :slight_smile: