从mybb迁移

Possibly, we add importer features as we have paying business hosted customers to migrate – and we always open source those changes!

Good to hear that! Thanks, Jeff!

Just asking: any paying businesses migrating from MyBB right now? :wink:

Is there a guide for that right now?

It doesn’t look like it. It works like most of them, though, and I recently added code that allows you to configure most everything in environment variables (as well as support permalinks). You’ll need to add the mysql2 gem (and virtually every guide includes how to do that).

How i use import script? Our Mybb forum and Discourse is not on the same server. I think I could create Mybb database backup and run import script?

The usual method is to install a development environment, copy the database to the development server and run the script.

You might use this howto as an example:

Rather than configuring the script as that example suggests, just run it and it’ll tell you what environment variables to set.

I’ve problem in that step (I think its about bundle install):

RAILS_ENV=production ruby script/import_scripts/mybb.rb

After that command here is the error:

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.8/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.8/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new'
        from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect'
        from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
        from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
        from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/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.8/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.8/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.8/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.8/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.8/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.8/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.8/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.8/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.8/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
        from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_handling.rb:87:in `connection'
        from /var/www/discourse/lib/site_settings/db_provider.rb:59:in `table_exists?'
        from /var/www/discourse/lib/site_settings/db_provider.rb:30:in `save'
        from /var/www/discourse/lib/site_setting_extension.rb:321:in `add_override!'
        from /var/www/discourse/lib/site_setting_extension.rb:498:in `block in setup_methods'
        from /var/www/discourse/plugins/discourse-narrative-bot/plugin.rb:45:in `block in activate!'
        from /var/www/discourse/lib/plugin/instance.rb:208:in `block in notify_after_initialize'
        from /var/www/discourse/lib/plugin/instance.rb:206:in `each'
        from /var/www/discourse/lib/plugin/instance.rb:206:in `notify_after_initialize'
        from /var/www/discourse/config/application.rb:209:in `block (2 levels) in <class:Application>'
        from /var/www/discourse/config/application.rb:209:in `each'
        from /var/www/discourse/config/application.rb:209:in `block in <class:Application>'
        from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
        from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
        from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/lazy_load_hooks.rb:44:in `each'
        from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
        from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/application/finisher.rb:62:in `block in <module:Finisher>'
        from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/initializable.rb:30:in `instance_exec'
        from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/initializable.rb:30:in `run'
        from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /usr/local/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
        from /usr/local/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        from /usr/local/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
        from /usr/local/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
        from /usr/local/lib/ruby/2.3.0/tsort.rb:347:in `each'
        from /usr/local/lib/ruby/2.3.0/tsort.rb:347:in `call'
        from /usr/local/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
        from /usr/local/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
        from /usr/local/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
        from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/initializable.rb:54:in `run_initializers'
        from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/application.rb:352:in `initialize!'
        from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/railtie.rb:194:in `public_send'
        from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/railtie.rb:194:in `method_missing'
        from /var/www/discourse/config/environment.rb:5:in `<top (required)>'
        from /var/www/discourse/script/import_scripts/base.rb:14:in `require_relative'
        from /var/www/discourse/script/import_scripts/base.rb:14: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 script/import_scripts/mybb.rb:2:in `<main>'
root@discourse-gameofthronestr-app:/var/www/discourse#
root@discourse-gameofthronestr-app:/var/www/discourse#
root@discourse-gameofthronestr-app:/var/www/discourse#
root@discourse-gameofthronestr-app:/var/www/discourse# RAILS_ENV=production ruby script/import_scripts/mybb.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.8/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.8/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new'
        from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect'
        from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
        from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
        from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/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.8/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.8/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.8/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.8/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.8/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.8/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.8/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.8/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.8/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
        from /usr/local/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_handling.rb:87:in `connection'
        from /var/www/discourse/lib/site_settings/db_provider.rb:59:in `table_exists?'
        from /var/www/discourse/lib/site_settings/db_provider.rb:30:in `save'
        from /var/www/discourse/lib/site_setting_extension.rb:321:in `add_override!'
        from /var/www/discourse/lib/site_setting_extension.rb:498:in `block in setup_methods'
        from /var/www/discourse/plugins/discourse-narrative-bot/plugin.rb:45:in `block in activate!'
        from /var/www/discourse/lib/plugin/instance.rb:208:in `block in notify_after_initialize'
        from /var/www/discourse/lib/plugin/instance.rb:206:in `each'
        from /var/www/discourse/lib/plugin/instance.rb:206:in `notify_after_initialize'
        from /var/www/discourse/config/application.rb:209:in `block (2 levels) in <class:Application>'
        from /var/www/discourse/config/application.rb:209:in `each'
        from /var/www/discourse/config/application.rb:209:in `block in <class:Application>'
        from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
        from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
        from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/lazy_load_hooks.rb:44:in `each'
        from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
        from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/application/finisher.rb:62:in `block in <module:Finisher>'
        from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/initializable.rb:30:in `instance_exec'
        from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/initializable.rb:30:in `run'
        from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /usr/local/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
        from /usr/local/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        from /usr/local/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
        from /usr/local/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
        from /usr/local/lib/ruby/2.3.0/tsort.rb:347:in `each'
        from /usr/local/lib/ruby/2.3.0/tsort.rb:347:in `call'
        from /usr/local/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
        from /usr/local/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
        from /usr/local/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
        from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/initializable.rb:54:in `run_initializers'
        from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/application.rb:352:in `initialize!'
        from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/railtie.rb:194:in `public_send'
        from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/railtie.rb:194:in `method_missing'
        from /var/www/discourse/config/environment.rb:5:in `<top (required)>'
        from /var/www/discourse/script/import_scripts/base.rb:14:in `require_relative'
        from /var/www/discourse/script/import_scripts/base.rb:14: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 script/import_scripts/mybb.rb:2:in `<main>'

