Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:3.11-slim

RUN apt-get update && apt-get install -y \
git \
gcc \
libffi-dev \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*

RUN pip install certbot

RUN git clone https://github.com/stackitcloud/certbot-dns-stackit.git /opt/certbot-dns-stackit \
&& pip install /opt/certbot-dns-stackit

WORKDIR /etc/letsencrypt

ENTRYPOINT ["certbot"]
2 changes: 2 additions & 0 deletions examples/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DOMAIN=example.com
WILDCARD=*.example.com
1 change: 1 addition & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.ini
31 changes: 31 additions & 0 deletions examples/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: '3.8'

services:
certbot:
build:
context: .
dockerfile: ../Dockerfile
container_name: certbot-stackit
volumes:
- ./letsencrypt:/etc/letsencrypt
- ./stackit.ini:/stackit.ini:ro
entrypoint: certbot
command: >
certonly
--agree-tos
--non-interactive
--email dns@${DOMAIN}
--authenticator dns-stackit
--dns-stackit-credentials /stackit.ini
--dns-stackit-propagation-seconds 60
-d "${WILDCARD}" -d "${DOMAIN}"
certbot-renew:
build:
context: .
dockerfile: ../Dockerfile
container_name: certbot-renew
volumes:
- ./letsencrypt:/etc/letsencrypt
- ./stackit.ini:/stackit.ini:ro
entrypoint: certbot
command: renew
45 changes: 45 additions & 0 deletions examples/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Certbot with Stackit DNS Plugin (Docker Compose)

- Custom Docker image: Based on certbot/certbot, with the Stackit DNS plugin installed.
- Docker Compose service to request wildcard certificates.

---
## 📂 Certificate File Structure

```
./letsencrypt/live/<your-domain>/
├── cert.pem # Your domain’s certificate
├── chain.pem # The Let's Encrypt chain
├── fullchain.pem # cert.pem + chain.pem (what you usually use)
├── privkey.pem # Your private key
```


## 🛠️ Setup Instructions


### 1. Create a file named `stackit.ini` in the root directory:

⚠️️️ Make sure the file is secure: (`chmod 600 stackit.ini`)
```
dns_stackit_auth_token = YOUR_API_TOKEN
dns_stackit_project_id = YOUR_PROJECT_ID
```

### 2. Set domain in `.env` file
```
DOMAIN=example.com
WILDCARD=*.example.com
```

### 3. Run Certbot
```
docker compose up certbot
```

### 4. Cert permission

The certs and the live folder will be `root:root`, in order to access them with your user
```bash
sudo chown -R $(id -u):$(id -g) ./letsencrypt
```
Loading