1 # This template installs MariaDB and all dependencies needed for importing from phpBB3.
4 home: /var/www/discourse
22 path: /etc/apt/sources.list.d/mariadb.list
24 # MariaDB 10.1 repository list
25 # http://mariadb.org/mariadb/repositories/
26 deb [arch=amd64,i386] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu trusty main
27 deb-src http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu trusty main
30 path: /etc/apt/preferences.d/mariadb
33 Pin: release o=MariaDB
37 path: /etc/mysql/conf.d/import.cnf
40 # disable InnoDB since it is extremly slow in Docker container
41 default-storage-engine=MyISAM
42 default-tmp-storage-engine=MyISAM
45 datadir=/shared/import/mysql/data
52 - mkdir -p /shared/import/mysql/data
53 - apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
54 - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y nano libmariadbclient-dev mariadb-server
55 - sed -Ei 's/^log/#&/' /etc/mysql/my.cnf
58 path: /etc/service/mysql/run
62 # Make sure the datadir exists, is accessible and contains all system tables
63 mkdir -p /shared/import/mysql/data
64 chown mysql -R /shared/import/mysql/data
65 /usr/bin/mysql_install_db --user=mysql
67 # Shamelessly copied from http://smarden.org/runit1/runscripts.html#mysql
69 exec /usr/sbin/mysqld -u mysql
72 path: /etc/runit/3.d/99-mysql
79 path: /usr/local/bin/import_phpbb3.sh
83 chown discourse /shared/import/settings.yml
84 chown discourse -R /shared/import/data
86 if [ -f "/shared/import/data/phpbb_mysql.sql" ]; then
87 if [ ! -f "/shared/import/mysql/imported" ]; then
88 echo "Loading database dump into MySQL..."
89 mysql -uroot -e "DROP DATABASE IF EXISTS phpbb"
90 mysql -uroot -e "CREATE DATABASE phpbb"
91 mysql -uroot --default-character-set=utf8 --database=phpbb < /shared/import/data/phpbb_mysql.sql
92 touch /shared/import/mysql/imported
99 echo "The phpBB3 import is starting..."
101 su discourse -c 'bundle exec ruby script/import_scripts/phpbb3.rb /shared/import/settings.yml'
106 - mkdir -p /shared/import/data
107 - chown discourse -R /shared/import
108 - cp -n script/import_scripts/phpbb3/settings.yml /shared/import/settings.yml
114 - echo "gem 'mysql2'" >> Gemfile
115 - echo "gem 'ruby-bbcode-to-md', :github => 'nlalonde/ruby-bbcode-to-md'" >> Gemfile
116 - su discourse -c 'bundle install --no-deployment --without test --without development --path vendor/bundle'