Problème de restauration : la relation « theme_fields » n'existe pas

Merci pour votre aide !

J’ai créé une nouvelle sauvegarde à partir de l’ancien serveur de production qui fonctionne toujours parfaitement.

J’ai purgé à la fois Docker et Discourse du serveur de staging plus récent. Puis j’ai réinstallé Docker et Discourse conformément aux instructions officielles. Ensuite, j’ai suivi les instructions de restauration en ligne de commande.

La sauvegarde a été créée avec docker-engine 17.05.0~ce-0~debian-stretch et doit être restaurée avec docker-ce-cli 5:19.03.9~3-0~debian-buster. Cela entraîne également une version plus récente de PostgreSQL (ancienne : 10 ; nouvelle : 12).

Est-ce une approche légitime de sauvegarder une version obsolète de Docker/PostgreSQL et de tenter une restauration sur une installation Docker/Discourse à jour ?

Cette fois, j’obtiens une erreur différente.

ERROR:  could not create unique index "index_incoming_referers_on_path_and_incoming_domain_id"
DETAIL:  Key (path, incoming_domain_id)=(/wiki/Tor_Browser, 3) is duplicated.
EXCEPTION: psql failed: DETAIL:  Key (path, incoming_domain_id)=(/wiki/Tor_Browser, 3) is duplicated.

Journal complet :

root@whonix-app:/var/www/discourse# discourse restore whonix-forum-2020-05-25-065253-v20200506044956.tar.gz
Starting restore: whonix-forum-2020-05-25-065253-v20200506044956.tar.gz
[STARTED]
'system' has started the restore!
Marking restore as running...
Making sure /var/www/discourse/tmp/restores/default/2020-05-25-132224 exists...
Copying archive to tmp directory...
Unzipping archive, this may take a while...
Extracting dump file...
Validating metadata...
  Current version: 20200524181959
  Restored version: 20200506044956
