Home

Awesome

Deprecated

Gem Version Build Status Coveralls branch Code Climate

jekyll-gitlab-letsencrypt

img

This plugin automagically does the entire the letsencrypt process for your gitlab-hosted jekyll blog!

Usage

Prerequisites

You must have:

Versions supported:

Installation

  group :jekyll_plugins do
    gem 'jekyll-emojis'
    gem 'jekyll-more-emojis'
++  gem 'jekyll-gitlab-letsencrypt'
  end

and run bundle install

First-time Configuration

Add a gitlab-letsencrypt to your _config.yml:

gitlab-letsencrypt:
  # Gitlab settings:
  personal_access_token: 'MUCH SECRET'             # Gotten from the step above ^^
  gitlab_repo:           'gitlab_user/gitlab_repo' # Namespaced repository identifier

  # Domain settings:
  email:                 'example@example.com'     # Let's Encrypt email address
  domain:                'example.com'             # Domain that the cert will be issued for

  # Jekyll settings:
  base_path:  './'               # Where you want the file to go
  pretty_url: false              # Add a "/" on the end of the URL... set to `true` if you use permalink_style: pretty
  append_str: ''                 # Append this string to the end of the challenge URL
  filename:   'letsencrypt.html' # What to call the generated challenge file

  # Delay settings:
  initial_delay: 120 # How long to wait for Gitlab CI to push your changes before it starts checking
  delay_time:     15 # How long to wait between each check once it starts looking for the file

  # Optional settings you probably don't need:
  gitlab_url:     'https://someurl'           # Set if you need to use a self-hosted GitLab instance
  endpoint:       'https://somewhere'         # if you're doing the ACME thing outside of letsencrypt
  branch:         'master'                    # Defaults to master, but you can use a different branch
  layout:         'null'                      # Layout to use for challenge file - defaults to null, but you can change if needed
  scheme:         'https'                     # Scheme to use for challenge request; default http
  commit_message: 'Renew certificate [ROBOT]' # Commit message to use; defaults to "Automated Let's Encrypt renewal"

Running

$ jekyll letsencrypt
Registering example@example.com to https://acme-v01.api.letsencrypt.org/...
Pushing file to Gitlab
Commiting challenge file as lets.html
Done Commiting! Check https://gitlab.com/gitlab_user/gitlab_repo/commits/master
Going to check http://example.com/.well-known/acme-challenge/lots_of_numbers/ for the challenge to be present...
Waiting 120 seconds before we start checking for challenge..
Got response code 404, waiting 15 seconds...
Got response code 404, waiting 15 seconds...
Got response code 200, file is present!
Requesting verification...
Challenge status = valid
Challenge is valid!
Certificate retrieved!
Updating domain example.com pages setting with new certificates..
Success!

Alternative token usage

If you don't want to put your secret gitlab token in your _config.yml, you can pass it as an ENV var when you run the command:

GITLAB_TOKEN="VERY_SECRET_NOT_IN_GIT_PLEASE" jekyll letsencrypt

License

MIT

Credits/thanks