Add automated Let's Encrypt support via certbot
Summary
Adds automated Let's Encrypt certificate management using Certbot.
This introduces two optional Docker Compose services:
certbot-initโ performs the initial certificate issuance using standalone modecertbot-renewโ runs in the background and periodically renews certificates
Nginx is reloaded automatically after successful renewal using kill -HUP 1
No actionable comments were generated in the recent review. ๐
โน๏ธ Recent review info
โ๏ธ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bdf20dc2-305a-406e-b7f5-7d46fdce6ae1
๐ฅ Commits
Reviewing files that changed from the base of the PR and between 22b63f1569d3b60ca962b0f64583af29ee16aae9 and 8474f5badd86545a1bfafa52f987ce9b998e1618.
๐ Files selected for processing (2)
docker-compose.nginx.ymlenv.example
โ Files skipped from review due to trivial changes (1)
- env.example
๐ง Files skipped from review as they are similar to previous changes (1)
- docker-compose.nginx.yml
๐ Walkthrough
Walkthrough
Adds two Certbot services to docker-compose for one-time certificate issuance and continuous renewal, and updates environment file comments explaining the ACME workflow and an optional GitLab PKI chain variable.
Changes
Let's Encrypt automation
| Layer / File(s) | Summary |
|---|---|
Certbot renewal and initialization docker-compose.nginx.yml |
Added certbot-init (profile: acme-init) for one-time certbot certonly using HTTP-01 on ${HTTP_PORT} with idempotent certificate-existence checks, and certbot-renew (profile: acme) that loops certbot renew every 24 hours, mounts certificate directories and shared webroot, depends on nginx, and triggers nginx reload via deploy hook. |
Configuration documentation env.example |
Updated comments to document the two-step Let's Encrypt workflow (acme-init profile for initial certificate, then acme profile for automatic renewal), and added an optional GITLAB_PKI_CHAIN_PATH explanation (commented example) to prevent certificate validation failures in GitLab SSO. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant Compose as Docker Compose
participant CertInit as certbot-init
participant LE as Let's Encrypt
participant FS as File System
participant Nginx
participant CertRenew as certbot-renew
User->>Compose: Run with acme-init profile
Compose->>CertInit: Start certbot-init
CertInit->>FS: Check /etc/letsencrypt/live/$DOMAIN
alt certificate missing
CertInit->>LE: Request cert via HTTP-01 on ${HTTP_PORT}
LE->>CertInit: HTTP-01 challenge
CertInit->>LE: Respond to challenge
LE->>FS: Issue and store certificate
else certificate exists
CertInit->>CertInit: Exit successfully
end
User->>Compose: Run with acme profile
Compose->>Nginx: Start nginx
Compose->>CertRenew: Start certbot-renew
loop Every 24 hours
CertRenew->>LE: certbot renew for ${DOMAIN}
alt renewed
LE->>FS: Update certificate files
CertRenew->>Nginx: deploy hook (kill -HUP 1)
Nginx->>Nginx: Reload configuration
end
end
Estimated code review effort
๐ฏ 2 (Simple) | โฑ๏ธ ~10 minutes
๐ฅ Pre-merge checks | โ 5
โ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | โ Passed | The title accurately and clearly summarizes the main change: adding automated Let's Encrypt certificate management via Certbot to the Docker setup. |
| Description check | โ Passed | The description is directly related to the changeset, providing a clear summary of the two new Docker Compose services and their purpose. |
| Docstring Coverage | โ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check | โ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | โ Passed | Check skipped because no linked issues were found for this pull request. |
โ๏ธ Tip: You can configure your own custom pre-merge checks in the settings.
โจ Finishing Touches
๐งช Generate unit tests (beta)
- [ ] Create PR with unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
@coderabbitai approve
Comments resolved and changes approved.โ
Actions performed
This PR has been automatically labelled "stale" because it hasn't had recent activity. A core team member will check in on the status of the PR to help with questions. Thank you for your contribution!