Skip to content
This repository was archived by the owner on Nov 26, 2024. It is now read-only.

Commit 90f814c

Browse files
authored
Merge pull request #41 from phpdocker-io/remove-cron
Remove built-in cron and matching kubernetes deployment
2 parents 99b79cf + fb42982 commit 90f814c

File tree

5 files changed

+31
-87
lines changed

5 files changed

+31
-87
lines changed

Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,14 @@ ENV DOMAINS=foo.com,www.foo.com,bar.foo.com
1717
RUN echo "deb http://ppa.launchpad.net/certbot/certbot/ubuntu bionic main" > /etc/apt/sources.list.d/letsencrypt.list \
1818
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7BF576066ADA65728FC7E70A8C47BE8E75BCA694 \
1919
&& apt-get update \
20-
&& apt-get -y --no-install-recommends install nano cron certbot \
20+
&& apt-get -y --no-install-recommends install certbot \
2121
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
2222

2323
# Composer config - add early to benefit from docker build caches
2424
COPY composer.* /workdir/
2525
RUN composer -o install --no-dev
2626

27-
# App and crontab
2827
COPY . /workdir/
29-
RUN ln -s /workdir/crontab /var/spool/cron/crontabs/root
3028

3129
# Expose HTTP/HTTPS ports for certbot standalone
3230
EXPOSE 80 443

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ There's an example [kubernetes cronjob](kubernetes/certbot-cronjob.yml) you can
1313

1414
## Compatibility
1515

16-
* Kong >= 0.14: use Kong Certbot Agent 2.x.
17-
* Kong <= 0.13: use Kong Certbot Agent 1.x.
18-
16+
* Kong Certbot Agent 3.x: compatible with Kong 0.14 and 1.x. Kubernetes examples compatible with Kubernetes >= 1.8
17+
* Kong Certbot Agent 2.x: compatible with Kong 0.14 and 1.x. Kubernetes examples compatible with Kubernetes <= 1.8
18+
* Kong Certbot Agent 1.x: compatible with Kong <= 0.13. Kubernetes examples compatible with Kubernetes <= 1.8
19+
1920
## How to
2021

2122
### Run the container
@@ -88,13 +89,11 @@ Then, associate this route to it:
8889

8990
## Kubernetes
9091

91-
Head off to the [Kubernetes deployment configuration](kubernetes) for examples, using a Kubernetes service
92-
plus either a [deployment (deprecated)](kubernetes/certbot-cron.yml), or a [kubernetes cronjob](kubernetes/certbot-cronjob.yml).
92+
Here's a [kubernetes cronjob example](kubernetes/certbot-cronjob.yml).
9393

94-
Note that the cron deployment is legacy stuff, from before Kubernetes had `CronJob` (pre 1.4). Please use a proper kubernetes
95-
`CronJob` object for scheduling.
94+
### Note
9695

97-
Note: your k8s service will always time out since there's nothing listening on HTTP except for when certbot itself is
96+
Your k8s service SHOULD always time out since there's nothing listening on HTTP except for when certbot itself is
9897
running and requesting certs from LE.
9998

10099
## Command line tool
@@ -126,12 +125,13 @@ docker run -it --rm phpdockerio/kong-certbot-agent \
126125

127126
You can give the agent a pretty big list of domains to acquire certificates for (100), but bear in mind it will be one certificate
128127
shared among all of them. You might want to set up different cronjobs for different sets of certificates, grouped in a manner
129-
that makes sense to you.
128+
that makes sense to you. Also, if one of the domains you're getting a certificate from fails the HTTP challenge, cert acquisition
129+
for the whole group fails.
130130

131131
### How about wildcard certs?
132132

133133
Unfortunately, certbot does not support http challenges on wildcard certs, needing to resort to other types (like DNS).
134-
Due to the way certbot agent works, this will never be supported by the agent.
134+
Due to the way certbot agent works, this will never be supported by the agent.
135135

136136
### Any considerations on a first time set up?
137137

crontab

Lines changed: 0 additions & 2 deletions
This file was deleted.

kubernetes/certbot-cron.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

kubernetes/certbot-cronjob.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ spec:
2222
---
2323

2424
# Make sure you edit your config below at the environment vars
25+
# Ensures certbot doesn't loop forever on fail to avoid exhausting your LE quotas in case of initial misconfiguration
26+
2527

2628
apiVersion: batch/v1beta1
2729
kind: CronJob
@@ -33,31 +35,29 @@ spec:
3335
concurrencyPolicy: Forbid
3436
jobTemplate:
3537
spec:
38+
completions: 1
39+
backoffLimit: 0
3640
template:
3741
# Matches selector on service above
3842
metadata:
3943
labels:
4044
app: kong-certbot
4145
spec:
42-
# Ensure certbot doesn't loop forever on fail to avoid exhausting your LE quotas in case of initial misconfiguration
43-
completions: 1
44-
backoffLimit: 0
4546
restartPolicy: Never
46-
4747
containers:
48-
- name: runtime
49-
image: phpdockerio/kong-certbot-agent:latest
50-
command: [ "/workdir/certbot-agent", "certs:update", "$(KONG_ENDPOINT)", "$(EMAIL)", "$(DOMAINS)" ]
51-
ports:
52-
- name: web
53-
containerPort: 80
54-
protocol: TCP
55-
env:
56-
- name: TERM
57-
value: linux
58-
- name: KONG_ENDPOINT
59-
value: http://base.path.to.kong.admin:8001
60-
- name: EMAIL
61-
value: letsencrypt@registration.email
62-
- name: DOMAINS
63-
value: comma.separated,list.of,domains.and.subdomains
48+
- name: runtime
49+
image: phpdockerio/kong-certbot-agent:3.0.0
50+
command: [ "/workdir/certbot-agent", "certs:update", "$(KONG_ENDPOINT)", "$(EMAIL)", "$(DOMAINS)" ]
51+
ports:
52+
- name: web
53+
containerPort: 80
54+
protocol: TCP
55+
env:
56+
- name: TERM
57+
value: linux
58+
- name: KONG_ENDPOINT
59+
value: http://base.path.to.kong.admin:8001
60+
- name: EMAIL
61+
value: letsencrypt@registration.email
62+
- name: DOMAINS
63+
value: comma.separated,list.of,domains.and.subdomains

0 commit comments

Comments
 (0)