Migrate a mailing list to Discourse (mbox, Listserv, Google Groups, etc)

This guide is for you if you want to migrate a mailing list to Discourse.
It also contains instructions for importing messages from image Google Groups.

1. Importing using Docker container

This is the recommended way for importing content from your mailing lists into Discourse.

1.1. Installing Discourse

:bulb: The import script most likely won’t work on systems with less than 4GB of RAM. Recommended are 8GB of RAM or more. You can scale back the RAM usage after the import if you like.

Install Discourse by following the official installation guide. Afterwards it’s a good idea to go to the Admin section and configure a few settings:

  • Enable login_required if imported topics shouldn’t be visible to the public

  • Enable hide_user_profiles_from_public if user profiles shouldn’t be visible to the public.

  • Disable download_remote_images_to_local if you don’t want Discourse to download images embedded in posts.

  • Enable disable_edit_notifications if you enabled download_remote_images_to_local and don’t want your users to get lots of notifications about posts edited by the system user.

  • Change the value of slug_generation_method if most of the topic titles use characters which shouldn’t be mapped to ASCII (e.g. Arabic). See this post for more information.

:bangbang: The following steps assume that you installed Discourse on Ubuntu and that you are connected to the machine via SSH or have direct access to the machine’s terminal.

1.2. Preparing the Docker container

Copy the container configuration file app.yml to import.yml and edit it with your favorite editor.

cd /var/discourse
cp containers/app.yml containers/import.yml
nano containers/import.yml
Regular import

Add - "templates/import/mbox.template.yml" to the list of templates. Afterwards it should look something like this:

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
## Uncomment these two lines if you wish to add Lets Encrypt (https)
  #- "templates/web.ssl.template.yml"
  #- "templates/web.letsencrypt.ssl.template.yml"
  - "templates/import/mbox.template.yml"

That’s it. You can save the file, close the editor and build the container.

Google Groups import

You need to add two entries to the list of templates:

  - "templates/import/chrome-dep.template.yml"
  - "templates/import/mbox.template.yml"

Afterwards it should look something like this:

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
## Uncomment these two lines if you wish to add Lets Encrypt (https)
  #- "templates/web.ssl.template.yml"
  #- "templates/web.letsencrypt.ssl.template.yml"
  - "templates/import/chrome-dep.template.yml"
  - "templates/import/mbox.template.yml"

That’s it. You can save the file, close the editor and build the container.

/var/discourse/launcher stop app
/var/discourse/launcher rebuild import

Building the container creates an import directory within the container’s shared directory. It looks like this:

/var/discourse/shared/standalone/import
├── data
└── settings.yml

1.3. Downloading messages from Google Groups (optional)

You can skip this step unless you want to migrate from image Google Groups.

Instructions for Google Groups

1.3.1. Preparation

:warning: Make sure you don’t have any pinned posts in your group, otherwise the crawler might fail to download some or all messages.

:warning: Make sure the group settings allow posting, otherwise you might see “Failed to scrape message” error messages. It might take a couple of minutes before the scraping works when you changed those settings recently.

Google account: You need a Google account that has the Manager or Owner role for your Google Group, otherwise the downloaded messages will contain censored email addresses.

Group name: You can find the group name by visiting your Google Group and looking at the browser’s address bar. image

Domain name: The URL might look a little bit differently if you are a G Suite customer. You need to know the domain name if the URL contains something like example.com. image

1.3.2 Cookies :cookie:

In order to download messages, the crawler needs to have access to a Google account that has the owner role for your group. Please visit https://myaccount.google.com/ in your browser and sign in if you aren’t already logged in. Then use a browser extension of your choice to export your cookies for google.com in a file named cookies.txt.

The recommended browser extensions is Export Cookies for Mozilla Firefox.

Upload the cookies.txt file to your server and save it within the /var/discourse/shared/standalone/import directory.

1.3.3. Download messages

:bulb: Tip: It’s a good idea to download messages inside a tmux or screen session, so that you can reconnect to the session in case of SSH connection loss.

Let’s start by entering the Docker container.

/var/discourse/launcher enter import

Replace the <group_name> (and if applicable, the <domain_name>) placeholders within the following command with the group name and domain name from step 1.3.1 and execute it inside the Docker container in order to start the download of messages.

If you didn’t find a domain name in step 1.3.1, this is the command for you:

script/import_scripts/google_groups.rb -g <group_name>

