-
Notifications
You must be signed in to change notification settings - Fork 826
Added label-based mechanism to identify docker-gen container. This is needed w… #205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,19 @@ function get_nginx_proxy_cid { | |
fi | ||
} | ||
|
||
function get_nginx_gen_cid { | ||
# Check if any container has been labelled as the nginx gen container. | ||
local labeled_cid=$(docker_api "/containers/json" | jq -r '.[] | select( .Labels["com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_gen"] == "true")|.Id') | ||
if [[ ! -z "${labeled_cid:-}" ]]; then | ||
export NGINX_DOCKER_GEN_CONTAINER=$labeled_cid | ||
fi | ||
if [[ -z "${NGINX_DOCKER_GEN_CONTAINER:-}" ]]; then | ||
echo "Error: can't get nginx-gen container id !" >&2 | ||
echo "Label the nginx gen container to use with 'com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_gen=true'." >&2 | ||
exit 1 | ||
fi | ||
} | ||
|
||
function check_writable_directory { | ||
local dir="$1" | ||
docker_api "/containers/$HOSTNAME/json" | jq ".Mounts[].Destination" | grep -q "^\"$dir\"$" | ||
|
@@ -79,6 +92,7 @@ source /app/functions.sh | |
|
||
if [[ "$*" == "/bin/bash /app/start.sh" ]]; then | ||
check_docker_socket | ||
get_nginx_gen_cid | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be:
to allow still using a manual environment variable when you do have access to a static name. |
||
if [[ -z "${NGINX_DOCKER_GEN_CONTAINER:-}" ]]; then | ||
[[ -z "${NGINX_PROXY_CONTAINER:-}" ]] && get_nginx_proxy_cid | ||
fi | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
location ^~ /.well-known/acme-challenge/ { | ||
location ~ /.well-known { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of scope, changes should be discarded. |
||
# autoindex on; | ||
allow all; | ||
root /usr/share/nginx/html; | ||
try_files $uri =404; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this condition to make it optional, don't error out. Document it instead.