diff --git a/README.md b/README.md index 6dd0a26..e3cc437 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # dokku mongo (beta) [![Build Status](https://img.shields.io/travis/dokku/dokku-mongo.svg?branch=master "Build Status")](https://travis-ci.org/dokku/dokku-mongo) [![IRC Network](https://img.shields.io/badge/irc-freenode-blue.svg "IRC Freenode")](https://webchat.freenode.net/?channels=dokku) -Official mongo plugin for dokku. Currently defaults to installing [mongo 3.2.9](https://hub.docker.com/_/mongo/). +Official mongo plugin for dokku. Currently defaults to installing [mongo 3.4.9](https://hub.docker.com/_/mongo/). ## requirements diff --git a/config b/config index e2c05a2..b371f68 100644 --- a/config +++ b/config @@ -1,6 +1,6 @@ #!/usr/bin/env bash export MONGO_IMAGE=${MONGO_IMAGE:="mongo"} -export MONGO_IMAGE_VERSION=${MONGO_IMAGE_VERSION:="3.2.9"} +export MONGO_IMAGE_VERSION=${MONGO_IMAGE_VERSION:="3.4.9"} export MONGO_ROOT=${MONGO_ROOT:="/var/lib/dokku/services/mongo"} export PLUGIN_COMMAND_PREFIX="mongo" diff --git a/functions b/functions index 110815b..7599b8e 100755 --- a/functions +++ b/functions @@ -99,7 +99,7 @@ service_export() { local PASSWORD="$(cat "$SERVICE_ROOT/PASSWORD")" [[ -n $SSH_TTY ]] && stty -opost - docker exec "$SERVICE_NAME" bash -c "DIR=\$(mktemp -d) && mongodump -d $SERVICE -o \"\$DIR\" -u \"$SERVICE\" -p \"$PASSWORD\" --authenticationDatabase \"$SERVICE\" 1>&2 && tar cf - -C \"\$DIR\" . && rm -rf \"\$DIR\"" + docker exec "$SERVICE_NAME" bash -c "mongodump -d $SERVICE -u \"$SERVICE\" -p \"$PASSWORD\" --authenticationDatabase \"$SERVICE\" --gzip --archive 2>/dev/null" status=$? [[ -n $SSH_TTY ]] && stty opost exit $status @@ -114,7 +114,7 @@ service_import() { if [[ -t 0 ]]; then dokku_log_fail "No data provided on stdin." fi - docker exec -i "$SERVICE_NAME" bash -c "DIR=\$(mktemp -d) && tar xf - -C \"\$DIR\" && mongorestore -d $SERVICE -u \"$SERVICE\" -p \"$PASSWORD\" --authenticationDatabase \"$SERVICE\" \$(find \"\$DIR\" -mindepth 1 -maxdepth 1 -type d | head -n1) && rm -rf \"\$DIR\"" + docker exec -i "$SERVICE_NAME" bash -c "mongorestore -u \"$SERVICE\" -p \"$PASSWORD\" --authenticationDatabase \"$SERVICE\" --gzip --archive --nsFrom '\$db\$.\$coll\$' --nsTo '$SERVICE.\$coll\$'" } service_start() { diff --git a/tests/bin/docker b/tests/bin/docker index 5bd16d2..6505aae 100755 --- a/tests/bin/docker +++ b/tests/bin/docker @@ -19,7 +19,7 @@ case "$1" in echo "dokkupaas/docker-grafana-graphite 3.0.1 75dcd48a5eef 2 days ago 936.4 MB" echo "mariadb 10.1.16 f2485761e714 2 days ago 302.2 MB" echo "memcached 1.4.31 8a05b51f8876 2 days ago 132.4 MB" - echo "mongo 3.2.9 12eadb136159 2 days ago 291.1 MB" + echo "mongo 3.4.9 12eadb136159 2 days ago 291.1 MB" echo "mysql 5.7.12 57d56ac47bed 2 days ago 321.3 MB" echo "nats 0.9.4 9216d5a4eec8 2 days ago 109.3 MB" echo "postgres 9.5.4 6412eb70175e 2 days ago 265.7 MB" diff --git a/tests/service_export.bats b/tests/service_export.bats index ff32716..5ab5a88 100755 --- a/tests/service_export.bats +++ b/tests/service_export.bats @@ -27,7 +27,7 @@ teardown() { run dokku "$PLUGIN_COMMAND_PREFIX:export" l password="$(cat "$PLUGIN_DATA_ROOT/l/PASSWORD")" assert_exit_status 0 - assert_output "docker exec dokku.mongo.l bash -c DIR=\$(mktemp -d) && mongodump -d l -o \"\$DIR\" -u \"l\" -p \"$password\" --authenticationDatabase \"l\" 1>&2 && tar cf - -C \"\$DIR\" . && rm -rf \"\$DIR\"" + assert_output "docker exec dokku.mongo.l bash -c mongodump -d l -u \"l\" -p \"$password\" --authenticationDatabase \"l\" --gzip --archive 2>/dev/null" } @test "($PLUGIN_COMMAND_PREFIX:export) success without SSH_TTY" { @@ -36,5 +36,5 @@ teardown() { run dokku "$PLUGIN_COMMAND_PREFIX:export" l password="$(cat "$PLUGIN_DATA_ROOT/l/PASSWORD")" assert_exit_status 0 - assert_output "docker exec dokku.mongo.l bash -c DIR=\$(mktemp -d) && mongodump -d l -o \"\$DIR\" -u \"l\" -p \"$password\" --authenticationDatabase \"l\" 1>&2 && tar cf - -C \"\$DIR\" . && rm -rf \"\$DIR\"" + assert_output "docker exec dokku.mongo.l bash -c mongodump -d l -u \"l\" -p \"$password\" --authenticationDatabase \"l\" --gzip --archive 2>/dev/null" } diff --git a/tests/service_import.bats b/tests/service_import.bats index 65f0400..d0f173b 100755 --- a/tests/service_import.bats +++ b/tests/service_import.bats @@ -32,6 +32,6 @@ teardown() { export ECHO_DOCKER_COMMAND="true" run dokku "$PLUGIN_COMMAND_PREFIX:import" l < "$PLUGIN_DATA_ROOT/fake.dump.tar" password="$(cat "$PLUGIN_DATA_ROOT/l/PASSWORD")" - assert_output "docker exec -i dokku.mongo.l bash -c DIR=\$(mktemp -d) && tar xf - -C \"\$DIR\" && mongorestore -d l -u \"l\" -p \"$password\" --authenticationDatabase \"l\" \$(find \"\$DIR\" -mindepth 1 -maxdepth 1 -type d | head -n1) && rm -rf \"\$DIR\"" + assert_output "docker exec -i dokku.mongo.l bash -c mongorestore -u \"l\" -p \"$password\" --authenticationDatabase \"l\" --gzip --archive --nsFrom '\$db\$.\$coll\$' --nsTo 'l.\$coll\$'" } diff --git a/tests/service_list.bats b/tests/service_list.bats index 2e00e00..d076772 100755 --- a/tests/service_list.bats +++ b/tests/service_list.bats @@ -11,20 +11,20 @@ teardown() { @test "($PLUGIN_COMMAND_PREFIX:list) with no exposed ports, no linked apps" { run dokku "$PLUGIN_COMMAND_PREFIX:list" - assert_contains "${lines[*]}" "l mongo:3.2.9 running - -" + assert_contains "${lines[*]}" "l mongo:3.4.9 running - -" } @test "($PLUGIN_COMMAND_PREFIX:list) with exposed ports" { dokku "$PLUGIN_COMMAND_PREFIX:expose" l 4242 4243 4244 4245 run dokku "$PLUGIN_COMMAND_PREFIX:list" - assert_contains "${lines[*]}" "l mongo:3.2.9 running 27017->4242 27018->4243 27019->4244 28017->4245 -" + assert_contains "${lines[*]}" "l mongo:3.4.9 running 27017->4242 27018->4243 27019->4244 28017->4245 -" } @test "($PLUGIN_COMMAND_PREFIX:list) with linked app" { dokku apps:create my_app dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app run dokku "$PLUGIN_COMMAND_PREFIX:list" - assert_contains "${lines[*]}" "l mongo:3.2.9 running - my_app" + assert_contains "${lines[*]}" "l mongo:3.4.9 running - my_app" dokku --force apps:destroy my_app }