Or, if you found a domain name in step 1.3.1, use this command instead:

script/import_scripts/google_groups.rb -g <group_name> -d <domain_name>

Downloading all messages can take a long time. It mostly depends on the number of topics in your Google Group. The script will show you a message like this when it’s finished: Done (00h 26min 52sec)

:bulb: Tip: You can abort the download anytime you want by pressing Ctrl+C
When you restart the download it will continue where it left off.

1.4. Configuring the importer

You can configure the importer by editing the example settings.yml file that has been copied into the import directory.

nano /var/discourse/shared/standalone/import/settings.yml

The settings file comes with sensible defaults, but here are a few tips anyway:

  • The settings file contains multiple examples on how to split data files:

    • mbox files usually are separated by a From header. Choose a regular expression that works for your files.

    • If each of your files contains only one message, set the split_regex to an empty string. This also applies to imports from image Google Groups.

    • There’s also an example for files from the popular Listserv mailing list software.

  • prefer_html allows you to configure if the import should use the HTML part of emails when it exists. You should choose what suits you best – it heavily depends on the emails sent to your mailing list.

  • By default each user imported from the mailing list is created as staged user. You can disable that behaviour by setting staged to false.

  • If your emails do not contain a Message-ID header (like messages stored by Listserv), you should enable the group_messages_by_subject setting.

1.5. Prepare files

Each subdirectory of /var/discourse/shared/standalone/import/data gets imported as its own category and each directory should contain the data files you want to import. The file names of those do not matter.

Example: The import directory should look like this if you want to import two mailing lists with multiple mbox files:

/var/discourse/shared/standalone/import
├── data
│   ├── list 1
│   │   ├── foo
│   │   ├── bar
│   ├── list 2
│   │   ├── 2017-12.mbox
│   │   ├── 2018-01.mbox
└── settings.yml

1.6. Executing the import script

:bulb: Tip: It’s a good idea to start the import inside a tmux or screen session, so that you can reconnect to the session in case of SSH connection loss.

Let’s start the import by entering the Docker container and launching the import script inside the Docker container.

/var/discourse/launcher enter import
import_mbox.sh # inside the Docker container

Depending on the size of your mailing lists it’s now time for some :coffee: or :sleeping:
The import script will show you a message like this when it’s finished: Done (00h 26min 52sec)

:bulb: Tip: You can abort the import anytime you want by pressing Ctrl+C
When you restart the import it will continue where it left off.

You can exit and stop the Docker container after the import has finished.

exit # inside the Docker container
/var/discourse/launcher stop import

1.7. Starting Discourse

Let’s start the app container and take a look at the imported data.

/var/discourse/launcher start app

Discourse will start and Sidekiq will begin post-processing all the imported posts. This can take a considerate amount of time. You can watch the progress by logging in as admin and visiting http://discourse.example.com/sidekiq

1.8. Clean up

So, you are satisfied with the result of the import and want to free some disk space? The following commands will delete the Docker container used for importing as well as all the files used during the import.

/var/discourse/launcher destroy import
rm /var/discourse/containers/import.yml
rm -R /var/discourse/shared/standalone/import

1.9. The End

Now it’s time to celebrate and enjoy your new Discourse instance! :tada:

2. FAQ

2.1. How can I remove list names (e.g. [Foo]) from topic titles during the import?

You can use an empty tag to remove one or more prefixes from topic titles. The settings file contains an example.

2.2 How can I prevent the import script from detecting messages as already being imported?

:warning: The following steps will reset your Discourse forum to the initial state! You will need to start from scratch.

The following commands will stop the container, delete everything except the mbox files and the importer configuration and restart the container.

Commands
cd /var/discourse

./launcher stop app
./launcher stop import

rm -r ./shared/standalone/!(import)
rm ./shared/standalone/import/data/index.db

./launcher rebuild import

./launcher enter import
import_mbox.sh # inside the Docker container

2.3 How can I manipulate messages before they are imported into Discourse?

Enable index_only in settings.yml and take a look at the index.db (a SQLite database) before you run the actual import.

You can use SQL to update missing values in the database if you want. That way you don’t need to reindex any messages. The script uses only data from the index.db during the import phase. Simply disable the index_only option when you are done and rerun the importer. It will skip the indexing if none of the mbox files were changed, recalculate the content of the user and email_order tables and start the actual import process.

2.4 How can I find messages which cause problems during the import?

