From 4cfa309278f129aa3c6616344a3a400113dda3f3 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 12 Sep 2021 07:09:54 -0400 Subject: [PATCH] docs: add a note as to how to specify an interface/ip to bind on when exposing a service Closes dokku/dokku-mongo#128 --- README.md | 10 ++++++++-- subcommands/expose | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 25dda4a..61f9dba 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ mysql:destroy [-f|--force] # delete the mysql service/da mysql:enter # enter or run a command in a running mysql service container mysql:exists # check if the mysql service exists mysql:export # export a dump of the mysql service database -mysql:expose # expose a mysql service on custom port if provided (random port otherwise) +mysql:expose # expose a mysql service on custom host:port if provided (random port on the 0.0.0.0 interface if otherwise unspecified) mysql:import # import a dump into the mysql service database mysql:info [--single-info-flag] # print the service information mysql:link [--link-flags...] # link the mysql service to the app @@ -276,7 +276,7 @@ You may also run a command directly against the service. Filesystem changes will dokku mysql:enter lolipop touch /tmp/test ``` -### expose a mysql service on custom port if provided (random port otherwise) +### expose a mysql service on custom host:port if provided (random port on the 0.0.0.0 interface if otherwise unspecified) ```shell # usage @@ -289,6 +289,12 @@ Expose the service on the service's normal ports, allowing access to it from the dokku mysql:expose lolipop 3306 ``` +Expose the service on the service's normal ports, with the first on a specified ip adddress (127.0.0.1): + +```shell +dokku mysql:expose lolipop 127.0.0.1:3306 +``` + ### unexpose a previously exposed mysql service ```shell diff --git a/subcommands/expose b/subcommands/expose index 7bb88e7..09674aa 100755 --- a/subcommands/expose +++ b/subcommands/expose @@ -8,9 +8,11 @@ source "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")/functions" service-expose-cmd() { #E expose the service on the service's normal ports, allowing access to it from the public interface (0.0.0.0) #E dokku $PLUGIN_COMMAND_PREFIX:expose lolipop ${PLUGIN_DATASTORE_PORTS[@]} + #E expose the service on the service's normal ports, with the first on a specified ip adddress (127.0.0.1) + #E dokku $PLUGIN_COMMAND_PREFIX:expose lolipop 127.0.0.1:${PLUGIN_DATASTORE_PORTS[@]} #A service, service to run command against #A ports, a list of ports to run against - declare desc="expose a $PLUGIN_SERVICE service on custom port if provided (random port otherwise)" + declare desc="expose a $PLUGIN_SERVICE service on custom host:port if provided (random port on the 0.0.0.0 interface if otherwise unspecified)" local cmd="$PLUGIN_COMMAND_PREFIX:expose" argv=("$@") [[ ${argv[0]} == "$cmd" ]] && shift 1 declare SERVICE="$1" PORTS_LIST=("${@:2}")