Thank you for help!
I’ve created a new backup from the still fully functional old production server.
Purged both docker and discourse from newer stage server. Re-installed both docker and discourse according official instructions. Then went with command line restoration instructions.
The backup was created with docker-engine 17.05.0~ce-0~debian-stretch
and to be restored with docker-ce-cli 5:19.03.9~3-0~debian-buster
. This also results in a newer postgres version. (old: 10; new: 12)
Is it a legitimate approach to backup an outdated docker/postgres version and try to restore on an up to date docker/discourse installation?
Getting a different error this time.
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.
Full log:
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#
I wonder how’s that possible since my old production discourse server is still fully functional. And it’s the second backup I try.
Postgres 10 or postgres 12?
EDIT:
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)>
EDIT2:
[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> --- Press enter to continue ( q<enter> to break ) --- <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> --- Press enter to continue ( q<enter> to break ) --- <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> --- Press enter to continue ( q<enter> to break ) --- <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> --- Press enter to continue ( q<enter> to break ) --- <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)>