How to perform a restore when you have two containers?

Small question: how to perform the restore, when you have multiple containers (data and web_only). I tried this howto first from within the data container:

root@docker2:/var/discourse# ./launcher enter data
x86_64 arch detected.
root@docker2-data:/# discourse enable_restore
bash: discourse: command not found

OK, the discourse app is in the web container. But here the restore throws an exception and ends with an error:

Restore are now permitted. Disable them with `disable_restore`
root@forum:/var/www/discourse# discourse restore netzwissen-forum-2023-10-07-125819-v20230913194832.tar.gz
Plugin name is 'discourse-topic-voting', but plugin directory is named 'discourse-voting'
Starting restore: netzwissen-forum-2023-10-07-125819-v20230913194832.tar.gz
[STARTED]
'system' has started the restore!
Marking restore as running...
Making sure /var/www/discourse/tmp/restores/default/2023-10-07-132317 exists...
Copying archive to tmp directory...
EXCEPTION: /var/www/discourse/lib/discourse.rb:138:in `exec': Failed to copy archive to tmp directory.
cp: cannot stat '/var/www/discourse/public/backups/default/netzwissen-forum-2023-10-07-125819-v20230913194832.tar.gz': No such file or directory
/var/www/discourse/lib/discourse.rb:172:in `execute_command'
/var/www/discourse/lib/discourse.rb:138:in `exec'
/var/www/discourse/lib/discourse.rb:34:in `execute_command'
/var/www/discourse/lib/backup_restore/local_backup_store.rb:47:in `download_file'
/var/www/discourse/lib/backup_restore/backup_file_handler.rb:62:in `copy_archive_to_tmp_directory'
/var/www/discourse/lib/backup_restore/backup_file_handler.rb:22:in `decompress'
/var/www/discourse/lib/backup_restore/restorer.rb:42:in `run'
script/discourse:149:in `restore'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/base.rb:485:in `start'
script/discourse:290:in `<top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:492:in `exec'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:34:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:28:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/exe/bundle:45:in `block in <top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/exe/bundle:33:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Trying to rollback...
There was no need to rollback
Cleaning stuff up...
Removing tmp '/var/www/discourse/tmp/restores/default/2023-10-07-132317' directory...
Marking restore as finished...
Notifying 'system' of the end of the restore...
Finished!
[FAILED]
Restore done.

What is the trick to get the restore running on deployments with separate data and web containers?

Thanks, Thommie

Did you upload the backup to /var/discourse/shared/web-only/default?

You can run

discourse restore

To get a list of available backups.

You can also run a backup on web only to see where it puts its value so that you know you’re putting yours on the right place.

EDIT: I edited the OP and added this:

Does that help?

Hmmmm,
nope, still not working

I have the backup file here:

thommie@docker2:/var/discourse/shared/web-only$ ls  
backups  log  netzwissen-forum-2023-10-09-201019-v20230913194832.tar.gz

Then

root@docker2:/var/discourse# ./launcher enter web_only

x86_64 arch detected.  
root@forum:/var/www/discourse#

root@forum:/var/www/discourse# discourse restore  
You must provide a filename to restore. Did you mean one of the following?  
  
discourse restore forum-netzwissen-eu-2023-10-08-033221-v20230926165821.tar.gz

So, the restore only shows a backup file from inside of the web_only container of the new forum instance (the target of the backup). But not the backup file from the source instance which is available on /var/discourse/shared/web-only/ on the HOST system

So, the “discourse restore” does not use the mapped volume on the host, but only the one inside the container.

??

it needs to be in /var/discourse/shared/web-only/backups/default

inside the container do a

 discourse backup

and see where it puts the backup and put yours in the same place.

@pfaffman you’re right, I was on the wrong folder, the restore has finished successfully

thanks for the help!

1 Like

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