You can split mbox files into individual files to make it easier to find offending emails.

Commands
apt install procmail;
export FILENO=0000;
formail -ds sh -c 'cat &gt; split/msg.$FILENO' < mbox;

2.5 I have already imported a group. How can I import another group?

Create a new directory in the import/data directory and restart the import script.

2.6 I don’t have access to Mailman archives in mbox format? Is there any other way to get them?

You could give this script a try.

Last edited by @JammyDodger 2024-05-27T14:56:11Z

Check documentPerform check on document:
30개의 좋아요

@gerhard - I was able to migrate an mbox archive of 22,000 messages using this script on a Digital Ocean droplet with only 1GB RAM. No problems. Thank you for the write-up of instructions. Everything worked great. The only mistake I made on my first attempt was trying to name the /var/discourse/shared/standalone/import/data/X subfolder using a new category I created before running the script. That caused the import to place these messages into the Uncategorized category. On second attempt, I deleted the new category and tried again. This created the category name for me and placed the messages into the proper category automatically.

6개의 좋아요

이 가이드를 작성해 주셔서 감사합니다.

Google Groups 가져오기를 시도하고 있습니다. 불행히도 import_mbox.sh를 실행할 때 다음 오류가 발생합니다:

The mbox import is starting...

Traceback (most recent call last):
5: from script/import_scripts/mbox.rb:9:in `<main>'
4: from script/import_scripts/mbox.rb:10:in `<module:ImportScripts>'
3: from script/import_scripts/mbox.rb:13:in `<module:Mbox>'
2: from /var/www/discourse/script/import_scripts/mbox/support/settings.rb:9:in `load'
1: from /var/www/discourse/script/import_scripts/mbox/support/settings.rb:9:in `new'

/var/www/discourse/script/import_scripts/mbox/support/settings.rb:42:in `initialize': undefined method `each' for nil:NilClass (NoMethodError)

/var/discourse/shared/standalone/import/data/Foo 디렉터리 안의 모든 파일은 mbox가 아니라 .eml 파일입니다. 이것이 문제의 원인이 될 수 있을까요?

감사합니다!

가장 최신 버전의 가져오기 스크립트는 해당 문제를 수정합니다. 대안으로 설정 파일을 업데이트해 주세요. 최근 일부 변경 사항이 있었습니다.

5개의 좋아요

정말 감사합니다. 가져오기 스크립트를 업데이트하는 방법에 대해 조언해 주실 수 있을까요?

가져오기 스크립트만 업데이트하면 충분한가요, 아니면 가이드의 다른 단계도 다시 수행해야 하나요(어떤 단계인가요)? 해당 부분을 찾을 수 없어 어떻게 업데이트해야 하는지 알지 못하겠습니다.

말씀하신 대로 대안으로 설정 파일을 업데이트해 보았지만, 여전히 동일한 문제가 발생합니다.

감사합니다.

/var/discourse/launcher rebuild import을 실행하면 가져오기 스크립트 및 이와 관련된 모든 항목이 업데이트됩니다.

4개의 좋아요

감사합니다.

import_mbox.sh를 실행하면 다음과 같은 메시지와 함께 거의 모든 메시지가 건너뛰어집니다:

script/import_scripts/mbox.rb:12:in `<module:Mbox>'

script/import_scripts/mbox.rb:10:in `<module:ImportScripts>'

script/import_scripts/mbox.rb:9:in `<main>'

41 / 215 ( 19.1%) [59096 items/min] Failed to map post for 36a37072-e5b6-4009-878f-f0824e40eac6@googlegroups.com

undefined method `each' for nil:NilClass

/var/www/discourse/script/import_scripts/mbox/importer.rb:179:in `block in remove_tags!'

/var/www/discourse/script/import_scripts/mbox/importer.rb:176:in `loop'

/var/www/discourse/script/import_scripts/mbox/importer.rb:176:in `remove_tags!'

/var/www/discourse/script/import_scripts/mbox/importer.rb:150:in `map_first_post'

/var/www/discourse/script/import_scripts/mbox/importer.rb:104:in `block (2 levels) in import_posts'

/var/www/discourse/script/import_scripts/base.rb:503:in `block in create_posts'

/var/www/discourse/script/import_scripts/base.rb:502:in `each'

/var/www/discourse/script/import_scripts/base.rb:502:in `create_posts'

