-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e9fbee
commit 23d7c68
Showing
9 changed files
with
96 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
services: | ||
proxy_init_certs: | ||
build: | ||
context: ./docker/proxy-init-certs | ||
ports: | ||
- "80:80" | ||
volumes: | ||
- ./docker/certbot/certs:/etc/nginx/certs | ||
- certbot_www:/var/www/certbot | ||
environment: | ||
- SERVER_NAME=${SERVER_NAME:-gally.localhost} | ||
- API_SERVER_NAME=${API_SERVER_NAME:-api.gally.localhost} | ||
|
||
certbot_init_certs: | ||
build: | ||
context: ./docker/certbot-init-certs | ||
volumes: | ||
- ./docker/certbot/certs:/etc/letsencrypt | ||
- certbot_www:/var/www/certbot | ||
environment: | ||
- SERVER_NAME=${SERVER_NAME:-gally.localhost} | ||
- API_SERVER_NAME=${API_SERVER_NAME:-api.gally.localhost} | ||
- HAS_MULTIPLE_DOMAINS=${API_SERVER_NAME:-} | ||
|
||
volumes: | ||
certbot_www: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM certbot/certbot:latest | ||
|
||
COPY ./generate-certs.sh /generate-certs.sh | ||
|
||
HEALTHCHECK --interval=1m --timeout=10s --start-period=30s --retries=3 \ | ||
CMD find /etc/letsencrypt/ -name 'fullchain.pem' -exec test -f {} \; || exit 1 | ||
|
||
ENTRYPOINT ["/generate-certs.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
|
||
CERT_PATH="/etc/letsencrypt/${SERVER_NAME}/fullchain.pem" | ||
KEY_PATH="/etc/letsencrypt/${SERVER_NAME}/privkey.pem" | ||
|
||
if [[ ! -f "$CERT_PATH" ]]; then | ||
mkdir -p $(dirname $CERT_PATH) | ||
|
||
if [[ -z $SELF_SIGNED ]] | ||
then | ||
echo 'Ask letsencrypt certificates' | ||
[[ -z "${HAS_MULTIPLE_DOMAINS}" ]] \ | ||
&& DOMAINS="${SERVER_NAME}" \ | ||
|| DOMAINS="${SERVER_NAME},${API_SERVER_NAME}" | ||
|
||
certbot certonly --webroot --webroot-path=/var/www/certbot --non-interactive --agree-tos --register-unsafely-without-email --agree-tos --no-eff-email -d ${DOMAINS} | ||
fi | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM nginx:latest | ||
|
||
COPY --link ./templates /etc/nginx/templates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
server { | ||
listen 80; | ||
server_name ${SERVER_NAME} ${API_SERVER_NAME}; | ||
|
||
# Rediriger tout le trafic HTTP vers HTTPS | ||
location /.well-known/acme-challenge/ { | ||
root /var/www/certbot; | ||
} | ||
|
||
location / { | ||
return 301 https://$host$request_uri; | ||
} | ||
} |