Merge pull request #1 from dokku/service-expose
Service expose/unexpose
This commit is contained in:
12
README.md
12
README.md
@@ -25,14 +25,16 @@ redis:connect <name> Connect via redis-cli to a redis service
|
|||||||
redis:create <name> Create a redis service
|
redis:create <name> Create a redis service
|
||||||
redis:destroy <name> Delete the service and stop its container if there are no links left
|
redis:destroy <name> Delete the service and stop its container if there are no links left
|
||||||
redis:export <name> NOT IMPLEMENTED
|
redis:export <name> NOT IMPLEMENTED
|
||||||
redis:expose <name> <port> NOT IMPLEMENTED
|
redis:expose <name> [port] Expose a redis service on custom port if provided (random port otherwise)
|
||||||
redis:import <name> <file> NOT IMPLEMENTED
|
redis:import <name> <file> NOT IMPLEMENTED
|
||||||
redis:info <name> Print the connection information
|
redis:info <name> Print the connection information
|
||||||
redis:link <name> <app> Link the redis service to the app
|
redis:link <name> <app> Link the redis service to the app
|
||||||
redis:list List all redis services
|
redis:list List all redis services
|
||||||
redis:logs <name> [-t] Print the most recent log(s) for this service
|
redis:logs <name> [-t] Print the most recent log(s) for this service
|
||||||
redis:restart <name> Graceful shutdown and restart of the service container
|
redis:restart <name> Graceful shutdown and restart of the redis service container
|
||||||
redis:unexpose <name> <port> NOT IMPLEMENTED
|
redis:start <name> Start a previously stopped redis service
|
||||||
|
redis:stop <name> Stop a running redis service
|
||||||
|
redis:unexpose <name> Unexpose a previously exposed redis service
|
||||||
redis:unlink <name> <app> Unlink the redis service from the app
|
redis:unlink <name> <app> Unlink the redis service from the app
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -65,7 +67,7 @@ dokku redis:link lolipop playground
|
|||||||
# the above will expose the following environment variables
|
# the above will expose the following environment variables
|
||||||
#
|
#
|
||||||
# REDIS_URL=redis://172.17.0.1:6379
|
# REDIS_URL=redis://172.17.0.1:6379
|
||||||
# REDIS_NAME=/playground/DATABASE
|
# REDIS_NAME=/lolipop/DATABASE
|
||||||
# REDIS_PORT=tcp://172.17.0.1:6379
|
# REDIS_PORT=tcp://172.17.0.1:6379
|
||||||
# REDIS_PORT_6379_TCP=tcp://172.17.0.1:6379
|
# REDIS_PORT_6379_TCP=tcp://172.17.0.1:6379
|
||||||
# REDIS_PORT_6379_TCP_PROTO=tcp
|
# REDIS_PORT_6379_TCP_PROTO=tcp
|
||||||
@@ -85,7 +87,7 @@ dokku redis:logs lolipop
|
|||||||
dokku redis:logs lolipop -t # to tail
|
dokku redis:logs lolipop -t # to tail
|
||||||
|
|
||||||
# finally, you can destroy the container
|
# finally, you can destroy the container
|
||||||
dokku redis:destroy playground
|
dokku redis:destroy lolipop
|
||||||
```
|
```
|
||||||
|
|
||||||
## todo
|
## todo
|
||||||
|
|||||||
64
commands
64
commands
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
source "$(dirname "$0")/../common/functions"
|
source "$PLUGIN_PATH/common/functions"
|
||||||
source "$(dirname "$0")/functions"
|
source "$(dirname "$0")/functions"
|
||||||
source "$(dirname "$0")/config"
|
source "$(dirname "$0")/config"
|
||||||
|
|
||||||
@@ -35,7 +35,8 @@ case "$1" in
|
|||||||
touch "$LINKS_FILE"
|
touch "$LINKS_FILE"
|
||||||
|
|
||||||
dokku_log_info1 "Starting container"
|
dokku_log_info1 "Starting container"
|
||||||
ID=$(docker run --name "dokku.redis.$SERVICE" -v "$SERVICE_ROOT/data:/data" -v "$SERVICE_ROOT/config:/usr/local/etc/redis" -d "$PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION")
|
SERVICE_NAME=$(get_service_name "$SERVICE")
|
||||||
|
ID=$(docker run --name "$SERVICE_NAME" -v "$SERVICE_ROOT/data:/data" -v "$SERVICE_ROOT/config:/usr/local/etc/redis" -d --restart always --label dokku=service --label dokku.service=redis "$PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION")
|
||||||
echo "$ID" > "$SERVICE_ROOT/ID"
|
echo "$ID" > "$SERVICE_ROOT/ID"
|
||||||
|
|
||||||
dokku_log_verbose_quiet "Waiting for container to be ready"
|
dokku_log_verbose_quiet "Waiting for container to be ready"
|
||||||
@@ -71,11 +72,12 @@ case "$1" in
|
|||||||
ID=$(cat "$SERVICE_ROOT/ID")
|
ID=$(cat "$SERVICE_ROOT/ID")
|
||||||
|
|
||||||
dokku_log_verbose_quiet "Deleting container data"
|
dokku_log_verbose_quiet "Deleting container data"
|
||||||
|
service_start "$SERVICE"
|
||||||
docker exec -it "$ID" chmod -R 777 /data
|
docker exec -it "$ID" chmod -R 777 /data
|
||||||
|
|
||||||
dokku_log_verbose_quiet "Stopping container"
|
service_stop "$SERVICE"
|
||||||
docker stop "$ID" > /dev/null
|
dokku_log_verbose_quiet "Killing container"
|
||||||
docker kill "$ID" > /dev/null
|
docker kill "$ID" > /dev/null || true
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
dokku_log_verbose_quiet "Removing container"
|
dokku_log_verbose_quiet "Removing container"
|
||||||
@@ -129,14 +131,23 @@ case "$1" in
|
|||||||
service_logs "$2" "$3"
|
service_logs "$2" "$3"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
$PLUGIN_COMMAND_PREFIX:start)
|
||||||
|
[[ -z $2 ]] && dokku_log_fail "Please specify a name for the service"
|
||||||
|
verify_service_name "$2"
|
||||||
|
service_start "$2"
|
||||||
|
;;
|
||||||
|
|
||||||
|
$PLUGIN_COMMAND_PREFIX:stop)
|
||||||
|
[[ -z $2 ]] && dokku_log_fail "Please specify a name for the service"
|
||||||
|
verify_service_name "$2"
|
||||||
|
service_stop "$2"
|
||||||
|
;;
|
||||||
|
|
||||||
$PLUGIN_COMMAND_PREFIX:restart)
|
$PLUGIN_COMMAND_PREFIX:restart)
|
||||||
[[ -z $2 ]] && dokku_log_fail "Please specify a name for the service"
|
[[ -z $2 ]] && dokku_log_fail "Please specify a name for the service"
|
||||||
verify_service_name "$2"
|
verify_service_name "$2"
|
||||||
SERVICE="$2"; SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
service_stop "$2"
|
||||||
|
service_start "$2"
|
||||||
ID=$(cat "$SERVICE_ROOT/ID")
|
|
||||||
|
|
||||||
docker restart --time=10 "$ID"
|
|
||||||
dokku_log_info1 "Please call dokku ps:restart on all linked apps"
|
dokku_log_info1 "Please call dokku ps:restart on all linked apps"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -171,34 +182,13 @@ case "$1" in
|
|||||||
$PLUGIN_COMMAND_PREFIX:expose)
|
$PLUGIN_COMMAND_PREFIX:expose)
|
||||||
[[ -z $2 ]] && dokku_log_fail "Please specify a name for the service"
|
[[ -z $2 ]] && dokku_log_fail "Please specify a name for the service"
|
||||||
verify_service_name "$2"
|
verify_service_name "$2"
|
||||||
SERVICE="$2"; SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"; PORT_FILE="$SERVICE_ROOT/PORT"; DESTINATION_FILE="$SERVICE_ROOT/IPTABLES_DESTINATION"
|
service_port_expose "$2" "${@:3}"
|
||||||
|
|
||||||
[[ -f "$PORT_FILE" ]] && PORT=$(cat "$PORT_FILE") && dokku_log_fail "Service $SERVICE already exposed on port $PORT"
|
|
||||||
|
|
||||||
ID=$(cat "$SERVICE_ROOT/ID")
|
|
||||||
IP=$(get_container_ip "$ID")
|
|
||||||
PORT=$(get_random_port)
|
|
||||||
echo "$PORT" > "$PORT_FILE"
|
|
||||||
echo "$IP:$PLUGIN_DATASTORE_PORT" > "$DESTINATION_FILE"
|
|
||||||
|
|
||||||
iptables -t nat -A DOCKER -p tcp --dport "$PORT" -j DNAT --to-destination "$IP:$PLUGIN_DATASTORE_PORT"
|
|
||||||
dokku_log_info1 "Service $SERVICE exposed on port $PORT"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
$PLUGIN_COMMAND_PREFIX:unexpose)
|
$PLUGIN_COMMAND_PREFIX:unexpose)
|
||||||
[[ -z $2 ]] && dokku_log_fail "Please specify a name for the service"
|
[[ -z $2 ]] && dokku_log_fail "Please specify a name for the service"
|
||||||
verify_service_name "$2"
|
verify_service_name "$2"
|
||||||
SERVICE="$2"; SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"; PORT_FILE="$SERVICE_ROOT/PORT"; DESTINATION_FILE="$SERVICE_ROOT/IPTABLES_DESTINATION"
|
service_port_unexpose "$2"
|
||||||
|
|
||||||
[[ ! -f "$PORT_FILE" ]] && dokku_log_fail "Service not exposed"
|
|
||||||
|
|
||||||
ID=$(cat "$SERVICE_ROOT/ID")
|
|
||||||
IP=$(get_container_ip "$ID")
|
|
||||||
PORT=$(cat "$PORT_FILE")
|
|
||||||
DESTINATION=$(cat "$DESTINATION_FILE")
|
|
||||||
|
|
||||||
iptables -t nat -D DOCKER -p tcp --dport "$PORT" -j DNAT --to-destination "$DESTINATION"
|
|
||||||
rm -rf "$PORT_FILE"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
help)
|
help)
|
||||||
@@ -212,12 +202,14 @@ case "$1" in
|
|||||||
$PLUGIN_COMMAND_PREFIX:import <name> <file>, NOT IMPLEMENTED
|
$PLUGIN_COMMAND_PREFIX:import <name> <file>, NOT IMPLEMENTED
|
||||||
$PLUGIN_COMMAND_PREFIX:connect <name>, Connect via redis-cli to a $PLUGIN_SERVICE service
|
$PLUGIN_COMMAND_PREFIX:connect <name>, Connect via redis-cli to a $PLUGIN_SERVICE service
|
||||||
$PLUGIN_COMMAND_PREFIX:logs <name> [-t], Print the most recent log(s) for this service
|
$PLUGIN_COMMAND_PREFIX:logs <name> [-t], Print the most recent log(s) for this service
|
||||||
$PLUGIN_COMMAND_PREFIX:restart <name>, Graceful shutdown and restart of the service container
|
$PLUGIN_COMMAND_PREFIX:restart <name>, Graceful shutdown and restart of the $PLUGIN_SERVICE service container
|
||||||
$PLUGIN_COMMAND_PREFIX:info <name>, Print the connection information
|
$PLUGIN_COMMAND_PREFIX:info <name>, Print the connection information
|
||||||
$PLUGIN_COMMAND_PREFIX:list, List all $PLUGIN_SERVICE services
|
$PLUGIN_COMMAND_PREFIX:list, List all $PLUGIN_SERVICE services
|
||||||
$PLUGIN_COMMAND_PREFIX:clone <name> <new-name>, NOT IMPLEMENTED
|
$PLUGIN_COMMAND_PREFIX:clone <name> <new-name>, NOT IMPLEMENTED
|
||||||
$PLUGIN_COMMAND_PREFIX:expose <name> <port>, NOT IMPLEMENTED
|
$PLUGIN_COMMAND_PREFIX:expose <name> [port], Expose a $PLUGIN_SERVICE service on custom port if provided (random port otherwise)
|
||||||
$PLUGIN_COMMAND_PREFIX:unexpose <name> <port>, NOT IMPLEMENTED
|
$PLUGIN_COMMAND_PREFIX:unexpose <name>, Unexpose a previously exposed $PLUGIN_SERVICE service
|
||||||
|
$PLUGIN_COMMAND_PREFIX:start <name>, Start a previously stopped $PLUGIN_SERVICE service
|
||||||
|
$PLUGIN_COMMAND_PREFIX:stop <name>, Stop a running $PLUGIN_SERVICE service
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
2
config
Normal file → Executable file
2
config
Normal file → Executable file
@@ -5,7 +5,7 @@ export REDIS_ROOT=/var/lib/dokku/services/redis
|
|||||||
|
|
||||||
export PLUGIN_COMMAND_PREFIX="redis"
|
export PLUGIN_COMMAND_PREFIX="redis"
|
||||||
export PLUGIN_DATA_ROOT=$REDIS_ROOT
|
export PLUGIN_DATA_ROOT=$REDIS_ROOT
|
||||||
export PLUGIN_DATASTORE_PORT=6379
|
export PLUGIN_DATASTORE_PORTS=(6379)
|
||||||
export PLUGIN_DEFAULT_ALIAS="REDIS"
|
export PLUGIN_DEFAULT_ALIAS="REDIS"
|
||||||
export PLUGIN_IMAGE=$REDIS_IMAGE
|
export PLUGIN_IMAGE=$REDIS_IMAGE
|
||||||
export PLUGIN_IMAGE_VERSION=$REDIS_IMAGE_VERSION
|
export PLUGIN_IMAGE_VERSION=$REDIS_IMAGE_VERSION
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
source "$(dirname "$0")/../common/functions"
|
source "$PLUGIN_PATH/common/functions"
|
||||||
source "$(dirname "$0")/functions"
|
source "$(dirname "$0")/functions"
|
||||||
source "$(dirname "$0")/config"
|
source "$(dirname "$0")/config"
|
||||||
|
|
||||||
|
|||||||
127
functions
127
functions
@@ -2,12 +2,13 @@
|
|||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
source "$(dirname "$0")/config"
|
source "$(dirname "$0")/config"
|
||||||
|
|
||||||
get_random_port() {
|
get_random_ports() {
|
||||||
|
local iterations="${1:-1}"
|
||||||
|
for (( i=0; i < iterations; i++ )); do
|
||||||
local port=$RANDOM
|
local port=$RANDOM
|
||||||
local quit=0
|
local quit=0
|
||||||
|
|
||||||
while [ "$quit" -ne 1 ]; do
|
while [ "$quit" -ne 1 ]; do
|
||||||
netstat -a | grep $port >> /dev/null
|
netstat -an | grep $port > /dev/null
|
||||||
if [ $? -gt 0 ]; then
|
if [ $? -gt 0 ]; then
|
||||||
quit=1
|
quit=1
|
||||||
else
|
else
|
||||||
@@ -15,6 +16,7 @@ get_random_port() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo $port
|
echo $port
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
get_container_ip() {
|
get_container_ip() {
|
||||||
@@ -54,11 +56,19 @@ service_list() {
|
|||||||
else
|
else
|
||||||
dokku_log_info1_quiet "$PLUGIN_SERVICE services:"
|
dokku_log_info1_quiet "$PLUGIN_SERVICE services:"
|
||||||
for SERVICE in $SERVICES; do
|
for SERVICE in $SERVICES; do
|
||||||
dokku_log_verbose "$SERVICE $(service_status $SERVICE)"
|
dokku_log_verbose "$SERVICE $(service_status "$SERVICE")$(service_exposed_ports "$SERVICE")"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
service_exposed_ports() {
|
||||||
|
local SERVICE="$1"
|
||||||
|
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
||||||
|
local PORT_FILE="$SERVICE_ROOT/PORT"
|
||||||
|
[[ ! -f $PORT_FILE ]] && return 0
|
||||||
|
printf ", exposed port(s): %s" "$(cat "$PORT_FILE")"
|
||||||
|
}
|
||||||
|
|
||||||
service_link() {
|
service_link() {
|
||||||
local APP="$2"
|
local APP="$2"
|
||||||
local SERVICE="$1"
|
local SERVICE="$1"
|
||||||
@@ -111,6 +121,108 @@ service_status() {
|
|||||||
echo "(stopped)" && return 0
|
echo "(stopped)" && return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
service_port_expose() {
|
||||||
|
service_port_unpause "$1" "true" "${@:2}"
|
||||||
|
}
|
||||||
|
|
||||||
|
service_port_pause() {
|
||||||
|
local SERVICE="$1"
|
||||||
|
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
||||||
|
local EXPOSED_NAME="$(get_service_name "$SERVICE").ambassador"
|
||||||
|
local PORT_FILE="$SERVICE_ROOT/PORT"
|
||||||
|
local LOG_FAIL="$2"
|
||||||
|
|
||||||
|
if [[ "$LOG_FAIL" == "true" ]]; then
|
||||||
|
[[ ! -f "$PORT_FILE" ]] && dokku_log_fail "Service not exposed"
|
||||||
|
else
|
||||||
|
[[ ! -f "$PORT_FILE" ]] && return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker stop "$EXPOSED_NAME" > /dev/null
|
||||||
|
docker rm "$EXPOSED_NAME" > /dev/null
|
||||||
|
if [[ "$LOG_FAIL" == "true" ]]; then
|
||||||
|
dokku_log_info1 "Service $SERVICE unexposed"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
service_port_unexpose() {
|
||||||
|
local SERVICE="$1"
|
||||||
|
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
||||||
|
local PORT_FILE="$SERVICE_ROOT/PORT"
|
||||||
|
service_port_pause "$SERVICE" "true"
|
||||||
|
rm -rf "$PORT_FILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
service_port_unpause() {
|
||||||
|
local SERVICE="$1"
|
||||||
|
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
||||||
|
local SERVICE_NAME=$(get_service_name "$SERVICE")
|
||||||
|
local EXPOSED_NAME="${SERVICE_NAME}.ambassador"
|
||||||
|
local PORT_FILE="$SERVICE_ROOT/PORT"
|
||||||
|
local LOG_FAIL="$2"
|
||||||
|
local PORTS=(${@:3})
|
||||||
|
PORTS=(${PORTS[@]:-$(get_random_ports ${#PLUGIN_DATASTORE_PORTS[@]})})
|
||||||
|
local ID=$(cat "$SERVICE_ROOT/ID")
|
||||||
|
|
||||||
|
[[ "${#PORTS[@]}" != "${#PLUGIN_DATASTORE_PORTS[@]}" ]] && dokku_log_fail "${#PLUGIN_DATASTORE_PORTS[@]} ports to be exposed need to be provided"
|
||||||
|
|
||||||
|
if [[ "$LOG_FAIL" == "true" ]]; then
|
||||||
|
[[ -f "$PORT_FILE" ]] && PORTS=($(cat "$PORT_FILE")) && dokku_log_fail "Service $SERVICE already exposed on port(s) ${PORTS[*]}"
|
||||||
|
else
|
||||||
|
[[ ! -f "$PORT_FILE" ]] && return 0
|
||||||
|
PORTS=($(cat "$PORT_FILE"))
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${PORTS[@]}" > "$PORT_FILE"
|
||||||
|
|
||||||
|
docker run -d --link "$SERVICE_NAME:redis" --name "$EXPOSED_NAME" $(docker_ports_options "${PORTS[@]}") --restart always --label dokku=ambassador --label dokku.ambassador=redis svendowideit/ambassador > /dev/null
|
||||||
|
if [[ "$LOG_FAIL" == "true" ]]; then
|
||||||
|
dokku_log_info1 "Service $SERVICE exposed on port(s) ${PORTS[*]}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
docker_ports_options() {
|
||||||
|
local PORTS=("$@")
|
||||||
|
for (( i=0; i < ${#PLUGIN_DATASTORE_PORTS[@]}; i++ )); do
|
||||||
|
echo -n "-p ${PORTS[i]}:${PLUGIN_DATASTORE_PORTS[i]} "
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
service_start() {
|
||||||
|
local SERVICE="$1"
|
||||||
|
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE"
|
||||||
|
local SERVICE_NAME=$(get_service_name "$SERVICE")
|
||||||
|
local ID=$(docker ps -f status=running | grep "$SERVICE_NAME" | awk '{print $1}') || true
|
||||||
|
[[ -n $ID ]] && dokku_log_warn "Service is already started" && return 0
|
||||||
|
|
||||||
|
dokku_log_info1_quiet "Starting container"
|
||||||
|
local PREVIOUS_ID=$(docker ps -f status=exited | grep "$SERVICE_NAME" | awk '{print $1}') || true
|
||||||
|
if [[ -n $PREVIOUS_ID ]]; then
|
||||||
|
docker start "$PREVIOUS_ID" > /dev/null
|
||||||
|
service_port_unpause "$SERVICE"
|
||||||
|
dokku_log_info2 "Container started"
|
||||||
|
else
|
||||||
|
dokku_log_verbose_quiet "No container exists for $SERVICE"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
service_stop() {
|
||||||
|
local SERVICE="$1"
|
||||||
|
local SERVICE_ROOT="$PLUGIN_DATA_ROOT/$SERVICE";
|
||||||
|
local SERVICE_NAME=$(get_service_name "$SERVICE")
|
||||||
|
local ID=$(docker ps -f status=running | grep "$SERVICE_NAME" | awk '{print $1}') || true
|
||||||
|
[[ -z $ID ]] && dokku_log_warn "Service is already stopped" && return 0
|
||||||
|
|
||||||
|
if [[ -n $ID ]]; then
|
||||||
|
dokku_log_info1_quiet "Stopping container"
|
||||||
|
docker stop "$SERVICE_NAME" > /dev/null
|
||||||
|
service_port_pause "$SERVICE"
|
||||||
|
dokku_log_info2 "Container stopped"
|
||||||
|
else
|
||||||
|
dokku_log_verbose_quiet "No container exists for $SERVICE"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
service_unlink() {
|
service_unlink() {
|
||||||
local APP="$2"
|
local APP="$2"
|
||||||
local SERVICE="$1"
|
local SERVICE="$1"
|
||||||
@@ -132,7 +244,7 @@ service_url() {
|
|||||||
|
|
||||||
local ID="$(cat "$SERVICE_ROOT/ID")"
|
local ID="$(cat "$SERVICE_ROOT/ID")"
|
||||||
local IP="$(get_container_ip "$ID")"
|
local IP="$(get_container_ip "$ID")"
|
||||||
echo "$PLUGIN_SCHEME://$IP:$PLUGIN_DATASTORE_PORT/0"
|
echo "$PLUGIN_SCHEME://$IP:${PLUGIN_DATASTORE_PORTS[0]}/0"
|
||||||
}
|
}
|
||||||
|
|
||||||
is_container_status () {
|
is_container_status () {
|
||||||
@@ -146,3 +258,8 @@ is_container_status () {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_service_name() {
|
||||||
|
local SERVICE="$1"
|
||||||
|
echo "dokku.${PLUGIN_COMMAND_PREFIX}.$SERVICE"
|
||||||
|
}
|
||||||
|
|||||||
2
install
2
install
@@ -6,5 +6,7 @@ if ! docker images | grep -e "^$PLUGIN_IMAGE " | grep -q $PLUGIN_IMAGE_VERSION ;
|
|||||||
docker pull $PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION
|
docker pull $PLUGIN_IMAGE:$PLUGIN_IMAGE_VERSION
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
docker pull svendowideit/ambassador:latest
|
||||||
|
|
||||||
mkdir -p $PLUGIN_DATA_ROOT || echo "Failed to create $PLUGIN_SERVICE directory"
|
mkdir -p $PLUGIN_DATA_ROOT || echo "Failed to create $PLUGIN_SERVICE directory"
|
||||||
chown dokku:dokku $PLUGIN_DATA_ROOT
|
chown dokku:dokku $PLUGIN_DATA_ROOT
|
||||||
|
|||||||
Reference in New Issue
Block a user