dokku / dokku-mongo

a mongo plugin for dokku
MIT License
174 stars 32 forks source link

mongo:export with remote command creates corrupt tar file #84

Closed bradwbradw closed 6 years ago

bradwbradw commented 7 years ago
ssh dokku@example.com mongo:export xyz > ~/mongo.tar
Connection to example.com closed.
tar -xvf mongo.tar 
tar: Unrecognized archive format
tar: Error exit delayed from previous errors.

when opening the tar file in a text editor, you can see that the command's verbose output has been concatenated to the top

2017-05-24T19:36:24.433+0000 writing xyz.SpaceSong to 2017-05-24T19:36:24.434+0000 writing xyz.Song to 2017-05-24T19:36:24.435+0000 writing xyz.dj to 2017-05-24T19:36:24.436+0000 done dumping xyz.RoleMapping (11 documents) ...

So the tar file is dirty because it contains all this text that would normally just appear in the console when running dokku mongo:export while SSH'd in (not remote command)

justintemps commented 6 years ago

I have this issue whether I try to download the export via ssh as per @bradwbradw 's example, or whether I create the file on the server first and try to execute the command there.

$ ssh user@example.com
$ dokku mongo:export database > backup.tar
$ tar -xfv backup.tar
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors