-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
13 changed files
with
170 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Certbot container layout | ||
|
||
Automated build and tested by [WebDevOps Build Server](https://build.webdevops.io/) | ||
|
||
## Environment variables | ||
|
||
Variable | Description | ||
---------------------- | ------------------------------------------------------------------------------ | ||
`CERTBOT_EMAIL` | Email of sysadmin | ||
`CERTBOT_DOMAIN` | Registered dns or public ip | ||
|
||
## USAGE | ||
|
||
To create or renew existing certificate | ||
```bash | ||
docker run -ti --rm \ | ||
-v /etc/letsencrypt:/etc/letsencrypt \ | ||
-v /your/document_root:/var/www \ | ||
webdevops/certbot /usr/bin/certbot certonly \ | ||
--agree-tos \ | ||
--webroot \ | ||
-w /var/www | ||
-d webdevops.io \ | ||
-m "[email protected]" | ||
``` | ||
See [commandline options](https://certbot.eff.org/docs/using.html#command-line-options) | ||
|
||
## Template a cronjob to reissue the certificate | ||
|
||
Create a file **/etc/cron.monthly/reissue** | ||
```bash | ||
#!/bin/sh | ||
set -euo pipefail | ||
# Certificate reissue | ||
|
||
docker run -ti --rm \ | ||
-v /etc/letsencrypt:/etc/letsencrypt \ | ||
-v /your/document_root:/var/www \ | ||
webdevops/certbot /usr/bin/certbot renew | ||
|
||
``` | ||
make file executable : chmod +x /etc/cron.monthly/reissue | ||
|
||
see [Renewal](https://certbot.eff.org/docs/using.html#renewal) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#+++++++++++++++++++++++++++++++++++++++ | ||
# Dockerfile for webdevops/certbot:latest | ||
# -- automatically generated -- | ||
#+++++++++++++++++++++++++++++++++++++++ | ||
|
||
FROM webdevops/bootstrap:alpine-3 | ||
|
||
MAINTAINER [email protected] | ||
LABEL vendor=WebDevOps.io | ||
LABEL io.webdevops.layout=8 | ||
LABEL io.webdevops.version=0.53.2 | ||
|
||
VOLUME /etc/letsencrypt | ||
VOLUME /var/www | ||
|
||
RUN /usr/local/bin/apk-install \ | ||
certbot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{{ docker.from("bootstrap","alpine-3") }} | ||
|
||
{{ docker.version() }} | ||
|
||
{{ docker.volume('/etc/letsencrypt') }} | ||
{{ docker.volume('/var/www') }} | ||
|
||
{{ certbot.alpine() }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% import 'Dockerfile/provision.jinja2' as provision %} | ||
|
||
{% macro env() -%} | ||
ENV CERTBOT_EMAIL "" | ||
ENV CERTBOT_DOMAIN "" | ||
{%- endmacro %} | ||
|
||
{% macro alpine() -%} | ||
RUN /usr/local/bin/apk-install \ | ||
certbot | ||
{%- endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,3 +74,6 @@ varnish: | |
|
||
sphinx: | ||
bash ./run.sh sphinx | ||
|
||
certbot: | ||
bash ./run.sh certbot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
shared_examples 'collection::certbot' do | ||
include_examples 'misc::letsencrypt' | ||
include_examples 'certbot::layout' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'serverspec' | ||
require 'docker' | ||
require 'spec_helper' | ||
|
||
describe "Dockerfile" do | ||
before(:all) do | ||
@image = Docker::Image.build_from_dir('.', { 'dockerfile' => ENV['DOCKERFILE'] }) | ||
set :docker_image, @image.id | ||
end | ||
|
||
include_examples 'collection::bootstrap' | ||
# include_examples 'collection::base' | ||
include_examples 'collection::certbot' | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
shared_examples 'certbot::layout' do | ||
######################### | ||
## Directories | ||
######################### | ||
[ | ||
"/var/www", | ||
"/etc/letsencrypt", | ||
].each do |file| | ||
describe file("#{file}") do | ||
# Type check | ||
it { should be_directory } | ||
|
||
# Owner test | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
|
||
# Read test | ||
it { should be_readable.by('owner') } | ||
it { should be_readable.by('group') } | ||
it { should be_readable.by('others') } | ||
|
||
# Write test | ||
it { should be_writable.by('owner') } | ||
it { should_not be_writable.by('group') } | ||
it { should_not be_writable.by('others') } | ||
|
||
# Exectuable test | ||
it { should be_executable.by('owner') } | ||
it { should be_executable.by('group') } | ||
it { should be_executable.by('others') } | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters