ungleich-certbot/README.md

135 lines
3.9 KiB
Markdown
Raw Normal View History

2021-06-19 14:41:43 +00:00
## ungleich-certbot
This container is made for getting **real world** certificates
for your kubernetes cluster.
The assumption is that you can point the DNS name to the container
from outside. This is by default given for **IPv6 only kubernetes
services**.
The source of this image can be found on
[code.ungleich.ch](https://code.ungleich.ch/ungleich-public/ungleich-certbot).
2021-06-19 14:41:43 +00:00
## Usage
* Set the environment variable DOMAIN to specify the domain for which
to get a certificate
* Set the environment variable EMAIL (this is where letsencrypt sends
warnings to)
* Set the environment variable STAGING to "no" if you want to have
proper certificates - this is to prevent you from asking the real
letsencrypt service accidently by default
2021-06-20 12:42:19 +00:00
* By default the container allows world read access to the
certificates, so that non-root users can access the certificates.
Set the LEAVE_PERMISSIONS_AS_IS environment variable to instruct the
container not to change permissions
* If you setup the variable NO_NGINX to any value, the container will
NOT start nginx and use certbot in standalone mode
2021-12-04 22:46:57 +00:00
2021-06-20 12:42:19 +00:00
```
docker run -e DOMAIN=example.com \
-e EMAIL=root@example.com \
2021-12-24 10:50:20 +00:00
ungleich/ungleich-certbot:1.1.1
2021-06-20 12:42:19 +00:00
```
2021-06-19 14:41:43 +00:00
### Production certificate
2021-10-10 07:05:51 +00:00
Use
2021-10-10 07:05:51 +00:00
```
docker run -e DOMAIN=example.com \
-e EMAIL=root@example.com \
-e STAGING=no \
2021-12-24 10:50:20 +00:00
ungleich/ungleich-certbot:1.1.1
2021-10-10 07:05:51 +00:00
```
you will get a proper, real world usable nginx server. Inject the
nginx configuration by meains of a volume to /etc/nginx/conf.d
2021-12-24 10:50:20 +00:00
### Adding or overriding nginx configurations
To add your own nginx configurations, create the directory
/nginx-configs and add your configurations in there:
```
docker run -e DOMAIN=example.com \
-e EMAIL=root@example.com \
-v /path/to/config:/nginx-configs \
ungleich/ungleich-certbot:1.1.1
```
By default this image is deploying the *default.conf*. If you want to
override the default image nginx configuration, you can supply your
own default.conf.
2021-07-19 20:56:51 +00:00
### Exiting after getting the certificate
By default, the container will stay alive and try to renew the
certificate every day. If you set the environment variable
2021-07-19 20:56:51 +00:00
`ONLYGETCERT`, then it will only get the certificates and exit.
This mode can be used
as a [kubernetes Job](https://kubernetes.io/docs/concepts/workloads/controllers/job/).
### Only renewing the certificate once
2021-07-21 11:24:51 +00:00
If you only want to trigger renewing existing certificates and skip
getting the certificates initially, you can set the variable
`RENEWCERTSONCE`, then it will only renew all certificates and exit.
* If `ONLYRENEWCERTSONCE` is set, renew will be run once and then the
container exits
This mode can be used
as a [kubernetes Job](https://kubernetes.io/docs/concepts/workloads/controllers/job/).
2021-06-19 14:41:43 +00:00
## Volumes
If you want to keep / use your certificates, you are advised to create
a volume below /etc/letsencrypt.
2021-10-19 06:24:29 +00:00
## Changelog
### 0.1.0
Usable with automatic renewal
### 0.2.0
Added support for nginx webserver, based on official nginx image
### 1.0.0
- Start nginx in foreground, if not opted out
- Nicely shows erros of nginx starting, which is what we need
- Starting nginx by default on port 80
- Removed variable NGINX to start nginx
- Introducted variable NO_NGINX to prevent nginx from starting
- Changed the wait time for domain resolution test to every 2 seconds
- helps to startup faster
- Added directory /nginx from which configuration files are sourced
- can be used to overwrite built-in configurations
- Create file /tmp/last_renew for checking when
- Dropped support for NGINX_HTTP_REDIRECT (always enabled with nginx
now) -- can be overwritten by overriding /nginx directory
- Dropped support for ONLYRENEWCERTS - this is covered by NO_NGINX already
2021-10-19 06:24:29 +00:00
2021-12-24 10:50:20 +00:00
### 1.1.0
- Allow better way to inject configurations
### 1.1.1
- Fix incorrect configuration sourcing
2022-01-30 19:55:58 +00:00
### 1.1.2
- Add missing crond invocation
2021-12-24 10:50:20 +00:00
2021-06-19 14:41:43 +00:00
## Kubernetes
2021-07-19 20:56:51 +00:00
See https://code.ungleich.ch/ungleich-public/ungleich-k8s/.