/var/www/discourse/script/import_scripts/mbox/importer.rb:98:in `block in import_posts'

/var/www/discourse/script/import_scripts/base.rb:882:in `block in batches'

/var/www/discourse/script/import_scripts/base.rb:881:in `loop'

/var/www/discourse/script/import_scripts/base.rb:881:in `batches'

/var/www/discourse/script/import_scripts/mbox/importer.rb:84:in `batches'

/var/www/discourse/script/import_scripts/mbox/importer.rb:92:in `import_posts'

/var/www/discourse/script/import_scripts/mbox/importer.rb:36:in `execute'

/var/www/discourse/script/import_scripts/base.rb:47:in `perform'

그리고 아래쪽에서는:

60 / 215 ( 27.9%) [58321 items/min] Parent message 1b46f337-95a3-4b4a-a14a-689636941580@googlegroups.com doesn't exist. Skipping 5634208e-e6df-4bd8-b361-0735f73fe554@googlegroups.com:

이러한 현상의 원인이 무엇일 수 있을까요? 감사합니다.

문제가 해결되었어야 합니다. 가져오기 컨테이너를 한 번 더 다시 빌드해 주세요.

6개의 좋아요

좋아요, 완벽하게 작동했어요. :pray: 도움을 주셔서 정말 감사합니다.

5개의 좋아요

Google Groups를 다운로드하려고 하는데 다음 오류가 발생합니다.

로그인에 실패했습니다. cookies.txt의 내용을 확인해 주세요.

권장되는 Firefox 확장 프로그램을 사용하여 쿠키를 다운로드했습니다. 어제 한 번, 그리고 오늘도 한 번 더 시도했습니다. 파일을 잘못된 이름으로 변경해 보았을 때 “not found” 오류가 발생하므로 파일이 제대로 읽히고 있음을 확인했습니다. Google 쿠키뿐만 아니라 모든 쿠키를 다운로드했습니다. 로그아웃을 한 뒤 다시 로그인하고 쿠키를 다시 다운로드했습니다.

“그룹 관리” 옵션이 있으므로 제가 관리자임을 확인할 수 있습니다.

그룹 이름을 복사하여 붙여넣은 뒤, 도메인 이름 형식이 아닌 그룹 이름 형식인지 세 번 이상 다시 확인했습니다.

무언가가 고장 난 건가요, 아니면 제 문제인가요?

@gerhard, 직접 언급해서 죄송합니다만, 이 문제를 디버깅하는 방법에 대해 간단한 조언이 있을까요? 어쩌면 로그인 엔드포인트가 변경되었을까요?

수정: 원인을 찾았습니다. 곧 PR을 제출하겠습니다. 로그인 엔드포인트가 변경되었고, 새로운 엔드포인트를 추측하여 해결했습니다. :slight_smile:

1개의 좋아요

초보자입니다. Yahoo 그룹에서 mbox 파일을 가져오려고 합니다. 아래 설명을 여러 번 따라 해 봤지만 항상 같은 오류 메시지가 나타납니다. 다른 분들도 성공적으로 가져온 사례가 있으므로, 아마도 초보자의 실수일 가능성이 높습니다. 오류 메시지는 split_regex: "^From .+@.+"가 파일을 분할할 이메일 키를 찾지 못하고 있음을 시사하는 것 같지만, 텍스트 에디터에서 정규식을 테스트해 보니 예상대로 작동합니다. 가져오기 파일의 2번째 줄은 Message-ID: <35690.0.1.959300741@eGroups.com>과 유사합니다.
어떤 아이디어가 있을까요? 미리 감사드립니다…

mbox 가져오기를 시작하는 중...

Traceback (most recent call last):
	12: from script/import_scripts/mbox.rb:9:in `<main>'
	11: from script/import_scripts/mbox.rb:10:in `<module:ImportScripts>'
	10: from script/import_scripts/mbox.rb:12:in `<module:Mbox>'
	 9: from script/import_scripts/mbox.rb:12:in `new'
	 8: from /var/www/discourse/script/import_scripts/mbox/importer.rb:11:in `initialize'
	 7: from /var/www/discourse/script/import_scripts/mbox/support/settings.rb:8:in `load'
	 6: from /usr/local/lib/ruby/2.6.0/psych.rb:577:in `load_file'
	 5: from /usr/local/lib/ruby/2.6.0/psych.rb:577:in `open'
	 4: from /usr/local/lib/ruby/2.6.0/psych.rb:578:in `block in load_file'
	 3: from /usr/local/lib/ruby/2.6.0/psych.rb:277:in `load'
	 2: from /usr/local/lib/ruby/2.6.0/psych.rb:390:in `parse'
	 1: from /usr/local/lib/ruby/2.6.0/psych.rb:456:in `parse_stream'
