diff --git a/docs/deployment/builders/null.md b/docs/deployment/builders/null.md new file mode 100644 index 000000000..88a1b2f2d --- /dev/null +++ b/docs/deployment/builders/null.md @@ -0,0 +1,15 @@ +# Null Builder + +> New as of 0.25.0 + +The `null` builder does nothing, and is useful for routing to services not managed by Dokku. It should not be used in normal operation. Please see the [network documentation](/docs/networking/network.md#routing-an-app-to-a-known-ip:port-combination) for more information on the aforementioned use case. + +## Usage + +### Detection + +This builder is _never_ auto-detected. The builder _must_ be specified via the `builder:set` command: + +```shell +dokku builder:set node-js-app selected null +``` diff --git a/docs/deployment/schedulers/null.md b/docs/deployment/schedulers/null.md new file mode 100644 index 000000000..ad375508b --- /dev/null +++ b/docs/deployment/schedulers/null.md @@ -0,0 +1,15 @@ +# Null Scheduler + +> New as of 0.25.0 + +The `null` scheduler does nothing, and is useful for routing to services not managed by Dokku. It should not be used in normal operation. Please see the [network documentation](/docs/networking/network.md#routing-an-app-to-a-known-ip:port-combination) for more information on the aforementioned use case. + +## Usage + +### Detection + +This scheduler is _never_ auto-detected. The scheduler _must_ be specified via the `config:set` command: + +```shell +dokku config:set node-js-app DOCKER_SCHEDULER=null +``` diff --git a/docs/development/plugin-triggers.md b/docs/development/plugin-triggers.md index a3bf42e4d..ded3a5092 100644 --- a/docs/development/plugin-triggers.md +++ b/docs/development/plugin-triggers.md @@ -940,6 +940,21 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x # TODO ``` +### `network-get-static-listeners` + +- Description: Return the network value for an app's property +- Invoked by: `internally triggered by proxy-build-config` +- Arguments: `$APP $PROCESS_TYPE` +- Example: + +```shell +#!/usr/bin/env bash + +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +# TODO +``` + ### `network-write-ipaddr` - Description: Write the ipaddr for a given app index diff --git a/docs/networking/network.md b/docs/networking/network.md index 5014873d0..095e23c36 100644 --- a/docs/networking/network.md +++ b/docs/networking/network.md @@ -123,6 +123,40 @@ dokku network:info test-network // TODO ``` +### Routing an app to a known ip:port combination + +> New as of 0.25.0 + +In some cases, it may be necessary to route an app to an existing `$IP:$PORT` combination. This is particularly the case for internal admin tools or services that aren't run by Dokku but have a web ui that would benefit from being exposed by Dokku. This can be done by setting a value for `static-web-lister` and running a few other commands when creating an app. + +```shell +# for a service listening on: +# - ip address: 127.0.0.1 +# - port: 8080 + +# create the app +dokku apps:create local-app + +# set the builder to the null builder, which does nothing +dokku builder:set local-app selected null + +# set the scheduler to the null scheduler, which does nothing +dokku config:set local-app DOKKU_SCHEDULER=null + +# set the static-web-listener network property to the ip:port combination for your app. +dokku network:set local-app static-web-listener 127.0.0.1:8080 + +# set the port map as desired for the port specified in your static-web-listener +dokku proxy:ports-set local-app http:80:8080 + +# set the domains desired +dokku domains:set local-app local-app.dokku.me + +dokku proxy:build-config local-app +``` + +Only a single `$IP:$PORT` combination can be routed to for a given app, and that `$IP:$PORT` combination _must_ be accessible to the proxy, or requests to the app may not resolve. + ### Attaching an app to a network > New as of 0.20.0, Requires Docker 1.21+ diff --git a/plugins/builder-null/commands b/plugins/builder-null/commands new file mode 100755 index 000000000..e86428144 --- /dev/null +++ b/plugins/builder-null/commands @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +[[ " help builder-null:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +source "$PLUGIN_AVAILABLE_PATH/builder-null/help-functions" +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +case "$1" in + help | builder-null:help) + cmd-builder-null-help "$@" + ;; + + *) + exit "$DOKKU_NOT_IMPLEMENTED_EXIT" + ;; + +esac diff --git a/plugins/builder-null/help-functions b/plugins/builder-null/help-functions new file mode 100755 index 000000000..2eb62722a --- /dev/null +++ b/plugins/builder-null/help-functions @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +cmd-builder-null-help() { + declare desc="help command" + declare CMD="$1" + local plugin_name="builder-null" + local plugin_description="No-op builder plugin" + + if [[ "$CMD" == "${plugin_name}:help" ]]; then + echo -e "Usage: dokku ${plugin_name}[:COMMAND]" + echo '' + echo "$plugin_description" + echo '' + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + true + else + cat </dev/null) - if ! verify_image "$IMAGE" 2>/dev/null; then - dokku_log_fail "Missing image for app" + if [[ "$(plugn trigger network-get-static-listeners "$APP" "web")" == "" ]]; then + local IMAGE_TAG=$(get_running_image_tag "$APP") + local IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG" 2>/dev/null) + if ! verify_image "$IMAGE" 2>/dev/null; then + dokku_log_fail "Missing image for app" + fi fi local NGINX_BUILD_CONFIG_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX") diff --git a/plugins/scheduler-null/commands b/plugins/scheduler-null/commands new file mode 100755 index 000000000..d4d495cac --- /dev/null +++ b/plugins/scheduler-null/commands @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +[[ " help scheduler-null:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +source "$PLUGIN_AVAILABLE_PATH/scheduler-null/help-functions" +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +case "$1" in + help | scheduler-null:help) + cmd-scheduler-null-help "$@" + ;; + + *) + exit "$DOKKU_NOT_IMPLEMENTED_EXIT" + ;; + +esac diff --git a/plugins/scheduler-null/help-functions b/plugins/scheduler-null/help-functions new file mode 100755 index 000000000..ef24ae7c2 --- /dev/null +++ b/plugins/scheduler-null/help-functions @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +cmd-scheduler-null-help() { + declare desc="help command" + declare CMD="$1" + local plugin_name="scheduler-null" + local plugin_description="No-op scheduler plugin" + + if [[ "$CMD" == "${plugin_name}:help" ]]; then + echo -e "Usage: dokku ${plugin_name}[:COMMAND]" + echo '' + echo "$plugin_description" + echo '' + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + true + else + cat <