Hello,
Having already done a merge of two forums in April, on a test server, which went very well. We decided to merge the two forums for good.
Following my procedure of the time, I find myself with a connection error to Postgres, when launching the merge script.
I’ve been at it for four days now, but not being a developer, I’m a bit limited in finding the problem.
Thanks for advance
Here is the error:
discourse@serveur-app:/var/www/discourse$ IMPORT=1 DB_NAME=copyme DB_PASS=passwdDB SOURCE_BASE_URL=http://old.forum.fr UPLOADS_PATH=/var/www/discourse/public/uploads/default bundle exec ruby script/bulk_import/discourse_merger.rb
Loading application...
Traceback (most recent call last):
5: from script/bulk_import/discourse_merger.rb:817:in `<main>'
4: from script/bulk_import/discourse_merger.rb:817:in `new'
3: from script/bulk_import/discourse_merger.rb:22:in `initialize'
2: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/pg-1.4.2/lib/pg.rb:69:in `connect'
1: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/pg-1.4.2/lib/pg/connection.rb:661:in `new'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/pg-1.4.2/lib/pg/connection.rb:708:in `connect_to_hosts': could not match 0 port numbers to 1 hosts (PG::ConnectionBad)
I take this opportunity to put the complete merger procedure.
This procedure is based on the original post and the problems encountered during my tests
This procedure worked in April (see this topic).
- Start with updated backups of the two forums,
- Install a discourse,
- Import the two backups,
- Restore the forum to keep.
In SSH :
- Go to the
/var/discourse
folder - Enter the app
./launcher enter app
.
Create the DB.
su postgres
psql
CREATE DATABASE copyme ENCODING='utf8';
Change the password of the postgres user
\postgres password
Exit postgres
\q
Exit the postgres user
exit
Switch to the discourse user
su discourse
OLD forum save decompression
Go to the latter folder cd public/backups/default
Extract the OLD backup via the command tar xvzf old.forum.tar.gz
Copy from BDD.lu to BDD copyme.
gunzip < dump.sql.gz | psql -d copyme
Exit user discourse
exit
Dependencies
nano, sqlite3 and mysql2 dependencies
(with root user in /var/www/discourse)
apt update && apt upgrade -y
apt-get install -y nano sqlite3 libsqlite3-dev mariadb-server libmariadb-dev -y
gem install sqlite3 mysql2
ruby bbcode to md
git clone https://github.com/nlalonde/ruby-bbcode-to-md.git
cd ruby-bbcode-to-md/
gem build ruby-bbcode-to-md.gemspec
gem install ruby-bbcode-to-md-*.gem
cd ./..
Installing Tiny_tds
You have to install FreeTDS then Tiny_tds.
For FreeTDS:
wget http://www.freetds.org/files/stable/freetds-1.3.12.tar.gz
tar -xzf freetds-1.3.12.tar.gz
cd freetds-1.3.12
./configure --prefix=/usr/local --with-tdsver=7.3
make
make install
For Tiny_tds :
gem install tiny_tds
gem install ruby-bbcode-to-md
cd ./..
The script
su discourse
bundle config unset deployment
IMPORT=1 bundle install
IMPORT=1 DB_NAME=copyme DB_PASS=passwdDB SOURCE_BASE_URL=http://old.forum.fr UPLOADS_PATH=/var/www/discourse/public/uploads/default bundle exec ruby script/bulk_import/discourse_merger.rb
Translated with www.DeepL.com/Translator (free version)