/usr/local/lib/ruby/2.6.0/psych.rb:456:in `parse': (/shared/import/settings.yml): did not find expected key while parsing a block mapping at line 2 column 1 (Psych::SyntaxError)

settings.yml 파일에서 오류가 발생한 것 같습니다. http://www.yamllint.com/에서 설정을 검증해 보시는 것을 추천합니다.

3개의 좋아요

고맙습니다 @gerhard 아… 그 문제를 알아채야 했는데, 제 Ruby 첫 경험이라 그랬습니다. 이제 조금 더 가까워진 것 같은데 다른 오류가 발생했습니다(아래 참조). 이제 가져오기 스크립트가 그룹 등을 로드하고 있으므로, 새 오류는 초기 문제 이후에 발생한 것으로 추정됩니다. 또한 참조된 db 파일은 가져오기 스크립트가 생성한 import/index.db(생성되지 않음)라고 가정합니다.

mbox 가져오기를 시작하는 중...

기존 그룹 로드 중...
기존 사용자 로드 중...
기존 카테고리 로드 중...
기존 게시글 로드 중...
기존 주제 로드 중...
Traceback (most recent call last):
	9: from script/import_scripts/mbox.rb:9:in `<main>'
	8: from script/import_scripts/mbox.rb:10:in `<module:ImportScripts>'
	7: from script/import_scripts/mbox.rb:12:in `<module:Mbox>'
	6: from script/import_scripts/mbox.rb:12:in `new'
	5: from /var/www/discourse/script/import_scripts/mbox/importer.rb:14:in `initialize'
	4: from /var/www/discourse/script/import_scripts/mbox/importer.rb:14:in `new'
	3: from /var/www/discourse/script/import_scripts/mbox/support/database.rb:10:in `initialize'
	2: from /var/www/discourse/script/import_scripts/mbox/support/database.rb:10:in `new'
	1: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/sqlite3-1.4.2/lib/sqlite3/database.rb:89:in `initialize'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/sqlite3-1.4.2/lib/sqlite3/database.rb:89:in `open_v2': unable to open database file (SQLite3::CantOpenException)
1개의 좋아요

SYSTEM에서 댓글을 수정할 수 없어서 대신 이 답변을 올립니다.

수정: 마무리를 위해… 제 Yahoo 그룹 가져오기가 이제 작동하고 있습니다. 적어도 9951개의 이메일을 인덱싱하는 수준까지는요. 아직 전체 가져오기를 완료하지 않아 더 진행할 부분이 있습니다. settings.yml 파일을 여러 번 수정했다가 결국 원래 상태로 되돌렸는데, 갑자기 문법 오류 없이 작동하기 시작했습니다! 왜 이렇게 일관성이 없는 수많은 오류 메시지가 발생했는지 이해가 되지 않습니다. settings.yml의 원래 문법 오류는 여전히 미스터리입니다. 위의 오류는 제게는 전혀 말이 안 됩니다… 한숨.

1개의 좋아요

@gerhard. 당신의 가이드와 정확히 같은 작업을 수행할 수 있는 훨씬 더 쉬운 방법을 찾은 것 같습니다. 이 방법은 기술적 지식이 필요 없고, 서버에 대한 관리자 접근 권한도 필요하지 않습니다. 의견을 알려주세요.

개요

기본적으로 메일링리스트를 구성한 후, 이메일 아카이브를 사용하여 과거의 대화들을 순서대로 전송하는 것입니다. 해당 이메일들은 전달(forward)되지만, 이메일 클라이언트의 “전달(Forward)” 버튼처럼 동작하지는 않습니다(그렇게 하면 헤더가 덮어쓰여지고 들여쓰기가 깨집니다). 우리가 원하는 것은 재메일링(remail)입니다(디스커스에 처음 도착했을 때와 동일한 상태로 보내는 것).

요구 사항 및 가정

  • 이전 이메일 교환 기록에 대한 접근 권한: 모든 기록을 이메일 클라이언트에 저장해 두고 이를 전달할 수 있는 자원봉사자가 필요합니다. 해당 사람을 John Doe라고 부르겠습니다.

  • 시간: 디스커스가 처리할 수 있도록 이메일 전달 과정은 매우 느려야 합니다(아카이브 크기에 따라 컴퓨터를 실행하며 이메일을 업로드하는 데 며칠이 걸릴 수 있음)

  • Thunderbird 클라이언트: 여기서는 John Doe가 이메일 클라이언트 "thunderbird"를 사용한다고 가정합니다. 다른 클라이언트로도 가능할 수 있지만 확인해 보지는 않았습니다.

다음 가이드는 두 개의 이메일 주소를 플레이스홀더로 사용합니다. 실제 주소로 대체해야 합니다.

:incoming_envelope: johndoe@example.com John Doe의 이메일 (전체 메일링리스트 아카이브를 전달할 사람)

:postbox: discourse+mailinglist-3@discoursemail.com 메일링리스트 카테고리의 이메일로 이메일을 전달하기 위한 디스커스 이메일 (방법은 설정 1. 참조)

설명서

다음은 설명서의 기본 개요입니다:

  1. 메일링리스트의 미러를 생성하려면 Mirroring a read-only mailing list in Discourse 의 가이드를 따르세요.

    참고: 이는 앞으로의 메일링리스트만 미러링합니다. 과거의 대화는 여전히 누락됩니다. 이 가이드의 나머지 부분이 바로 그 용도입니다.

  2. 디스커스가 이메일을 전달하는 방식을 변경합니다. (실제로 이것이 필요한지 확실하지 않습니다)
    forwarded_behavior

  3. 카테고리 설정을 편집하고, Custom incoming email address: 설정 항목의 끝에 |johndoe@example.com을 추가합니다.

    여기서의 파이프(|)는 ,와 유사하게 동작하며, johndoe@example.com도 해당 카테고리에 보낼 수 있음을 의미합니다.

  4. John Doe는 Thunderbird에 Mail Redirect 확장 프로그램을 설치합니다.

    이것은 일반적인 이메일 전달이 아니기 때문입니다. 이 확장 프로그램은 이메일이 John Doe의 주소가 아닌 디스커스의 이메일 주소로 처음에 도착한 것처럼 보이도록 전송합니다.

  5. John Doe는 확장 프로그램 설정으로 이동하여 다음 값을 1로 설정합니다(기본값은 5입니다).
    mail_redirect

    이것은 답글이 순서대로 도착하도록 보장합니다. 그렇지 않으면 디스커스가 답글이 연결되어 있음을 인식할 만큼 빠르지 않아 모든 답글마다 새 주제를 생성하게 됩니다. 하지만 이 과정은 전달 속도를 매우 느리게 만듭니다.

  6. John Doe는 메일링리스트의 과거 이메일을 모두 선택한 후, 우클릭하여 Redirect를 클릭합니다. 그러면 새 창이 열리며, Resend-todiscourse+mailinglist-3@discoursemail.com을 추가합니다.

이후 John Doe의 이메일 클라이언트는 이메일 아카이브를 디스커스로 천천히 전송하기 시작합니다. 잠시 후 디스커스 카테고리에 노스탤지어를 불러일으키는 오래된 대화들이 채워지고 있는지 확인해 보세요.

정리

  • 해당 카테고리의 Custom incoming email address: 설정에서 John Doe의 이메일을 제거합니다 (그리고 |도 제거하는 것을 잊지 마세요).

  • Mail Redirect 확장 프로그램을 제거합니다. 다시 필요할 가능성이 낮거나, 적어도 SMTP 연결 수를 5로 되돌려 두는 것이 좋습니다.

5개의 좋아요

우리는 이미 실행 중인 Discourse 인스턴스로 Mailman 메일링 리스트를 마이그레이션하려고 하고 있습니다. 여기에는 해당 카테고리에 대한 권한 설정이 필요한 여러 비공개 리스트가 포함되어 있습니다. 가져오기 전에 해당 카테고리를 미리 생성하더라도, 비공개 리스트의 모든 게시물은 “분류되지 않음”(즉, 자동으로 공개됨)으로 추가됩니다.

따라서 두 가지 대안적인 질문이 있습니다:

  • 가져오기 전에 가져온 메일링 리스트에 대한 권한을 설정하는 방법이 있을까요? (관리자만 볼 수 있도록 설정하는 것만으로도 우리에게 충분합니다.)
  • 메일링 리스트를 기존 카테고리(권한이 미리 설정된)에 추가하는 방법이 있을까요?