are you running the import script as discourse user? If not, you should su - discourse before attempting to run the rails r part.

Hello,

I’m trying to migrate mybdd from myBB to Discourse

I use the commands given by Dan Dascalescu

But doesn’t work for me …

I posted the log, could you help me ?

root@vps:~# cd /var/discourse
root@vps:/var/discourse# ./launcher enter app
root@-app:/var/www/discourse# apt-get update
Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
Hit:4 http://apt.postgresql.org/pub/repos/apt xenial-pgdg InRelease
Hit:5 https://deb.nodesource.com/node_8.x xenial InRelease
Fetched 216 kB in 0s (287 kB/s)
Reading package lists... Done
root@vps-app:/var/www/discourse# apt-get install libmysqlclient-dev mc -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
mc is already the newest version (3:4.8.15-2).
libmysqlclient-dev is already the newest version (5.7.24-0ubuntu0.16.04.1).
0 upgraded, 0 newly installed, 0 to remove and 35 not upgraded.
root@vps-app:/var/www/discourse# gem install mysql2
Building native extensions. This could take a while...
Successfully installed mysql2-0.5.2
1 gem installed
root@vps-app:/var/www/discourse# su - discourse
discourse@vps-app:~$ cd /var/www/discourse/script/import_scripts
discourse@vps-app:/var/www/discourse/script/import_scripts$ bundle install
Using rake 12.3.2
Using concurrent-ruby 1.1.3
Using i18n 1.1.1
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.2.2
Using builder 3.2.3
Using erubi 1.7.1
Using mini_portile2 2.3.0
Using nokogiri 1.8.5
Using rails-dom-testing 2.0.3
Using crass 1.0.4
Using loofah 2.2.3
Using rails-html-sanitizer 1.0.4
Using actionview 5.2.2
Using rack 2.0.6
Using rack-test 1.1.0
Using actionpack 5.2.2
Using globalid 0.4.1
Using activejob 5.2.2
Using mini_mime 1.0.1
Using mail 2.7.1.rc1
Using actionmailer 5.2.2
Using activemodel 5.2.2
Using active_model_serializers 0.8.4
Using arel 9.0.0
Using activerecord 5.2.2
Using public_suffix 3.0.2
Using addressable 2.5.2
Using ast 2.4.0
Using aws-eventstream 1.0.1
Using aws-partitions 1.104.0
Using aws-sigv4 1.0.3
Using jmespath 1.4.0
Using aws-sdk-core 3.27.0
Using aws-sdk-kms 1.9.0
Using aws-sdk-s3 1.19.0
Using ember-source 2.13.3
Using execjs 2.7.0
Using barber 0.12.0
Using msgpack 1.2.4
Using bootsnap 1.3.0
Using bundler 1.17.3
Using byebug 10.0.2
Using certified 1.0.0
Using chunky_png 1.3.10
Using claide 1.0.2
Using colored2 3.1.2
Using cork 0.3.0
Using nap 1.1.0
Using open4 1.3.4
Using claide-plugins 0.9.2
Using coderay 1.1.2
Using connection_pool 2.2.2
Using cppjieba_rb 0.3.0
Using safe_yaml 1.0.4
Using crack 0.4.3
Using multipart-post 2.0.0
Using faraday 0.12.2
Using faraday-http-cache 1.3.1
Using git 1.4.0
Using kramdown 1.17.0
Using no_proxy_fix 0.1.2
Using sawyer 0.8.1
Using octokit 4.9.0
Using unicode-display_width 1.4.0
Using terminal-table 1.8.0
Using danger 5.6.3
Using diff-lcs 1.3
Using exifr 1.3.4
Using fspath 3.1.0
Using image_size 1.5.0
Using in_threads 1.5.0
Using progress 3.4.0
Using discourse_image_optim 0.26.2
Using email_reply_trimmer 0.1.12
Using ember-data-source 3.0.2
Using sprockets 3.7.2
Using ember-handlebars-template 0.7.5
Using method_source 0.8.2
Using thor 0.19.4
Using railties 5.2.2
Using jquery-rails 4.3.3
Using ember-rails 0.18.5
Using excon 0.62.0
Using fabrication 2.20.1
Using fakeweb 1.3.0
Using fast_blank 1.0.0
Using rake-compiler 1.0.4
Using fast_xor 1.1.3
Using fast_xs 0.8.0
Using fastimage 2.1.3
Using ffi 1.9.25
Using flamegraph 0.9.5
Using gc_tracer 1.5.1
Using guess_html_encoding 0.0.11
Using hashdiff 0.3.7
Using hashie 3.5.7
Using highline 1.7.10
Using hiredis 0.6.1
Using hkdf 0.3.0
Using htmlentities 4.3.4
Using http_accept_language 2.0.5
Using jaro_winkler 1.5.1
Using jwt 1.5.6
Using kgio 2.11.2
Using libv8 6.7.288.46.1 (x86_64-linux)
Using rb-fsevent 0.10.3
Using rb-inotify 0.9.10
Using ruby_dep 1.5.0
Using listen 3.1.5
Using request_store 1.4.1
Using lograge 0.10.0
Using logstash-event 1.2.02
Using logstash-logger 0.26.1
Using logster 1.3.4
Using lru_redux 1.1.0
Using maxminddb 0.1.21
Using memory_profiler 0.9.12
Using message_bus 2.2.0.pre.1
Using metaclass 0.0.4
Using mini_racer 0.2.3
Using mini_scheduler 0.8.1
Using mini_sql 0.1.10
Using mini_suffix 0.3.0
Using mocha 1.5.0
Using mock_redis 0.18.0
Using moneta 1.0.0
Using multi_json 1.13.1
Using multi_xml 0.6.0
Using mustache 1.0.5
Using nokogumbo 1.5.0
Using oauth 0.5.4
Using oauth2 1.4.0
Using oj 3.6.2
Using omniauth 1.8.1
Using omniauth-oauth2 1.5.0
Using omniauth-facebook 5.0.0
Using omniauth-github 1.3.0
Using omniauth-google-oauth2 0.5.3
Using omniauth-instagram 1.3.0
Using omniauth-oauth 1.1.0
Using ruby-openid 2.7.0
Using rack-openid 1.3.1
Using omniauth-openid 1.0.1
Using omniauth-twitter 1.4.0
Using sanitize 4.6.5
Using onebox 1.8.71
Using redis 4.0.1
Using openid-redis-store 0.0.2
Using parallel 1.12.1
Using parser 2.5.3.0
Using pg 1.1.3
Using powerpack 0.1.2
Using slop 3.6.0
Using pry 0.10.4
Using pry-nav 0.2.4
Using pry-rails 0.3.6
Using puma 3.11.4
Using r2 0.2.7
Using rack-mini-profiler 1.0.1
Using rack-protection 2.0.3
Using rails_multisite 2.0.4
Using rainbow 3.0.0
Using raindrops 0.19.0
Using trollop 2.1.2
Using rbtrace 0.4.10
Using rchardet 1.8.0
Using redis-namespace 1.6.0
Using rinku 2.0.4
Using rotp 3.3.1
Using rqrcode 0.10.1
Using rspec-support 3.7.1
Using rspec-core 3.7.1
Using rspec-expectations 3.7.0
Using rspec-mocks 3.7.0
Using rspec 3.7.0
Using rspec-html-matchers 0.9.1
Using rspec-rails 3.7.2
Using rtlit 0.0.5
Using ruby-progressbar 1.10.0
Using rubocop 0.60.0
Using ruby-readability 0.7.0
Using sass-listen 4.0.0
Using sass 3.5.6
Using sassc 1.11.4
Using seed-fu 2.3.9
Using shoulda-context 1.2.2
Using shoulda-matchers 2.8.0
Using shoulda 3.5.0
Using sidekiq 5.1.3
Using sprockets-rails 3.2.1
Using sshkey 1.9.0
Using stackprof 0.2.11
Using tilt 2.0.8
Using uglifier 4.1.11
Using unf_ext 0.0.7.5
Using unf 0.1.4
Using unicorn 5.4.0
Using webmock 3.4.2
Using webpush 0.3.2
Bundle complete! 112 Gemfile dependencies, 202 gems now installed.
Gems in the group development were not installed.
Bundled gems are installed into `../../vendor/bundle`
discourse@vps-app:/var/www/discourse/script/import_scripts$ mcedit mybb.rb

