1. Set Up a Development Environment
We recommend setting up a development environment on your machine (or inside a virtual machine) and run the import there instead of inside the docker container.
Then you will be able to create a backup and import it on your production instance. Refer the macOS, Ubuntu 99, or Windows installation guide for development.
2. Read the Script & Modify as Needed
We highly recommend to read the script before performing import, as the script is meant for developers. You will almost certainly need to modify the script file before beginning.
Near the top of the scripts, a connection is made to the database containing the source data. At a minimum, these connection settings will need to be changed.
You may also want to change the SQL queries that fetch the data to import into Discourse. For example, if you want to exclude really old posts, you can add a condition to the WHERE clauses.
3. Run the Import
To run the intended import script, run the following commands:
bundle exec ruby script/import_scripts/=import_script=.rb
This process will be similar for other import scripts.
Once the import is complete, verify the data is imported correctly.
4. Take a Backup & Restore It
If you’ve followed this guide and are running a development instance, you’ll need to take a backup of the database and restore it to the production Discourse instance.