So it seems that http://www.discourse.org/ is the new way that forums should work.

Discourse uses Ruby on Rails, Redis and Postgresql on the server side. This means it is quite different than the LAMP stack that you might be used to.

For that reason, the recommended type of installation is via Docker to hide the complexity from the administrator: https://github.com/discourse/discourse/blob/master/docs/INSTALL-digital-ocean.md

I have tried that, but I must say that docker is intended for different kind of applications, if I understand correctly: for deployment of many applications in the cloud, and the data is stored not inside the Docker container but somewhere else.

I personally think that LXC containers are much more suitable for this kind of task. One aspect is that the container feels like a virtual machine, and I can control the IP address of the container using my lxc scripts: https://github.com/tpokorra/lxc-scripts

But installing all the requirements of Discourse manually is not an option either. Then I found the Debian and Ubuntu packages provided by packager.io: https://packager.io/gh/pkgr/discourse

So I followed the instructions at https://packager.io/gh/pkgr/discourse/install?bid=41#trusty to install Discourse on my Ubuntu 14.04 trusty container.

I use nginx in the host machine to manage SSL for me. I only need to set in the file /opt/discourse/config/site_settings.yml:

use_https: true

My nginx file looks like this: https://github.com/tpokorra/lxc-scripts/blob/master/nginx.sslconf.tpl

Now we get to the point where I want to migrate the existing phpBB forum to Discourse:

See this thread about the phpBB importer: https://meta.discourse.org/t/importing-phpbb-into-discourse/7956/27

I need to install mysql inside the container, and import the sql data:

apt-get install mysql-server mysql-client libmysqlclient-dev make
/etc/init.d/mysql start
mysql
  create database phpbb; 
  exit;
mysql phpbb < backup-db-phpbb.sql

Before I actually import the phpBB data, I disable sending of all emails in Discourse, in Settings/EMail, disable sending of all emails.

Now I need to load the environment variables, so that I use the correct version of Ruby and gems etc.
I have got those commands from the script /usr/bin/discourse:

. /etc/default/discourse
for file in /etc/discourse/conf.d/*; do   if [ -f $file ]; then . $file; fi; done
for file in /opt/discourse/.profile.d/*.sh; do   if [ -f $file ]; then HOME=/opt/discourse . $file; fi; done
 
# install mysql2 gem
gem install mysql2
 
#now the import call:
cd /opt/discourse/script/import_scripts
# PATH is not actually passed? therefore specifying path for ruby
RAILS_ENV=production sudo -E -u discourse /opt/discourse/bin/ruby phpbb3.rb

Update November 11th 2014:
I learnt now that you can use this command that will run the upgrade script in the right environment (Thank you Cyril Rohr from packager.io!):

discourse run gem install mysql2
discourse run ruby ./script/import_scripts/phpbb3.rb

To deactivate all users that never have posted to the forum, you can do this in Postgresql:

su - postgres
 psql discourse 
   update users set active=false where last_posted_at is null;
   \q
 exit

Now you can enable sending of emails again.

You could actually create a backup of Discourse, reinstall the container, to get rid of the Mysql database, and import the backup.

Update November 11th 2014:
To upgrade the installation to a newer version of Discourse, you need to run as root:

apt-get update && apt-get upgrade
discourse run rake db:migrate
Migrate phpBB forum to Discourse using the Ubuntu packages from packager.io
Tagged on: