fix for #50 - remove /0 , be heroku-compatible

This commit is contained in:
Marcio Marchini
2016-05-05 13:08:11 -03:00
parent 961aad764b
commit 423bf1a4ef
5 changed files with 15 additions and 15 deletions

View File

@@ -84,7 +84,7 @@ dokku redis:link lolipop playground
# #
# and the following will be set on the linked application by default # and the following will be set on the linked application by default
# #
# REDIS_URL=redis://dokku-redis-lolipop:6379/0 # REDIS_URL=redis://dokku-redis-lolipop:6379
# #
# NOTE: the host exposed here only works internally in docker containers. If # NOTE: the host exposed here only works internally in docker containers. If
# you want your container to be reachable from outside, you should use `expose`. # you want your container to be reachable from outside, you should use `expose`.
@@ -95,7 +95,7 @@ dokku redis:link other_service playground
# since REDIS_URL is already in use, another environment variable will be # since REDIS_URL is already in use, another environment variable will be
# generated automatically # generated automatically
# #
# DOKKU_REDIS_BLUE_URL=redis://dokku-redis-other-service:6379/0 # DOKKU_REDIS_BLUE_URL=redis://dokku-redis-other-service:6379
# you can then promote the new service to be the primary one # you can then promote the new service to be the primary one
# NOTE: this will restart your app # NOTE: this will restart your app
@@ -105,8 +105,8 @@ dokku redis:promote other_service playground
# another environment variable to hold the previous value if necessary. # another environment variable to hold the previous value if necessary.
# you could end up with the following for example: # you could end up with the following for example:
# #
# REDIS_URL=redis://dokku-redis-other-service:6379/0 # REDIS_URL=redis://dokku-redis-other-service:63790
# DOKKU_REDIS_BLUE_URL=redis://dokku-redis-other-service:6379/0 # DOKKU_REDIS_BLUE_URL=redis://dokku-redis-other-service:6379
# DOKKU_REDIS_SILVER_URL=redis://dokku-redis-lolipop:6379/lolipop # DOKKU_REDIS_SILVER_URL=redis://dokku-redis-lolipop:6379/lolipop
# you can also unlink a redis service # you can also unlink a redis service

View File

