This commit is contained in:
David Parrish 2015-11-27 20:23:53 -05:00
commit f913b7138d
5 changed files with 42 additions and 33 deletions

View file

@ -1,31 +1,10 @@
FROM jwilder/nginx-proxy FROM jwilder/nginx-proxy
MAINTAINER [ "David Parrish <daveparrish@tutanota.com", "Yves Blusseau <90z7oey02@sneakemail.com>", "Hadrien Mary <hadrien.mary@gmail.com>" ]
RUN apt-get update MAINTAINER David Parrish <daveparrish@tutanota.com>
MAINTAINER Yves Blusseau <90z7oey02@sneakemail.com>
# Install python packages needed by simp_le MAINTAINER Hadrien Mary <hadrien.mary@gmail.com>
RUN apt-get install -y -q --no-install-recommends python python-requests
# Install python packages needed to build simp_le
RUN apt-get install -y -q --no-install-recommends git gcc libssl-dev libffi-dev python-dev python-pip
# Get Let's Encrypt simp_le client source
RUN git -C /opt clone https://github.com/kuba/simp_le.git
WORKDIR /opt/simp_le
# Upgrade setuptools
RUN pip install -U setuptools
# Install simp_le in /usr/local/bin
RUN python ./setup.py install
# Make house cleaning
RUN rm -rf /opt/simp_le
RUN apt-get autoremove -y git gcc libssl-dev libffi-dev python-dev python-pip
RUN apt-get clean all
RUN rm -r /var/lib/apt/lists/*
COPY . /app/ COPY . /app/
WORKDIR /app/ # Install simp_le program
RUN chmod +rx /app/install_simp_le.sh && /app/install_simp_le.sh && rm -f /app/install_simp_le.sh

View file

@ -1,4 +1,4 @@
![nginx 1.9.6](https://img.shields.io/badge/nginx-1.9.6-brightgreen.svg) ![License MIT](https://img.shields.io/badge/license-MIT-blue.svg) [![Build](https://circleci.com/gh/dmp1ce/nginx-proxy-letsencrypt.svg?&style=shield&circle-token=cd873b9ebad6424218c4dee8e8e2344366920dde)](https://circleci.com/gh/dmp1ce/nginx-proxy-letsencrypt) ![nginx 1.9.6](https://img.shields.io/badge/nginx-1.9.6-brightgreen.svg) ![License MIT](https://img.shields.io/badge/license-MIT-blue.svg) [![Build](https://circleci.com/gh/dmp1ce/nginx-proxy-letsencrypt.svg?&style=shield&circle-token=cd873b9ebad6424218c4dee8e8e2344366920dde)](https://circleci.com/gh/dmp1ce/nginx-proxy-letsencrypt) [![](https://badge.imagelayers.io/dmp1ce/nginx-proxy-letsencrypt:latest.svg)](https://imagelayers.io/?images=dmp1ce/nginx-proxy-letsencrypt:latest 'Get your own badge on imagelayers.io')
nginx-proxy sets up a container running nginx and [docker-gen][1]. docker-gen generates reverse proxy configs for nginx and reloads nginx when containers are started and stopped. nginx-proxy sets up a container running nginx and [docker-gen][1]. docker-gen generates reverse proxy configs for nginx and reloads nginx when containers are started and stopped.

28
install_simp_le.sh Executable file
View file

@ -0,0 +1,28 @@
#!/bin/bash
set -e
apt-get update
# Install python packages needed by simp_le
apt-get install -y -q --no-install-recommends python python-requests
# Install python packages needed to build simp_le
apt-get install -y -q --no-install-recommends git gcc libssl-dev libffi-dev python-dev python-pip
# Get Let's Encrypt simp_le client source
git -C /opt clone https://github.com/kuba/simp_le.git
cd /opt/simp_le
# Upgrade setuptools
pip install -U setuptools
# Install simp_le in /usr/local/bin
python ./setup.py install
# Make house cleaning
rm -rf /opt/simp_le
apt-get autoremove -y git gcc libssl-dev libffi-dev python-dev python-pip
apt-get clean all
rm -r /var/lib/apt/lists/*

View file

@ -10,6 +10,7 @@ update_certs() {
# Load relevant container settings # Load relevant container settings
source "$DIR"/letsencrypt_service_data source "$DIR"/letsencrypt_service_data
reload_nginx='false'
for cid in "${LETSENCRYPT_CONTAINERS[@]}"; do for cid in "${LETSENCRYPT_CONTAINERS[@]}"; do
# Derive host and email variable names # Derive host and email variable names
host_varname="LETSENCRYPT_${cid}_HOST" host_varname="LETSENCRYPT_${cid}_HOST"
@ -36,14 +37,15 @@ update_certs() {
# Symlink to created certificate and key. # Symlink to created certificate and key.
ln -sf ./$domain/fullchain.pem /etc/nginx/certs/$domain".crt" ln -sf ./$domain/fullchain.pem /etc/nginx/certs/$domain".crt"
ln -sf ./$domain/key.pem /etc/nginx/certs/$domain".key" ln -sf ./$domain/key.pem /etc/nginx/certs/$domain".key"
reload_nginx='true'
# Update certificates configuration in nginx
/usr/local/bin/docker-gen -only-exposed /app/nginx.tmpl /etc/nginx/conf.d/default.conf
nginx -s reload
fi fi
done done
done done
unset LETSENCRYPT_CONTAINERS unset LETSENCRYPT_CONTAINERS
if [[ "$reload_nginx" == 'true' ]]; then
/usr/local/bin/docker-gen -only-exposed /app/nginx.tmpl /etc/nginx/conf.d/default.conf
nginx -s reload
fi
} }
pid= pid=

View file

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
nginx -s reload
docker-gen \ docker-gen \
-only-exposed \ -only-exposed \
-notify '/app/update_certs' \ -notify '/app/update_certs' \
/app/letsencrypt_service_data.tmpl /app/letsencrypt_service_data /app/letsencrypt_service_data.tmpl /app/letsencrypt_service_data
nginx -s reload