dokku/dokku-mongo

Impossible to export...

sebseb30 opened this issue · 18 comments

Hello,
I try to export with command dokku mongo:export dbname > back.dump
The file is generated but empty ...
What is the problem please ?
Thanks

Is the command exiting non-zero?

Thanks for your answer
But sorry I don't understand what you mean by non-zero ?

Shell commands will exit with either exit code 0 or some other number. Anything other than zero means there was an error.

If you run dokku mongo:export dbname ; echo $?, what is the output (if any)? echo $? after a command will echo the last exit code.

Thanks for the explain Jose
It return 1 as exit code

Can you run the following:

dokku --trace mongo:export dbname

And gist the entire output for me?

Many thanks Jose for your help

  • export DOKKU_DISTRO
    ++ . /etc/os-release
    ++ echo ubuntu
  • DOKKU_DISTRO=ubuntu
  • export DOKKU_IMAGE=gliderlabs/herokuish
  • DOKKU_IMAGE=gliderlabs/herokuish
  • export DOKKU_LIB_ROOT=/var/lib/dokku
  • DOKKU_LIB_ROOT=/var/lib/dokku
  • export PLUGIN_PATH=/var/lib/dokku/plugins
  • PLUGIN_PATH=/var/lib/dokku/plugins
  • export PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
  • PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
  • export PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
  • PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
  • export PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
  • PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
  • export PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
  • PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
  • export PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
  • PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
  • export DOKKU_API_VERSION=1
  • DOKKU_API_VERSION=1
  • export DOKKU_NOT_IMPLEMENTED_EXIT=10
  • DOKKU_NOT_IMPLEMENTED_EXIT=10
  • export DOKKU_VALID_EXIT=0
  • DOKKU_VALID_EXIT=0
  • export DOKKU_LOGS_DIR=/var/log/dokku
  • DOKKU_LOGS_DIR=/var/log/dokku
  • export DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
  • DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
  • export DOKKU_CONTAINER_LABEL=dokku
  • DOKKU_CONTAINER_LABEL=dokku
  • export DOKKU_GLOBAL_RUN_ARGS=--label=dokku
  • DOKKU_GLOBAL_RUN_ARGS=--label=dokku
  • source /var/lib/dokku/core-plugins/available/common/functions
    ++ set -eo pipefail
    ++ [[ -n 1 ]]
    ++ set -x
  • parse_args mongo:export bmd
  • declare 'desc=top-level cli arg parser'
  • local next_index=1
  • local skip=false
  • args=("$@")
  • local args
  • for arg in '"$@"'
  • [[ false == \t\r\u\e ]]
  • case "$arg" in
  • next_index=2
  • for arg in '"$@"'
  • [[ false == \t\r\u\e ]]
  • case "$arg" in
  • next_index=3
  • return 0
  • args=("$@")
  • skip_arg=false
  • [[ mongo:export =~ ^--.* ]]
  • has_tty
  • declare 'desc=return 0 if we have a tty'
    ++ /usr/bin/tty
  • [[ /dev/pts/0 == \n\o\t\ \a\ \t\t\y ]]
  • return 0
    ++ id -un
  • [[ dokku != \d\o\k\k\u ]]
  • [[ mongo:export =~ ^plugin:.* ]]
  • [[ mongo:export == \s\s\h-\k\e\y\s:\a\d\d ]]
  • [[ -n '' ]]
  • dokku_auth mongo:export bmd
  • declare 'desc=calls user-auth plugin trigger'
  • export SSH_USER=root
  • SSH_USER=root
  • export SSH_NAME=default
  • SSH_NAME=default
  • plugn trigger user-auth root default mongo:export bmd
  • source /var/lib/dokku/core-plugins/available/common/functions
    ++ set -eo pipefail
    ++ [[ -n 1 ]]
    ++ set -x
  • [[ ! -n '' ]]
  • source /var/lib/dokku/core-plugins/available/common/functions
    ++ set -eo pipefail
    ++ [[ -n 1 ]]
    ++ set -x
  • [[ mongo:export =~ (ssh-keys:add|ssh-keys:remove) ]]
  • return 0
  • case "$1" in
  • execute_dokku_cmd mongo:export bmd
  • declare 'desc=executes dokku sub-commands'
  • local PLUGIN_NAME=mongo:export
  • local PLUGIN_CMD=mongo:export
  • local implemented=0
  • local script
  • argv=("$@")
  • local argv
  • case "$PLUGIN_NAME" in
    ++ readlink -f /var/lib/dokku/plugins/enabled/mongo
  • [[ /var/lib/dokku/plugins/available/mongo == core-plugins ]]
  • [[ -x /var/lib/dokku/plugins/enabled/mongo:export/subcommands/default ]]
  • [[ -x /var/lib/dokku/plugins/enabled/mongo:export/subcommands/mongo:export ]]
  • [[ -x /var/lib/dokku/plugins/enabled/mongo/subcommands/export ]]
  • [[ -n export ]]
  • /var/lib/dokku/plugins/enabled/mongo/subcommands/export mongo:export bmd
  • source /var/lib/dokku/plugins/enabled/common/functions
    ++ set -eo pipefail
    ++ [[ -n 1 ]]
    ++ set -x
    ++++ dirname /var/lib/dokku/plugins/enabled/mongo/subcommands/export
    +++ cd /var/lib/dokku/plugins/enabled/mongo/subcommands
    +++ pwd
    ++ dirname /var/lib/dokku/plugins/enabled/mongo/subcommands
  • source /var/lib/dokku/plugins/enabled/mongo/functions
    ++++ dirname /var/lib/dokku/plugins/enabled/mongo/functions
    +++ cd /var/lib/dokku/plugins/enabled/mongo
    +++ pwd
    ++ source /var/lib/dokku/plugins/enabled/mongo/config
    +++ export MONGO_IMAGE=mongo
    +++ MONGO_IMAGE=mongo
    +++ export MONGO_IMAGE_VERSION=3.4.9
    +++ MONGO_IMAGE_VERSION=3.4.9
    +++ export MONGO_ROOT=/var/lib/dokku/services/mongo
    +++ MONGO_ROOT=/var/lib/dokku/services/mongo
    +++ export MONGO_HOST_ROOT=/var/lib/dokku/services/mongo
    +++ MONGO_HOST_ROOT=/var/lib/dokku/services/mongo
    +++ PLUGIN_UNIMPLEMENTED_SUBCOMMANDS=()
    +++ export PLUGIN_UNIMPLEMENTED_SUBCOMMANDS
    +++ export PLUGIN_COMMAND_PREFIX=mongo
    +++ PLUGIN_COMMAND_PREFIX=mongo
    +++ export PLUGIN_CONFIG_ROOT=/var/lib/dokku/config/mongo
    +++ PLUGIN_CONFIG_ROOT=/var/lib/dokku/config/mongo
    +++ export PLUGIN_DATA_ROOT=/var/lib/dokku/services/mongo
    +++ PLUGIN_DATA_ROOT=/var/lib/dokku/services/mongo
    +++ export PLUGIN_DATA_HOST_ROOT=/var/lib/dokku/services/mongo
    +++ PLUGIN_DATA_HOST_ROOT=/var/lib/dokku/services/mongo
    +++ PLUGIN_DATASTORE_PORTS=(27017 27018 27019 28017)
    +++ export PLUGIN_DATASTORE_PORTS
    +++ export PLUGIN_DATASTORE_WAIT_PORT=27017
    +++ PLUGIN_DATASTORE_WAIT_PORT=27017
    +++ export PLUGIN_DEFAULT_ALIAS=MONGO
    +++ PLUGIN_DEFAULT_ALIAS=MONGO
    +++ export PLUGIN_DISABLE_PULL=
    +++ PLUGIN_DISABLE_PULL=
    +++ export PLUGIN_DISABLE_PULL_VARIABLE=MONGO_DISABLE_PULL
    +++ PLUGIN_DISABLE_PULL_VARIABLE=MONGO_DISABLE_PULL
    +++ export PLUGIN_ALT_ALIAS=DOKKU_MONGO
    +++ PLUGIN_ALT_ALIAS=DOKKU_MONGO
    +++ export PLUGIN_IMAGE=mongo
    +++ PLUGIN_IMAGE=mongo
    +++ export PLUGIN_IMAGE_VERSION=3.4.9
    +++ PLUGIN_IMAGE_VERSION=3.4.9
    +++ export PLUGIN_SCHEME=mongodb
    +++ PLUGIN_SCHEME=mongodb
    +++ export PLUGIN_SERVICE=MongoDB
    +++ PLUGIN_SERVICE=MongoDB
    +++ export PLUGIN_VARIABLE=MONGO
    +++ PLUGIN_VARIABLE=MONGO
    +++ export PLUGIN_BASE_PATH=/var/lib/dokku/plugins
    +++ PLUGIN_BASE_PATH=/var/lib/dokku/plugins
    +++ [[ -n 1 ]]
    +++ export PLUGIN_BASE_PATH=/var/lib/dokku/plugins/enabled
    +++ PLUGIN_BASE_PATH=/var/lib/dokku/plugins/enabled
    +++ [[ -d /var/lib/dokku/services/mongo/* ]]
    +++ export 'MONGO_CONFIG_OPTIONS= --storageEngine wiredTiger --auth '
    +++ MONGO_CONFIG_OPTIONS=' --storageEngine wiredTiger --auth '
    ++ set -eo pipefail
    ++ [[ -n 1 ]]
    ++ set -x
    ++++ dirname /var/lib/dokku/plugins/enabled/mongo/functions
    +++ cd /var/lib/dokku/plugins/enabled/mongo
    +++ pwd
    ++ source /var/lib/dokku/plugins/enabled/mongo/common-functions
    +++ set -eo pipefail
    +++ [[ -n 1 ]]
    +++ set -x
    +++ source /var/lib/dokku/plugins/available/config/functions
    ++++ set -eo pipefail
    ++++ [[ -n 1 ]]
    ++++ set -x
    ++++ source /var/lib/dokku/core-plugins/available/common/functions
    +++++ set -eo pipefail
    +++++ [[ -n 1 ]]
    +++++ set -x
    ++ source /var/lib/dokku/plugins/enabled/common/functions
    +++ set -eo pipefail
    +++ [[ -n 1 ]]
    +++ set -x
    ++ source /var/lib/dokku/plugins/available/config/functions
    +++ set -eo pipefail
    +++ [[ -n 1 ]]
    +++ set -x
    +++ source /var/lib/dokku/core-plugins/available/common/functions
    ++++ set -eo pipefail
    ++++ [[ -n 1 ]]
    ++++ set -x
    ++ [[ -f /var/lib/dokku/plugins/available/docker-options/functions ]]
    ++ source /var/lib/dokku/plugins/available/docker-options/functions
    +++ set -eo pipefail
    +++ [[ -n 1 ]]
    +++ set -x
    +++ source /var/lib/dokku/core-plugins/available/common/functions
    ++++ set -eo pipefail
    ++++ [[ -n 1 ]]
    ++++ set -x
    +++ AVAILABLE_PHASES=(build deploy run)
  • service-export-cmd mongo:export bmd
  • declare 'desc=export a dump of the MongoDB service database'
  • argv=("$@")
  • local cmd=mongo:export argv
  • [[ mongo:export == \m\o\n\g\o:\e\x\p\o\r\t ]]
  • shift 1
  • declare SERVICE=bmd
  • is_implemented_command mongo:export
  • declare 'desc=return true if value (mongo:export) is in list (all other arguments)'
  • declare CMD=mongo:export
    ++ cut -d : -f2
    ++ echo mongo:export
  • CMD=export
  • [[ 0 -eq 0 ]]
  • return 0
  • [[ -z bmd ]]
  • verify_service_name bmd
  • declare 'desc=Verifies that a service exists'
  • declare SERVICE=bmd
  • [[ ! -n bmd ]]
  • [[ ! -d /var/lib/dokku/services/mongo/bmd ]]
  • return 0
  • service_export bmd
  • local SERVICE=bmd
  • local SERVICE_ROOT=/var/lib/dokku/services/mongo/bmd
    ++ get_service_name bmd
    ++ declare 'desc=Retrieves a docker service label'
    ++ declare SERVICE=bmd
    ++ echo dokku.mongo.bmd
  • local SERVICE_NAME=dokku.mongo.bmd
    ++ cat /var/lib/dokku/services/mongo/bmd/PASSWORD
  • local PASSWORD=1f12f2c3fa132fe9a5cb23caf70def56
  • [[ -n /dev/pts/0 ]]
  • stty -opost
  • docker exec dokku.mongo.bmd bash -c 'mongodump -d bmd -u "bmd" -p "1f12f2c3fa132fe9a5cb23caf70def56" --authenticationDatabase "bmd" --quiet --gzip --archive 2>/dev/null'

What is the output of

docker exec dokku.mongo.bmd bash -c 'mongodump -d bmd -u "bmd" -p "1f12f2c3fa132fe9a5cb23caf70def56" --authenticationDatabase "bmd" --quiet --gzip --archive 

Nothing, it's like waiting for an input string

_

Try:

docker exec dokku.mongo.bmd bash -c 'mongodump -d bmd -u "bmd" -p "1f12f2c3fa132fe9a5cb23caf70def56" --authenticationDatabase "bmd" --gzip --archive 

Same thing it's like waiting an answer
I see there is only one quote, so I try to close like this :
docker exec dokku.mongo.bmd bash -c 'mongodump -d bmd -u "bmd" -p "1f12f2c3fa132fe9a5cb23caf70def56" --authenticationDatabase "bmd" --gzip --archive'
and I have a message : Failed: error connecting to db server: server returned error on SASL authentication step: Authentication failed.

Did you change the root password on that database at some point? Thats the only reason this would fail.

Possible maybe I need for the application ( in my datasource.json with loopback I need password)
Kid of db.changeUserPassword("bmd", ....
But I am in root user isn't possible to export ?

It's saying the root cannot authenticate, so I'm guessing you changed the root user password and the one we know about is now incorrect.

So do you know how To put same password between mongodb and dokker or other I am a little bit loosing...

Many thanks Jose

Change the root user password back to what it was before. Seems like that was 1f12f2c3fa132fe9a5cb23caf70def56. Do not change the password for future instances.

Thanks a lot Jose !
It's ok now by changing all passwords !

Great!

@josegonzalez Hi! I have the similar issue running dokku mongo:import after changing my password for my dokku instance droplet. I get error connecting to db server: server returned error on SASL authentication step

Is there a way to change the password permanently? this password is too long to remember in emergency.