@@ -295,7 +295,7 @@ service_unlink() {
service_url() { service_url() {
local SERVICE="$1" local SERVICE="$1"
local SERVICE_ALIAS="$(service_alias "$SERVICE")" local SERVICE_ALIAS="$(service_alias "$SERVICE")"
echo "$PLUGIN_SCHEME://$SERVICE_ALIAS:${PLUGIN_DATASTORE_PORTS[0]}/0" echo "$PLUGIN_SCHEME://$SERVICE_ALIAS:${PLUGIN_DATASTORE_PORTS[0]}"
} }
is_container_status () { is_container_status () {

View File

@@ -21,12 +21,12 @@ teardown() {
@test "($PLUGIN_COMMAND_PREFIX:info) success" { @test "($PLUGIN_COMMAND_PREFIX:info) success" {
run dokku "$PLUGIN_COMMAND_PREFIX:info" l run dokku "$PLUGIN_COMMAND_PREFIX:info" l
assert_contains "${lines[*]}" "DSN: redis://dokku-redis-l:6379/0" assert_contains "${lines[*]}" "DSN: redis://dokku-redis-l:6379"
} }
@test "($PLUGIN_COMMAND_PREFIX:info) replaces underscores by dash in hostname" { @test "($PLUGIN_COMMAND_PREFIX:info) replaces underscores by dash in hostname" {
dokku "$PLUGIN_COMMAND_PREFIX:create" test_with_underscores dokku "$PLUGIN_COMMAND_PREFIX:create" test_with_underscores
run dokku "$PLUGIN_COMMAND_PREFIX:info" test_with_underscores run dokku "$PLUGIN_COMMAND_PREFIX:info" test_with_underscores
assert_contains "${lines[*]}" "DSN: redis://dokku-redis-test-with-underscores:6379/0" assert_contains "${lines[*]}" "DSN: redis://dokku-redis-test-with-underscores:6379"
dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" test_with_underscores dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" test_with_underscores
} }

View File

@@ -40,12 +40,12 @@ teardown() {
@test "($PLUGIN_COMMAND_PREFIX:link) exports REDIS_URL to app" { @test "($PLUGIN_COMMAND_PREFIX:link) exports REDIS_URL to app" {
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app
url=$(dokku config:get my_app REDIS_URL) url=$(dokku config:get my_app REDIS_URL)
assert_contains "$url" "redis://dokku-redis-l:6379/0" assert_contains "$url" "redis://dokku-redis-l:6379"
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
} }
@test "($PLUGIN_COMMAND_PREFIX:link) generates an alternate config url when REDIS_URL already in use" { @test "($PLUGIN_COMMAND_PREFIX:link) generates an alternate config url when REDIS_URL already in use" {
dokku config:set my_app REDIS_URL=redis://host:6379/0 dokku config:set my_app REDIS_URL=redis://host:6379
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app
run dokku config my_app run dokku config my_app
assert_contains "${lines[*]}" "DOKKU_REDIS_" assert_contains "${lines[*]}" "DOKKU_REDIS_"
@@ -63,6 +63,6 @@ teardown() {
dokku config:set my_app REDIS_DATABASE_SCHEME=redis2 dokku config:set my_app REDIS_DATABASE_SCHEME=redis2
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app
url=$(dokku config:get my_app REDIS_URL) url=$(dokku config:get my_app REDIS_URL)
assert_contains "$url" "redis2://dokku-redis-l:6379/0" assert_contains "$url" "redis2://dokku-redis-l:6379"
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
} }

View File

@@ -39,22 +39,22 @@ teardown() {
} }
@test "($PLUGIN_COMMAND_PREFIX:promote) changes REDIS_URL" { @test "($PLUGIN_COMMAND_PREFIX:promote) changes REDIS_URL" {
dokku config:set my_app "REDIS_URL=redis://host:6379/db" "DOKKU_REDIS_BLUE_URL=redis://dokku-redis-l:6379/0" dokku config:set my_app "REDIS_URL=redis://host:6379/db" "DOKKU_REDIS_BLUE_URL=redis://dokku-redis-l:6379"
dokku "$PLUGIN_COMMAND_PREFIX:promote" l my_app dokku "$PLUGIN_COMMAND_PREFIX:promote" l my_app
url=$(dokku config:get my_app REDIS_URL) url=$(dokku config:get my_app REDIS_URL)
assert_equal "$url" "redis://dokku-redis-l:6379/0" assert_equal "$url" "redis://dokku-redis-l:6379"
} }
@test "($PLUGIN_COMMAND_PREFIX:promote) creates new config url when needed" { @test "($PLUGIN_COMMAND_PREFIX:promote) creates new config url when needed" {
dokku config:set my_app "REDIS_URL=redis://host:6379/db" "DOKKU_REDIS_BLUE_URL=redis://dokku-redis-l:6379/0" dokku config:set my_app "REDIS_URL=redis://host:6379/db" "DOKKU_REDIS_BLUE_URL=redis://dokku-redis-l:6379"
dokku "$PLUGIN_COMMAND_PREFIX:promote" l my_app dokku "$PLUGIN_COMMAND_PREFIX:promote" l my_app
run dokku config my_app run dokku config my_app
assert_contains "${lines[*]}" "DOKKU_REDIS_" assert_contains "${lines[*]}" "DOKKU_REDIS_"
} }
@test "($PLUGIN_COMMAND_PREFIX:promote) uses REDIS_DATABASE_SCHEME variable" { @test "($PLUGIN_COMMAND_PREFIX:promote) uses REDIS_DATABASE_SCHEME variable" {
dokku config:set my_app "REDIS_DATABASE_SCHEME=redis2" "REDIS_URL=redis://u:p@host:6379" "DOKKU_REDIS_BLUE_URL=redis2://dokku-redis-l:6379/0" dokku config:set my_app "REDIS_DATABASE_SCHEME=redis2" "REDIS_URL=redis://u:p@host:6379" "DOKKU_REDIS_BLUE_URL=redis2://dokku-redis-l:6379"
dokku "$PLUGIN_COMMAND_PREFIX:promote" l my_app dokku "$PLUGIN_COMMAND_PREFIX:promote" l my_app
url=$(dokku config:get my_app REDIS_URL) url=$(dokku config:get my_app REDIS_URL)
assert_equal "$url" "redis2://dokku-redis-l:6379/0" assert_equal "$url" "redis2://dokku-redis-l:6379"
} }