# How to edit an import script on the production server?

**URL:** https://meta.discourse.org/t/how-to-edit-an-import-script-on-the-production-server/282505
**Category:** Migration
**Tags:** vanilla
**Created:** [October 17, 2023, 9:45am UTC](https://meta.discourse.org/t/how-to-edit-an-import-script-on-the-production-server/282505 "2023-10-17T09:45:17Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![ddeveloper](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ddeveloper/32/333791_2.png) [@ddeveloper](https://meta.discourse.org/u/ddeveloper)
#### Post date: [October 17, 2023, 9:45am UTC](https://meta.discourse.org/t/how-to-edit-an-import-script-on-the-production-server/282505/1 "2023-10-17T09:45:17Z")

</div>

How do you edit vanila.rb on production server directly?

I’m getting the same error and I know nothing about ruby.

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [October 17, 2023, 11:59am UTC](https://meta.discourse.org/t/how-to-edit-an-import-script-on-the-production-server/282505/2 "2023-10-17T11:59:15Z")

</div>

Hey 👋, if you have a standard installation, usually you would do the following:

```plaintext
cd /var/discourse
./launcher enter app

cd script/import_scripts

```

Then you can edit `vanilla.rb` here.

---

<div class="post-metadata">

### Author: ![ddeveloper](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ddeveloper/32/333791_2.png) [@ddeveloper](https://meta.discourse.org/u/ddeveloper)
#### Post date: [October 17, 2023, 12:02pm UTC](https://meta.discourse.org/t/how-to-edit-an-import-script-on-the-production-server/282505/3 "2023-10-17T12:02:12Z")

</div>

Is there default editor? Because, nano and vim aren’t working in launcher.

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [October 17, 2023, 12:02pm UTC](https://meta.discourse.org/t/how-to-edit-an-import-script-on-the-production-server/282505/4 "2023-10-17T12:02:46Z")

</div>

You can install it using `apt update && apt install nano` ; this should work.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [October 17, 2023, 12:03pm UTC](https://meta.discourse.org/t/how-to-edit-an-import-script-on-the-production-server/282505/5 "2023-10-17T12:03:08Z")

</div>

Welcome, Shin 🙂

Just to know more about your import, are you following this guide (it uses the Vanilla script as an example)?

> [@Set up an environment to migrate another forum to Discourse](https://meta.discourse.org/t/set-up-an-environment-to-migrate-another-forum-to-discourse/88252):
>
> Want to setup a Discourse import environment? Let’s get started! Setup a Discourse instance on DigitalOcean Setup a Discourse instance on DigitalOcean using our [official guide](https://github.com/discourse/discourse/blob/main/docs/INSTALL-cloud.md). Email setup is not required for migration. I accessed the instance using DigitalOcean allotted IP instead of setting up a domain name. Download the import data on server cd /var/discourse/shared/ mkdir import\_data Download the import data (using curl, wget, sftp, etc) and unzip the files if required. Let’s assume the…

---

<div class="post-metadata">

### Author: ![ddeveloper](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ddeveloper/32/333791_2.png) [@ddeveloper](https://meta.discourse.org/u/ddeveloper)
#### Post date: [October 17, 2023, 12:05pm UTC](https://meta.discourse.org/t/how-to-edit-an-import-script-on-the-production-server/282505/6 "2023-10-17T12:05:19Z")

</div>

Thank you very much.

Whenever I searched on forum I found this this guide:

> [@Migrate a Vanilla forum to Discourse](https://meta.discourse.org/t/migrate-a-vanilla-forum-to-discourse/27273):
>
> I know there are a lot of posts about importing contents from a vanilla forum, but theres a lack of comprehensive guide! Not everyone can afford to hire a developer to migrate their forums and this is my way of giving back to this community smile So here it goes: You Need: Terminal (if mac) or alternative for windows A mind strong enough to understand and follow this guide! Patience A cup of coffee Step 1: Getting the Importer file! Use this addon to get the porter file: [Vanilla Porter A…](http://vanillaforums.org/addon/porter-core)

---

<div class="post-metadata">

### Author: ![ddeveloper](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ddeveloper/32/333791_2.png) [@ddeveloper](https://meta.discourse.org/u/ddeveloper)
#### Post date: [October 17, 2023, 12:05pm UTC](https://meta.discourse.org/t/how-to-edit-an-import-script-on-the-production-server/282505/7 "2023-10-17T12:05:57Z")

</div>

Thank you very much. I had tried that earlier but for some reason it works now 😃

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [October 17, 2023, 12:08pm UTC](https://meta.discourse.org/t/how-to-edit-an-import-script-on-the-production-server/282505/8 "2023-10-17T12:08:21Z")

</div>

An alternative can be configuring an editor like Visual Studio Code to connect to the remote container and edit the files from here, right? Editing a script via a command-line tool such as nano can quickly be a painful experience.

Also, I think the files you modify will be overwritten if you rebuild your image.

I don’t quite remember how all of this works despite having made multiple migrations. 😅

---

<div class="post-metadata">

### Author: ![ddeveloper](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ddeveloper/32/333791_2.png) [@ddeveloper](https://meta.discourse.org/u/ddeveloper)
#### Post date: [October 17, 2023, 12:11pm UTC](https://meta.discourse.org/t/how-to-edit-an-import-script-on-the-production-server/282505/9 "2023-10-17T12:11:31Z")

</div>

Yes it is quite hectic to modify files through command-line tools. It’s just that discourse has all the tools and features to power a well managed community.

I’ve migrated from several forums before but have 0 knowledge of ruby.

If it overwrites files, the only other solution is to create a plugin in dev box?

---

<div class="post-metadata">

### Author: ![packman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/packman/32/289322_2.png) [@packman](https://meta.discourse.org/u/packman)
#### Post date: [October 17, 2023, 12:47pm UTC](https://meta.discourse.org/t/how-to-edit-an-import-script-on-the-production-server/282505/10 "2023-10-17T12:47:18Z")

</div>

> [@ddeveloper](#):
>
> I’ve migrated from several forums before but have 0 knowledge of ruby.

I was in exactly that same position about 12 months ago. I learned enough Ruby to modify the SMF import script to migrate a 700,000 post/8,000 user forum and I’ve been happily running Discourse since our migration in March.

So what you’re trying to do is definitely achievable and the support you’ll get here will help you reach your goal.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [October 17, 2023, 12:53pm UTC](https://meta.discourse.org/t/how-to-edit-an-import-script-on-the-production-server/282505/11 "2023-10-17T12:53:46Z")

</div>

I’d like to quote this:

> [@What I should do for migration from Cusdis to Discourse](https://meta.discourse.org/t/what-i-should-do-for-migration-from-cusdis-to-discourse/244293/2):
>
> I wrote several [importers] before really learning Ruby

🙂

I also modified importers for my migrations, and I don’t know Ruby as well.

It’s not a mandatory skill at all.

Regarding how to edit the import scripts… I have edited some directly into the container when doing at least one of my migrations. That’s not a proper way to do it, so I wouldn’t recommend it, but if you’re careful not to lose your changes, that can do the trick.

---

<div class="post-metadata">

### Author: ![packman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/packman/32/289322_2.png) [@packman](https://meta.discourse.org/u/packman)
#### Post date: [October 17, 2023, 1:01pm UTC](https://meta.discourse.org/t/how-to-edit-an-import-script-on-the-production-server/282505/12 "2023-10-17T13:01:32Z")

</div>

> [@Canapin](#):
>
> That’s not a proper way to do it

It depends on what needs modifying. If it’s just a couple of simple changes then it should be OK. With the SMF import script I found it only did a partial job for me so I made significant modifications to it and re-ran partial imports dozens of times and full imports quite a few times too. It’s surprising what you find didn’t work quite as well as you thought when you get to compare the new forum content against the old content! I created a couple of scripts that would wipe the previous test Discourse system, install a new copy of Discourse and then start another import run using the latest version of the script.
