Skip to content
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

Added docker endpoints configuration. Fixes #130 #131 #138 #139

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ FROM alpine:3.4
MAINTAINER Yves Blusseau <90z7oey02@sneakemail.com> (@blusseau)

ENV DEBUG=false \
DOCKER_GEN_VERSION=0.7.3 \
DOCKER_GEN_VERSION="0.7.4" \
DOCKER_HOST=unix:///var/run/docker.sock

RUN apk --update add bash curl ca-certificates procps jq tar && \
curl -L -O https://github.com/jwilder/docker-gen/releases/download/$DOCKER_GEN_VERSION/docker-gen-linux-amd64-$DOCKER_GEN_VERSION.tar.gz && \
curl -L -O https://github.com/rid/docker-gen-multi/releases/download/$DOCKER_GEN_VERSION/docker-gen-linux-amd64-$DOCKER_GEN_VERSION.tar.gz && \
tar -C /usr/local/bin -xvzf docker-gen-linux-amd64-$DOCKER_GEN_VERSION.tar.gz && \
rm -f docker-gen-linux-amd64-$DOCKER_GEN_VERSION.tar.gz && \
apk del tar && \
Expand Down
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
[![](https://images.microbadger.com/badges/version/jrcs/letsencrypt-nginx-proxy-companion.svg)](https://hub.docker.com/r/jrcs/letsencrypt-nginx-proxy-companion "Click to view the image on Docker Hub")
[![](https://images.microbadger.com/badges/image/jrcs/letsencrypt-nginx-proxy-companion.svg)](https://hub.docker.com/r/jrcs/letsencrypt-nginx-proxy-companion "Click to view the image on Docker Hub")
[![](https://img.shields.io/docker/stars/jrcs/letsencrypt-nginx-proxy-companion.svg)](https://hub.docker.com/r/jrcs/letsencrypt-nginx-proxy-companion "Click to view the image on Docker Hub")
[![](https://img.shields.io/docker/pulls/jrcs/letsencrypt-nginx-proxy-companion.svg)](https://hub.docker.com/r/jrcs/letsencrypt-nginx-proxy-companion "Click to view the image on Docker Hub")

letsencrypt-nginx-proxy-companion is a lightweight companion container for the [nginx-proxy](https://github.com/jwilder/nginx-proxy). It allow the creation/renewal of Let's Encrypt certificates automatically. See [Let's Encrypt section](#lets-encrypt) for configuration details.
letsencrypt-nginx-proxy-companion-multi is a lightweight companion container for the [nginx-proxy](https://github.com/jwilder/nginx-proxy). It allow the creation/renewal of Let's Encrypt certificates automatically. See [Let's Encrypt section](#lets-encrypt) for configuration details.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: this project is not renamed, -multi is not correct here


### Features:
* Automatic creation/renewal of Let's Encrypt certificates using original nginx-proxy container.
Expand Down Expand Up @@ -150,5 +145,7 @@ $ docker run -d \

* `NGINX_PROXY_CONTAINER`- If for some reason you can't use the docker --volumes-from option, you can specify the name or id of the nginx-proxy container with this variable.

* `NGINX_DOCKER_GEN_ENDPOINTS`- Multiple docker endpoints to listen on, comma separated, for example (tcp|unix://..,tcp|unix://..)

#### Examples:
If you want other examples how to use this container, look at [docker-letsencrypt-nginx-proxy-companion-examples] (https://github.com/fatk/docker-letsencrypt-nginx-proxy-companion-examples).
4 changes: 2 additions & 2 deletions app/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function get_nginx_proxy_cid {

function check_writable_directory {
local dir="$1"
docker_api "/containers/$HOSTNAME/json" | jq ".Mounts[].Destination" | grep -q "^\"$dir\"$"
docker_api "/containers/$CONTAINER_ID/json" | jq ".Mounts[].Destination" | grep -q "^\"$dir\"$"
if [[ $? -ne 0 ]]; then
echo "Warning: '$dir' does not appear to be a mounted volume."
fi
Expand Down Expand Up @@ -83,4 +83,4 @@ if [[ "$*" == "/bin/bash /app/start.sh" ]]; then
check_dh_group
fi

exec "$@"
exec "$@"
9 changes: 7 additions & 2 deletions app/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ trap 'term_handler' INT QUIT KILL TERM
/app/letsencrypt_service &
letsencrypt_service_pid=$!

docker-gen -watch -only-exposed -notify '/app/update_certs' -wait 15s:60s /app/letsencrypt_service_data.tmpl /app/letsencrypt_service_data &
if [ -z ${NGINX_DOCKER_GEN_ENDPOINTS} ]; then
docker-gen -watch -only-exposed -notify '/app/update_certs' -wait 15s:60s /app/letsencrypt_service_data.tmpl /app/letsencrypt_service_data &
else
echo -e "Endpoints: ${NGINX_DOCKER_GEN_ENDPOINTS} \n"
docker-gen -endpoints ${NGINX_DOCKER_GEN_ENDPOINTS} -watch -only-exposed -notify '/app/update_certs' -wait 15s:60s /app/letsencrypt_service_data.tmpl /app/letsencrypt_service_data &
fi
docker_gen_pid=$!

# wait "indefinitely"
Expand All @@ -25,4 +30,4 @@ while [[ -e /proc/$docker_gen_pid ]]; do
done

# Stop container properly
term_handler
term_handler
2 changes: 2 additions & 0 deletions install_simp_le.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ git -C /src clone --depth=1 -b $branch https://github.com/kuba/simp_le.git

# Install simp_le in /usr/bin
cd /src/simp_le
# the command below isn't needed if we clone only the good branch
#git checkout acme-0.8
python ./setup.py install

# Make house cleaning
Expand Down