3개의 좋아요

제 디스코urs는 야후 그룹의 후속판이며, 야후 그룹 자체는 AOL 리스트서브의 후속판이었습니다. 지난 가을, 야후 대정화(Great Yahoo purge) 사태 속에서 야후 그룹의 .mbox 아카이브를 다운로드할 수 있었고, 해당 지침에 따라 메시지를 가져왔습니다. 이제 AOL 리스트서브의 일부 아카이브를 확보하게 되었는데, 이 메시지도 가져오고 싶습니다.

간단해 보이죠? import/data/foo를 만들고 메시지를 거기에 넣은 뒤 가져오기 스크립트를 실행하면 됩니다. 그런데 만약 나중에 더 완전하거나, 더 완전한 아카이브를 구할 수 있게 된다면 어떻게 될까요? 단순히 해당 파일들을 import/data/foo에 넣고 가져오기 스크립트를 다시 실행하면, 새 메시지가 동일한 카테고리에 추가될 수 있을까요?

  • 중복 제거가 될까요? 아니면 두 아카이브 모두에 포함된 메시지의 여러 사본이 보일까요?
    • 아카이브 중 하나, 둘 중 하나, 또는 둘 다에 메시지-id 헤더가 없는 경우 이 질문에 대한 답이 달라질까요?
  • 동일한 카테고리에서 새 가져오기를 실행하면 기존 메시지가 덮어써질까요?
  • 제 사용자 대부분은 메일링 리스트 모드에 있습니다. 가져오기가 진행되는 동안 수백(또는 수천) 통의 알림으로 사용자를 괴롭히지 않으려면, 게다가 비싼 Mailgun 청구서를 피하려면, 가져오기 중에는 사이트 전체의 이메일을 비활성화해야 할 것 같습니다.
3개의 좋아요

아쉽게도 그것은 불가능합니다.

네, 가져오기 스크립트에게 기존 카테고리를 재사용하도록 유도할 수 있습니다.

./launcher enter app
rails c

# URL에 표시된 카테고리 ID를 사용하십시오. 예를 들어
# 카테고리의 경로가 /c/howto/devs/56처럼 보인다면 56입니다.
category = Category.find(56)

# mbox 파일이 저장된 디렉터리 이름을 사용하십시오. 예를 들어,
# 파일이 import/data/foo에 저장되어 있다면 "foo"를 디렉터리 이름으로 사용해야 합니다.
category.custom_fields["import_id"] = "directory_name"
category.save!

예상치 못한 상황입니다. 그런 일이 발생하는 것을 본 적이 없고, 기본 권한이 아닌 다른 권한을 가진 기존 카테고리로 가져오기를 시도해 본 적도 없습니다.

작동하지 않는다면 포럼에 공지사항을 게시하고, 사이트를 읽기 전용 모드로 전환한 뒤, 백업을 생성하고, 다른 서버에서 해당 백업을 복원하여 가져오기를 실행하고, 카테고리 권한을 구성한 후, 다시 백업을 생성하여 프로덕션 사이트에 복원하는 것을 제안합니다.

3개의 좋아요

네, 가능합니다. 이전에 가져온 데이터를 확인하거나, 생성된 메시지 ID를 수정해야 하는 경우를 대비해 import/data/index.db 파일을 보관해 두는 것이 좋습니다.

네, Message-ID 헤더가 동일하다면 이미 가져온 메시지는 다시 가져오지 않습니다. 아카이브 중 하나만 Message-ID 헤더가 없다면 불운하게도 중복 제거가 되지 않습니다. 헤더가 없는 경우 메시지의 MD5 해시를 사용합니다. 두 메시지가 동일한 Message-ID 헤더를 가지고 있거나, 동일한 MD5 해시로 결과가 나오도록 확인해야 합니다.

아니요.

가져오기 동안 모든 발신 이메일이 비활성화됩니다.

3개의 좋아요

네, 기존 카테고리를 재사용하도록 가져오기 스크립트를 조작할 수 있습니다.

결국 우리가 그렇게 했습니다. 대신 Category.find_by_name()를 사용했지만, 아마도 그건 단순히 표현상의 차이일 뿐이겠죠. 우리가 “올바른” 방식을 선택했다는 걸 알게 되어 다행입니다 :wink: . 감사합니다!

3개의 좋아요