discourse@vps-app:/var/www/discourse/script/import_scripts$ RAILS_ENV=production ruby mybb.rb
Traceback (most recent call last):
        23: from mybb.rb:2:in `<main>'
        22: from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        21: from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        20: from /var/www/discourse/script/import_scripts/base.rb:14:in `<top (required)>'
        19: from /var/www/discourse/script/import_scripts/base.rb:14:in `require_relative'
        18: from /var/www/discourse/config/environment.rb:2:in `<top (required)>'
        17: from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        16: from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        15: from /var/www/discourse/config/application.rb:40:in `<top (required)>'
        14: from /var/www/discourse/config/application.rb:41:in `<module:Discourse>'
        13: from /var/www/discourse/config/application.rb:57:in `<class:Application>'
        12: from /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:246:in `require_dependency'
        11: from /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:334:in `depend_on'
        10: from /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:356:in `require_or_load'
         9: from /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:37:in `load_interlock'
         8: from /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies/interlock.rb:13:in `loading'
         7: from /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
         6: from /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
         5: from /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:37:in `block in load_interlock'
         4: from /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:373:in `block in require_or_load'
         3: from /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:475:in `load_file'
         2: from /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:661:in `new_constants_in'
         1: from /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:476:in `block in load_file'
/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:476:in `load': No such file to load -- lib/discourse.rb (LoadError)
discourse@vps-app:/var/www/discourse/script/import_scripts$

