Skip to content

Instantly share code, notes, and snippets.

@nukeador
Last active November 13, 2023 17:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nukeador/d45a17ba6b98b2a97c3e to your computer and use it in GitHub Desktop.
Save nukeador/d45a17ba6b98b2a97c3e to your computer and use it in GitHub Desktop.
phpBB to Discourse migration

##Install Discourse using docker

https://github.com/discourse/discourse/blob/master/docs/INSTALL-digital-ocean.md

##Configure and run the importer script

Let's ssh inside the docker

$ cd /var/discourse
$ ./launcher ssh app

If you want to know the host ip address from inside the docker:

$ /sbin/ip route|awk '/default/ { print $3 }'

From inside de docker we have to install mysql and bbcode gems and edit the import script with our phpbb data, the script is located at /var/www/discourse/script/import/script/phpbb3.rb Source

$ apt-get update && apt-get install libmysqlclient-dev -y
$ mkdir /tmp/ruby-bbcode-to-md
$ git clone https://github.com/nlalonde/ruby-bbcode-to-md.git /tmp/ruby-bbcode-to-md
$ cd /tmp/ruby-bbcode-to-md
$ gem build ruby-bbcode-to-md.gemspec
$ gem install ruby-bbcode-to-md-0.0.13.gem
$ su - discourse
$ echo "gem 'mysql2'" >> /var/www/discourse/Gemfile
$ echo "gem 'ruby-bbcode-to-md', path: '/tmp/ruby-bbcode-to-md'" >> /var/www/discourse/Gemfile
$ exit
$ cd /var/www/discourse
$ bundle install --no-deployment --path vendor/bundle
$ su - discourse
$ cd /var/www/discourse

Edit now the script:

$ vim script/import_scripts/phpbb3.rb
$ RAILS_ENV=production bundle exec ruby script/import_scripts/phpbb3.rb bbcode-to-md

Incremental imports

You can run the import script again to fetch new topics, just go inside the docker as discourse user and run it.

$ cd /var/discourse
$ ./launcher ssh app
$ su - discourse
$ cd /var/www/discourse
$ RAILS_ENV=production bundle exec ruby script/import_scripts/phpbb3.rb bbcode-to-md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment