Skip to content

Commit e284ea2

Browse files
guiyomhmblaschke
authored andcommitted
✨ Add Container cerbot/letsencrypt (#21) (#114)
1 parent 058a21a commit e284ea2

File tree

13 files changed

+170
-2
lines changed

13 files changed

+170
-2
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ php: webdevops/php webdevops/php-apache webdevops/php-nginx
2020
php-dev: webdevops/php-dev webdevops/php-apache-dev webdevops/php-nginx-dev
2121
hhvm: webdevops/hhvm webdevops/hhvm-apache webdevops/hhvm-nginx
2222

23-
web: webdevops/apache webdevops/apache-dev webdevops/nginx webdevops/nginx-dev webdevops/varnish
23+
web: webdevops/apache webdevops/apache-dev webdevops/nginx webdevops/nginx-dev webdevops/varnish webdevops/certbot
2424

2525
applications: webdevops/typo3 webdevops/piwik
2626

@@ -165,3 +165,6 @@ webdevops/sphinx:
165165

166166
webdevops/varnish:
167167
bash bin/build.sh varnish "${DOCKER_REPOSITORY}/varnish" "${DOCKER_TAG_LATEST}"
168+
169+
webdevops/certbot:
170+
bash bin/build.sh certbot "${DOCKER_REPOSITORY}/certbot" "${DOCKER_TAG_LATEST}"

bin/provision.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,4 +426,10 @@ function header() {
426426
deployConfiguration samson-deployment/general samson-deployment 'latest'
427427
}
428428

429+
## Build cerbot
430+
[[ $(checkBuildTarget certbot) ]] && {
431+
header "certbot"
432+
}
433+
434+
429435
exit 0

docker/certbot/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Certbot container layout
2+
3+
Automated build and tested by [WebDevOps Build Server](https://build.webdevops.io/)
4+
5+
## Environment variables
6+
7+
Variable | Description
8+
---------------------- | ------------------------------------------------------------------------------
9+
`CERTBOT_EMAIL` | Email of sysadmin
10+
`CERTBOT_DOMAIN` | Registered dns or public ip
11+
12+
## USAGE
13+
14+
To create or renew existing certificate
15+
```bash
16+
docker run -ti --rm \
17+
-v /etc/letsencrypt:/etc/letsencrypt \
18+
-v /your/document_root:/var/www \
19+
webdevops/certbot /usr/bin/certbot certonly \
20+
--agree-tos \
21+
--webroot \
22+
-w /var/www
23+
-d webdevops.io \
24+
25+
```
26+
See [commandline options](https://certbot.eff.org/docs/using.html#command-line-options)
27+
28+
## Template a cronjob to reissue the certificate
29+
30+
Create a file **/etc/cron.monthly/reissue**
31+
```bash
32+
#!/bin/sh
33+
set -euo pipefail
34+
# Certificate reissue
35+
36+
docker run -ti --rm \
37+
-v /etc/letsencrypt:/etc/letsencrypt \
38+
-v /your/document_root:/var/www \
39+
webdevops/certbot /usr/bin/certbot renew
40+
41+
```
42+
make file executable : chmod +x /etc/cron.monthly/reissue
43+
44+
see [Renewal](https://certbot.eff.org/docs/using.html#renewal)

docker/certbot/latest/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#+++++++++++++++++++++++++++++++++++++++
2+
# Dockerfile for webdevops/certbot:latest
3+
# -- automatically generated --
4+
#+++++++++++++++++++++++++++++++++++++++
5+
6+
FROM webdevops/bootstrap:alpine-3
7+
8+
9+
LABEL vendor=WebDevOps.io
10+
LABEL io.webdevops.layout=8
11+
LABEL io.webdevops.version=0.53.2
12+
13+
VOLUME /etc/letsencrypt
14+
VOLUME /var/www
15+
16+
RUN /usr/local/bin/apk-install \
17+
certbot
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{{ docker.from("bootstrap","alpine-3") }}
2+
3+
{{ docker.version() }}
4+
5+
{{ docker.volume('/etc/letsencrypt') }}
6+
{{ docker.volume('/var/www') }}
7+
8+
{{ certbot.alpine() }}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{% import 'Dockerfile/provision.jinja2' as provision %}
2+
3+
{% macro env() -%}
4+
ENV CERTBOT_EMAIL ""
5+
ENV CERTBOT_DOMAIN ""
6+
{%- endmacro %}
7+
8+
{% macro alpine() -%}
9+
RUN /usr/local/bin/apk-install \
10+
certbot
11+
{%- endmacro %}

template/Dockerfile/layout.jinja2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
{% import 'Dockerfile/images/vsftp.jinja2' as vsftp %}
2222
{% import 'Dockerfile/images/samson-deployment.jinja2' as samsonDeployment %}
2323
{% import 'Dockerfile/images/varnish.jinja2' as varnish %}
24+
{% import 'Dockerfile/images/certbot.jinja2' as certbot %}
2425
#+++++++++++++++++++++++++++++++++++++++
2526
# Dockerfile for webdevops/{{ Dockerfile.image }}:{{ Dockerfile.tag }}
2627
# -- automatically generated --

test/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,6 @@ varnish:
7474

7575
sphinx:
7676
bash ./run.sh sphinx
77+
78+
certbot:
79+
bash ./run.sh certbot

test/run.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,20 @@ ENV VARNISH_BACKEND_HOST \"google.com\"
964964
waitForTestRun
965965
}
966966

967+
#######################################
968+
# webdevops/certbot
969+
#######################################
970+
971+
[[ $(checkTestTarget certbot) ]] && {
972+
setupTestEnvironment "certbot"
973+
974+
# setSpecTest "base"
975+
setEnvironmentOsFamily "alpine"
976+
977+
OS_VERSION="3" runTestForTag "latest"
978+
979+
waitForTestRun
980+
}
967981

968982
echo ""
969983
echo " >>> finished, all tests PASSED <<<"

test/spec/collection/certbot.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
shared_examples 'collection::certbot' do
2+
include_examples 'misc::letsencrypt'
3+
include_examples 'certbot::layout'
4+
end

0 commit comments

Comments
 (0)