# Category/Topic export fails with error "database "discourse\_development" does not exist"

**URL:** https://meta.discourse.org/t/category-topic-export-fails-with-error-database-discourse-development-does-not-exist/42938
**Category:** Support
**Created:** [April 21, 2016, 2:23pm UTC](https://meta.discourse.org/t/category-topic-export-fails-with-error-database-discourse-development-does-not-exist/42938 "2016-04-21T14:23:48Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![pacharanero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pacharanero/32/500583_2.png) [@pacharanero](https://meta.discourse.org/u/pacharanero)
#### Post date: [April 21, 2016, 2:23pm UTC](https://meta.discourse.org/t/category-topic-export-fails-with-error-database-discourse-development-does-not-exist/42938/1 "2016-04-21T14:23:48Z")

</div>

I am attempting to export a Category from an up-to-date Discourse Docker deployment (v1.6.0.beta1 +14) on Digital Ocean, using the command line tool kindly documented by @neil in [this thread](https://meta.discourse.org/t/topic-and-category-export-import/38930)

I’m following these steps:

- I ssh into the DO Droplet
- `cd /var/discourse`
- execute `./launcher enter app` to enter the Docker container
- `su - discourse` to become the Discourse user
- `cd var/www/discourse`
- `bundle exec script/discourse export_category 15` (I checked beforehand via Rails console that Category id 15 is the one I need)

Unfortunately, it fails with the error  
`FATAL: database "discourse_development" does not exist (ActiveRecord::NoDatabaseError)`

The full stack trace is [here](http://pastebin.com/k6G7XNUj)

Can anyone help? Is this user error on my part or a bug?  
Should I even _have_ a development database in a production docker deploy like mine?  
Is this perhaps because I’m using `./launcher enter app` rather than `./launcher ssh app`?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [April 21, 2016, 3:38pm UTC](https://meta.discourse.org/t/category-topic-export-fails-with-error-database-discourse-development-does-not-exist/42938/2 "2016-04-21T15:38:18Z")

</div>

Can you try this?

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

```

---

<div class="post-metadata">

### Author: ![pacharanero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pacharanero/32/500583_2.png) [@pacharanero](https://meta.discourse.org/u/pacharanero)
#### Post date: [April 21, 2016, 6:15pm UTC](https://meta.discourse.org/t/category-topic-export-fails-with-error-database-discourse-development-does-not-exist/42938/3 "2016-04-21T18:15:26Z")

</div>

Woop! thanks @zogstrip. That works.

I did scour Meta for a solution, and also had a look at the source for the /scripts/discourse but I didn’t see anywhere it said about using the `discourse` command like that, without `bundle exec`.

That would appear to have solved my problem, but I would say the discourse command line tool needs a little more documentation, just to get people started. I’m far from a discourse n00b and I can see in the source that the CLI tool has command line `--help` strings for individual features/switches etc, but it needs to be clearer how to get started - eg that you invoke it without `bundle exec`.

Once again, thanks @zogstrip

Marcus

---

<div class="post-metadata">

### Author: ![pacharanero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pacharanero/32/500583_2.png) [@pacharanero](https://meta.discourse.org/u/pacharanero)
#### Post date: [April 22, 2016, 12:37pm UTC](https://meta.discourse.org/t/category-topic-export-fails-with-error-database-discourse-development-does-not-exist/42938/4 "2016-04-22T12:37:27Z")

</div>

I’ve now had chance to test the ‘round trip’ of exporting a Category from one Discourse instance and importing it into a different one. Using @zogstrip’s advice above this worked perfectly.

##on the ‘source’ instance:

```
cd /var/discourse
launcher enter app
discourse export_category [category_number]

```

## transferring the .json file

I transferred the file from the ‘source’ to ‘destination’ instance using a 2-step process:

1. SFTP from inside the Docker container to the ‘destination’ server and copy the export file to somewhere on the ‘destination’ server filesystem (but remember that this is _outside_ the Docker container)
2. Copy this file into the Docker container with `sudo cp path-file-host /var/lib/docker/aufs/mnt/FULL_CONTAINER_ID/PATH-NEW-FILE` (get container ID from `docker ps` from where you get the short CID, then `docker inspect -f '{{.Id}}' [short CID]` which returns the long CID. Thanks to [this thread](http://stackoverflow.com/questions/22907231/copying-files-from-host-to-docker-container) for the help with that.

I know that Docker 1.8 lets you use `docker cp` but I’m currently on Docker 1.7 and didn’t want to break anything by upgrading right when I need everything to work!

For my own education, I’d be really interested to hear if there is a more elegant or even single-step way of transferring the .json file across from the Docker Container in ‘source’ to inside the Docker Container in ‘destination’.

#on the ‘destination’ machine:

```
cd /var/discourse
./launcher enter app
cd [to wherever you put the .json file in your destination's Docker container]
discourse import_category [json file]

```

Marcus

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [January 10, 2019, 6:07am UTC](https://meta.discourse.org/t/category-topic-export-fails-with-error-database-discourse-development-does-not-exist/42938/5 "2019-01-10T06:07:29Z")

</div>



---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [January 11, 2019, 4:05am UTC](https://meta.discourse.org/t/category-topic-export-fails-with-error-database-discourse-development-does-not-exist/42938/6 "2019-01-11T04:05:30Z")

</div>


