Skip to content

Commit a9d399e

Browse files
committed
[begin] repair paths inside pod.
1 parent 6a82b84 commit a9d399e

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

functions

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,8 @@ letsencrypt_configure_and_get_dir() {
188188
# store config settings
189189
echo "--http.port :$acme_port $config" >"$config_dir/config"
190190

191-
# send both host and container path
192-
# to respect mapped DOKKU_ROOT when running in a container
193-
echo "$DOKKU_HOST_ROOT/$app/letsencrypt/certs/$config_hash:$config_dir"
191+
# respond using a "relative" address based on the dokku home.
192+
echo "$app/letsencrypt/certs/$config_hash"
194193
}
195194

196195
letsencrypt_get_email() {

subcommands/enable

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ letsencrypt_acme() {
7373
declare desc="perform actual ACME validation procedure"
7474
declare app="$1" acme_port="$2"
7575
local FAKE_NGINX_CONF=false
76-
local config_dir
7776

7877
if [[ ! -f "$DOKKU_ROOT/$app/nginx.conf" ]]; then
7978
FAKE_NGINX_CONF=true
@@ -84,20 +83,21 @@ letsencrypt_acme() {
8483
dokku_log_info1 "Getting letsencrypt certificate for ${app}..."
8584

8685
# read arguments from appropriate config file into the config array
87-
config_dirs="$(letsencrypt_configure_and_get_dir "$app" "$acme_port")"
88-
host_config_dir="$(echo "$config_dirs" | cut -d: -f1)"
89-
container_config_dir="$(echo "$config_dirs" | cut -d: -f2)"
90-
read -r -a config <"$container_config_dir/config"
86+
local config_dir=$(letsencrypt_configure_and_get_dir "$app" "$acme_port")
87+
local config_dir_in_pod="/mnt/dokku/home/dokku/$config_dir"
88+
local config_dir_on_host="$DOKKU_HOST_ROOT/$config_dir"
89+
read -r -a config <"$config_dir_in_pod/config"
9190

9291
# run letsencrypt as a docker container using "certonly" mode
9392
# port 80 of the standalone webserver will be forwarded by the proxy
9493
set +e
9594
export DOKKU_UID=$(id -u)
9695
export DOKKU_GID=$(id -g)
9796
docker run --rm \
97+
"$PERMISSIONS_CALLS" \
9898
--user $DOKKU_UID:$DOKKU_GID \
9999
-p "$acme_port:$acme_port" \
100-
-v "$host_config_dir:/certs" \
100+
-v "$config_dir_on_host:/certs" \
101101
"${PLUGIN_IMAGE}:${PLUGIN_IMAGE_VERSION}" \
102102
"${config[@]}" run | sed "s/^/ /"
103103

subcommands/revoke

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,22 @@ letsencrypt_acme_revoke() {
1717
local acme_port=$(get_available_port)
1818

1919
# read arguments from appropriate config file into the config array
20-
config_dirs="$(letsencrypt_configure_and_get_dir "$app" "$acme_port")"
21-
host_config_dir="$(echo "$config_dirs" | cut -d: -f1)"
22-
container_config_dir="$(echo "$config_dirs" | cut -d: -f2)"
23-
read -r -a config <"$container_config_dir/config"
20+
local config_dir=$(letsencrypt_configure_and_get_dir "$app" "$acme_port")
21+
local config_dir_in_pod="/mnt/dokku/home/dokku/$config_dir"
22+
local config_dir_on_host="$DOKKU_HOST_ROOT/$config_dir"
23+
read -r -a config <"$config_dir_in_pod/config"
2424

2525
# run letsencrypt as a docker container using "certonly" mode
2626
# port 80 of the standalone webserver will be forwarded by the proxy
2727
set +e
2828
export DOKKU_UID=$(id -u)
2929
export DOKKU_GID=$(id -g)
30+
3031
docker run --rm \
32+
"$PERMISSIONS_CALLS" \
3133
--user $DOKKU_UID:$DOKKU_GID \
3234
-p "$acme_port:$acme_port" \
33-
-v "$host_config_dir:/certs" \
35+
-v "$config_dir_on_host:/certs" \
3436
"${PLUGIN_IMAGE}:${PLUGIN_IMAGE_VERSION}" \
3537
"${config[@]}" revoke | sed "s/^/ /"
3638

0 commit comments

Comments
 (0)