Try entering the container using: ./launcher enter app
I also tried to login as discourse user (into the container):
root@disc3-app:/var/www/discourse# su - discourse
discourse@disc3-app:~$ cd /var/www/discourse/script/import_scripts
discourse@disc3-app:/var/www/discourse/script/import_scripts$ ruby vbulletin.rb
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/postgresql_adapter.rb:661:in `rescue in connect': FATAL: database "discourse_development" does not exist (ActiveRecord::NoDatabaseError)
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect'
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection'
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
from /usr/local/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
from /usr/local/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in `retrieve_connection'
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_handling.rb:87:in `connection'
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/attributes.rb:93:in `columns'
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/attributes.rb:98:in `columns_hash'
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/core.rb:173:in `block in find_by'
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/core.rb:173:in `each'
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/core.rb:173:in `all?'
from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/core.rb:173:in `find_by'
from /var/www/discourse/lib/discourse.rb:282:in `system_user'
from /var/www/discourse/script/import_scripts/base.rb:477:in `<class:Base>'
from /var/www/discourse/script/import_scripts/base.rb:20:in `<top (required)>'
from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from vbulletin.rb:2:in `<main>'
If I try with “./launcher enter app” i get this error:
root@disc3-app:/var/www/discourse# bundle exec ruby script/import_scripts/vbulletin.rb
script/import_scripts/vbulletin.rb:1:in `require': cannot load such file -- mysql2 (LoadError)
from script/import_scripts/vbulletin.rb:1:in `<main>'
Keep using the enter method, Add mysql gem to the Gemfile, run a bundle install, run the script.
For “enter method” you intend the
./launcher enter app
bundle exec ruby script/import_scripts/vbulletin.rb
or launch with
su - discourse
cd /var/www/discourse/script/import_scripts
ruby vbulletin.rb
The first one, that’s the correct way.
I did the following steps:
[root@disc3 ~]# cd /var/discourse
[root@disc3 discourse]# ./launcher enter app
which: no docker.io in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
And after I added the mysql gem to gemfile
root@disc3-app:/var/www/discourse# echo "gem 'mysql2'" >> Gemfile
root@disc3-app:/var/www/discourse# sudo gem install mysql2
Building native extensions. This could take a while...
Successfully installed mysql2-0.4.4
1 gem installed
Something surprising happened when I did the bundle install:
root@disc3-app:/var/www/discourse# bundle install --no-deployment
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as
root will break this application for all non-root users on this machine.
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Resolving dependencies...
Installing rake 11.2.2
Installing i18n 0.7.0
**_[...]_**
Bundle complete! 100 Gemfile dependencies, 179 gems now installed.
Gems in the group development were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from certified:
IMPORTANT: Remember to use the included executable `certifed-update` regularly to keep your certificate bundle up to date.
179 gems installed, wow.
But when I try to start the converter, this happens:
root@disc3-app:/var/www/discourse# bundle exec ruby script/import_scripts/vbulletin.rbURGENT: FATAL: Peer authentication failed for user "discourse"
Failed to initialize site default
/usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `initialize': FATAL: Peer authentication failed for user "discourse" (PG::ConnectionBad)
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
from /usr/local/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
from /usr/local/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in `retrieve_connection'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_handling.rb:87:in `connection'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/attributes.rb:93:in `columns'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/attributes.rb:98:in `columns_hash'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/core.rb:173:in `block in find_by'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/core.rb:173:in `each'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/core.rb:173:in `all?'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/core.rb:173:in `find_by'
from /var/www/discourse/lib/discourse.rb:282:in `system_user'
from /var/www/discourse/script/import_scripts/base.rb:477:in `<class:Base>'
from /var/www/discourse/script/import_scripts/base.rb:20:in `<top (required)>'
from script/import_scripts/vbulletin.rb:2:in `require'
from script/import_scripts/vbulletin.rb:2:in `<main>'
Don’t do this. The bundle install is sufficient.
Try RAILS_ENV=production bundle exec ruby script/import_scripts/vbulletin.rb
Nothing to do, same error
root@disc3-app:/var/www/discourse# RAILS_ENV=production bundle exec ruby script/import_scripts/vbulletin.rb
URGENT: FATAL: Peer authentication failed for user "discourse"
Failed to initialize site default
/usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `initialize': FATAL: Peer authentication failed for user "discourse" (PG::ConnectionBad)
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
from /usr/local/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
from /usr/local/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in `retrieve_connection'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/connection_handling.rb:87:in `connection'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/attributes.rb:93:in `columns'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/attributes.rb:98:in `columns_hash'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/core.rb:173:in `block in find_by'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/core.rb:173:in `each'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/core.rb:173:in `all?'
from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/core.rb:173:in `find_by'
from /var/www/discourse/lib/discourse.rb:282:in `system_user'
from /var/www/discourse/script/import_scripts/base.rb:477:in `<class:Base>'
from /var/www/discourse/script/import_scripts/base.rb:20:in `<top (required)>'
from script/import_scripts/vbulletin.rb:2:in `require'
from script/import_scripts/vbulletin.rb:2:in `<main>'
Step 11 in this howto might help you.
Now I get this error (they will never end? )
root@disc3-app:/var/www/discourse# RAILS_ENV=production bundle exec ruby script/import_scripts/vbulletin.rb
/usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require': cannot load such file -- php_serialize (LoadError)
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require'
from script/import_scripts/vbulletin.rb:4:in `<main>'
echo "gem 'php-serialize'" >>Gemfile
bundle install
should do the trick for that one.
Finally I this script started to work!
But now the problem is that it’s a bit slow, I launched it on a Hyper-V VPS with 4 CPU-cores and 8GB RAM, is possible that Docker isn’t using all of them?
It’s vanishingly unlikely that the conversion script is taking advantage of multiple cores. Far more likely is that you have slow cores. Fewer faster cores is almost always better than more slower cores.
Another thing.
As the conversion will take long, is possible to prevent to stop it to work if I close my SSH session and reopen his “window” also if I login again in the SSH?
There is a tool called tmux that you want to know about
There is a tool called tmux that you want to know about
Actually I thought to try this way (I read your response too late):
-
Use screen on the host server
# screen
-
After I enter in the Discourse container inside screen
# ./launcher enter app
this seems to work