Hello,

nobody can help me ?

Regards,

Try running the script from /var/www/discourse and not the script directory?

Thank you for your reply

so I have to copy past the mybb.ruby to /var/www/discourse before ?

I copy past mybb.rb in /var/www/discourse

but I have another issue

root@vps-app:/var/www/discourse# RAILS_ENV=production bundle exec ruby mybb.rb
Traceback (most recent call last):
        1: from mybb.rb:1:in `<main>'
mybb.rb:1:in `require': cannot load such file -- mysql2 (LoadError)
root@vps-app:/var/www/discourse#

You’ll need to install the gem. There are some howto posts for other importers that you should use as a model. You should read those. There are dozens more tiny little things you’ll need to figure out.

If you need so by step help and have a budget my context info is in my profile.

各位,

有人成功从 mybb 迁移到 discourse 吗?

我遇到了这个问题:

discourse@hn-app:/var/www/discourse/script/import_scripts$ RAILS_ENV=production ruby mybb.rb

**回溯**(最近一次调用在最后):

23: from mybb.rb:4:in `<main>'

22: from /usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'

21: from /usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'

20: from /var/www/discourse/script/import_scripts/base.rb:16:in `<top (required)>'

19: from /var/www/discourse/script/import_scripts/base.rb:16:in `require_relative'

18: from /var/www/discourse/config/environment.rb:4:in `<top (required)>'

17: from /usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'

16: from /usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'

15: from /var/www/discourse/config/application.rb:58:in `<top (required)>'

14: from /var/www/discourse/config/application.rb:59:in `<module:Discourse>'

13: from /var/www/discourse/config/application.rb:75:in `<class:Application>'

12: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:280:in `require_dependency'

11: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:368:in `depend_on'

10: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:390:in `require_or_load'

9: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:40:in `load_interlock'

8: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies/interlock.rb:13:in `loading'

7: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'

6: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies/interlock.rb:14:in `block in loading'

5: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:40:in `block in load_interlock'

4: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:407:in `block in require_or_load'

3: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:510:in `load_file'

2: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:702:in `new_constants_in'

1: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:511:in `block in load_file'

/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/dependencies.rb:511:in `load': **没有这样的文件可加载 -- lib/discourse.rb (** **LoadError** **)**

完全不知道如何修复这个问题。

尝试运行 RAILS_ENV=production rails runner mybb.rb

感谢您的回答,但我现在遇到了这个问题:

/usr/local/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:50:in ‘rescue in postgresql_connection': **FATAL: Peer authentication failed for user "discourse" (** **ActiveRecord::NoDatabaseError** **)**

切换到 discourse 用户后,我收到以下提示:

请指定有效的 Ruby 命令或要运行的脚本路径。

运行 'rails runner -h' 以获取帮助。

未定义局部变量或方法 `mybb' for main:Object

错误在于你的 Rails 无法连接到 PostgreSQL 数据库。我建议调查一下为什么 discourse 用户无法做到这一点。

你好,

我想我已经解决了这个问题,我正在参考以下内容:

通过编辑这个文件:

  1. 编辑文件 /etc/postgresql/9.5/main/pg_hba.conf

更新:已运行,非常感谢!

抱歉 @eviltrout,想再请教一下,如何在关闭的同时保持迁移运行?
我忘了用 screen 来运行,现在可以取消并重新运行吗?