Nodebb para Discourse

Preciso de um pouco de orientação sobre a migração do NodeBB para o Discourse. Vi este tópico e percebi que @eatcodetravel criou o script. Não estou conseguindo entender como esses scripts são executados. Preciso instalar o Redis no servidor onde o Discourse está rodando também para a importação?

Agradeço a ajuda.

Hey @michael,

You need redis to run discourse. The nodebb importer is only available if you use redis as your nodebb database. Here is how I would do the migration.

  1. Setup a discourse environment (it can be your machine or an instance in the cloud)
  2. Change the nodebb importer configuration (take a look at the code, there’s comments on what you need to replace)
  3. Run the importer with bundle exec ruby script/import_scripts/nodebb/nodebb.rb from the discourse folder
  4. (Optional) make a backup of discourse and restore it where you need it

The importer will connect to your nodebb redis database and copy everything over discourse, the time it takes is related to the amount of data you have. Also, you need to wait for discourse to finish processing jobs before you do the backup, go to /sidekiq route as an admin and you will see the pending/completed jobs

Hope it helps

6 curtidas

Obrigado!

Estou executando o Discourse através do Digital Ocean + Docker. Editei o arquivo script/import_scripts/nodebb/nodebb.rb dentro do container e modifiquei ATTACHMENT_DIR para incluir o diretório onde tenho o NodeBB. Também coloquei o diretório do NodeBB dentro do container.

E quanto ao arquivo de despejo do Redis?

Oh I see there’s no comment in the redis connection parameters, I’ll open a PR for that

Here’s where you put the connection parameters for nodebb redis discourse/script/import_scripts/nodebb/nodebb.rb at main · discourse/discourse · GitHub

1 curtida

Here are the quick steps I took when I first ran the importer when it was under development. I can also attest to it working wonderfully.

  • Setup a dev environment of Discourse per Beginners Guide to Install Discourse on Ubuntu for Development
  • Stopped redis
  • Copied the dump.rdb file from NodeBB and overwrote the redis dump file that exists
  • Copied the uploads directory from NodeBB to the dev box
  • Edited the nodebb.rb file to point to the copied uploads directory
  • Ran the importer bundle exec ruby script/import_scripts/nodebb/nodebb.rb

I do recommend taking a look at Preparing for and undertaking a platform migration, it has some great steps for validation and planning a migration.

5 curtidas

Obrigado @eatcodetravel e @tehspaceg

Após executar exec ruby script/import_scripts/nodebb/nodebb.rb, recebo o seguinte:

Sem conexão com o banco de dados, não foi possível recuperar as configurações do site! (normal ao executar db:create)

Movi dump.rdb do servidor NodeBB para meu contêiner Docker do Discourse em /shared/redis_data.

Alguma ideia? :thinking:

Uma suposição ousada aqui. Acho que não está importando o arquivo de despejo do Redis.

Estou sem saída. Sou novo no Redis e certamente aprendi muito, mas não consigo entender essa última peça do quebra-cabeça.

I neglected to write down the actual paths to files, I just had those notes from when I did it.

Are you using a dev environment outside of the Docker image? it might make it easier ensure redis is stopped when you replace the dump.rdb file.

Edit: I wrote this before finishing coffee. So the reason I suggest that you need to have redis stopped is that I don’t think it will read from the dump file until after it has been stopped (redis stores the database in memory and periodically writes to the dump.rdb file)

2 curtidas

Tentei parar o Redis, mas parece que ele continua em execução, não importa o que eu faça. Matei o processo uma dúzia de vezes, mas ele ainda está rodando. :confused:

Estou tentando novamente. O mesmo erro continua aparecendo e inclui:

FATAL: Peer authentication failed for user “discourse” (PG::ConnectionBad)

Devo estar executando isso dentro do contêiner Docker? É isso que tenho feito como root. Também tentei como discourse, o que resulta em:

FATAL: database “discourse_development” does not exist (ActiveRecord::NoDatabaseError)

Não tenho certeza do que posso estar fazendo de errado.

No, as per instructions you should:

3 curtidas

Era isso. Eu não sabia que o Docker não podia ser usado de jeito nenhum.

1 curtida