Enabling readonly mode...
Pausing sidekiq...
Waiting up to 60 seconds for Sidekiq to finish running jobs...
Creating missing functions in the discourse_functions schema...
Restoring dump file... (this may take a while)
[cut]
ALTER TABLE
[cut lots of duplicate ALTER TABLE lines]
ALTER TABLE
CREATE INDEX
[cut lots of duplicate CREATE INDEX lines]
CREATE INDEX
ERROR:  could not create unique index "index_incoming_referers_on_path_and_incoming_domain_id"
DETAIL:  Key (path, incoming_domain_id)=(/wiki/Tor_Browser, 3) is duplicated.
EXCEPTION: psql failed: DETAIL:  Key (path, incoming_domain_id)=(/wiki/Tor_Browser, 3) is duplicated.
/var/www/discourse/lib/backup_restore/database_restorer.rb:95:in `restore_dump'
/var/www/discourse/lib/backup_restore/database_restorer.rb:26:in `restore'
/var/www/discourse/lib/backup_restore/restorer.rb:49:in `run'
script/discourse:143:in `restore'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/base.rb:485:in `start'
script/discourse:284:in `<top (required)>'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `load'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `kernel_load'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:28:in `run'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:476:in `exec'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in `dispatch'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in `dispatch'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in `start'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in `start'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/exe/bundle:46:in `block in <top (required)>'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/exe/bundle:34:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Trying to rollback...
Rolling back...
Cleaning stuff up...
Dropping functions from the discourse_functions schema...
Removing tmp '/var/www/discourse/tmp/restores/default/2020-05-25-132224' directory...
Unpausing sidekiq...
Disabling readonly mode...
Marking restore as finished...
Notifying 'system' of the end of the restore...
Finished!
[FAILED]
Restore done.
root@whonix-app:/var/www/discourse#

Je me demande comment c’est possible puisque mon ancien serveur de production Discourse fonctionne toujours parfaitement. Et c’est la deuxième sauvegarde que j’essaie.

PostgreSQL 10 ou PostgreSQL 12 ?


MODIF :

root@whonix-app:/var/www/discourse# rails c
[1] pry(main)> IncomingReferer.where(path: "/wiki/Tor_Browser")
=> [#<IncomingReferer:0x0000561cba422f48
  id: 11361,
  path: "/wiki/Tor_Browser",
  incoming_domain_id: 3>]
[2] pry(main)> 

MODIF2 :

[6] pry(main)> IncomingReferer.where("path LIKE '%/wiki/Tor_Browser%'")
=> [#<IncomingReferer:0x0000561cc08882a8
  id: 19,
  path: "/wiki/Tor_Browser",
  incoming_domain_id: 3>,
 #<IncomingReferer:0x0000561cc08b3f48
  id: 67,
  path: "/wiki/Tor_Browser/Download_Confirmation_Screen",
  incoming_domain_id: 3>,
 #<IncomingReferer:0x0000561cc08b3e08
  id: 331,
  path: "/wiki/Tor_Browser/Internal_Updater",
  incoming_domain_id: 3>,
 #<IncomingReferer:0x0000561cc08b3cf0
  id: 489,
  path: "/wiki/Tor_Browser",

<page break> --- Appuyez sur Entrée pour continuer ( q<enter> pour quitter ) --- <page break>

  incoming_domain_id: 113>,
 #<IncomingReferer:0x0000561cc08b3bb0
  id: 2957,
  path: "/wiki/Tor_Browser/Advanced_Users",
  incoming_domain_id: 617>,
 #<IncomingReferer:0x0000561cc08b3a70
  id: 4052,
  path: "/wiki/Tor_Browser",
  incoming_domain_id: 617>,
 #<IncomingReferer:0x0000561cc08b38e0
  id: 4196,
  path: "/wiki/Tor_Browser",
  incoming_domain_id: 1513>,
 #<IncomingReferer:0x0000561cc08b37f0
  id: 4220,

<page break> --- Appuyez sur Entrée pour continuer ( q<enter> pour quitter ) --- <page break>

  path: "/wiki/Tor_Browser/Advanced_Users",
  incoming_domain_id: 1513>,
 #<IncomingReferer:0x0000561cc08b3700
  id: 4307,
  path: "/wiki/Tor_Browser",
  incoming_domain_id: 1552>,
 #<IncomingReferer:0x0000561cc08b34a8
  id: 4346,
  path: "/wiki/Tor_Browser/Advanced_Users",
  incoming_domain_id: 1552>,
 #<IncomingReferer:0x0000561cc08b3318
  id: 8713,
  path: "/wiki/Tor_Browser/Advanced_Users",
  incoming_domain_id: 3>,
 #<IncomingReferer:0x0000561cc08b3188

<page break> --- Appuyez sur Entrée pour continuer ( q<enter> pour quitter ) --- <page break>

  id: 9746,
  path: "/wiki/Tor_Browser_without_Tor",
  incoming_domain_id: 3>,
 #<IncomingReferer:0x0000561cc08b2f08
  id: 10248,
  path: "/wiki/Tor_Browser_without_Tor",
  incoming_domain_id: 113>,
 #<IncomingReferer:0x0000561cc08b2cb0
  id: 11361,
  path: "/wiki/Tor_Browser",
  incoming_domain_id: 3>,
 #<IncomingReferer:0x0000561cc08b2bc0
  id: 11754,
  path: "/wiki/Tor_Browser/Advanced_Users",
  incoming_domain_id: 113>,

<page break> --- Appuyez sur Entrée pour continuer ( q<enter> pour quitter ) --- <page break>

 #<IncomingReferer:0x0000561cc08b2ad0
  id: 12094,
  path: "/wiki/Tor_Browser/Advanced_Users",
  incoming_domain_id: 4560>,
 #<IncomingReferer:0x0000561cc08b28f0
  id: 12892,
  path: "/wiki/Tor_Browser",
  incoming_domain_id: 4559>,
 #<IncomingReferer:0x0000561cc08b25f8
  id: 13038,
  path: "/wiki/Tor_Browser",
  incoming_domain_id: 4560>]
[7] pry(main)> 
[8] pry(main)>