Restore backup : error Thor

I tried to restore a backup with command line (GUI is not an option) but I get this error :

root@forum:/var/discourse# ./launcher enter app
root@forum-app:/var/www/discourse# discourse restore
You must provide a filename to restore. Did you mean one of the following?

script/discourse restore tact-forum-2017-02-01-075306-v20161216101352.tar.gz
root@forum-app:/var/www/discourse# script/discourse restore tact-forum-2017-02-01-075306-v20161216101352.tar.gz
/usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- thor (LoadError)
	from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from script/discourse:3:in `<main>'
1 Like

@zogstrip can you have a look?

Seems my docker is broken. Is there a way to quickly check if someting went wrong in the docker ?

The Thor gem isn’t installed by default.

From your container run gem install thor and you should be good to go.

2 Likes

Why the gem thor is not installed by default since he is used to do the backup ?

There is a GUI to restore a backup but an admin need to go on the docker to install the gem and then restore the backup ? :unamused:

I’ve actually wondered this for a while. If thor is needed for our CLI surely it should be installed in the Gemfile.

2 Likes

It is in the lock
https://github.com/discourse/discourse/blob/master/Gemfile.lock#L362

1 Like

I have this file too, but obviously the gem are not installed

root@ubuntu-app:/var/www/discourse# gem list

*** LOCAL GEMS ***

bigdecimal (1.2.8)
bundler (1.14.5, 1.13.7)
did_you_mean (1.0.0)
io-console (0.4.5)
json (1.8.3)
minitest (5.8.5)
net-telnet (0.1.1)
power_assert (0.2.6)
psych (2.1.0)
rake (10.4.2)
rdoc (4.2.1)
test-unit (3.1.5)

This is a fresh install, the lastest version of discourse downloaded this morning.

Maybe it is only installed in dev mode, agree we should fix this, expecting people to install gems just to get discourse CLI to run is crazy

4 Likes

I think this will fix it:

https://github.com/discourse/discourse/commit/890f1bde894239a86da49908a31aa5e0a33072f5

3 Likes

Be careful, I remember that a thor version beyond 0.19.1 breaks stuff in ugly ways.

Or the gem should be installed when backup button is clicked and removed after regarding what @michaeld says

Really? Whenever I encountered the error I’d type gem install thor on the command line to get the latest version and it’s always worked. Do you have steps to reproduce it?

2 Likes

Sorry, can’t find it in my notes :frowning: