Try to run with LE mounting on post-deploy
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Luke Murphy 2020-04-06 11:50:09 +02:00
parent b9cdae9857
commit bcaf9601e9
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
3 changed files with 37 additions and 37 deletions

33
ansible/post-deploy.yml Normal file
View File

@ -0,0 +1,33 @@
---
- hosts: all
gather_facts: false
tasks:
- name: Load variables
include_vars:
dir: "{{ dokku_lib_root }}/data/ansible/autonomic.zone/vars/"
extensions:
- yml
- name: Setup LE certificates
shell: dokku letsencrypt autonomic.zone
args:
creates: /home/dokku/autonomic.zone/letsencrypt/certs
- name: Setup LE certificates renew cron job
shell: dokku letsencrypt:cron-job --add
args:
creates: /home/dokku/autonomic.zone/letsencrypt/cron-job
- name: Specify docker volume mounts
dokku_storage:
app: autonomic.zone
mounts:
- /home/dokku/autonomic.zone/letsencrypt/certs/current/key.pem:/etc/x509/https/tls.key
- /home/dokku/autonomic.zone/letsencrypt/certs/current/cert.pem:/etc/x509/https/tls.crt
- name: Set HTTP 443 port
dokku_ports:
app: autonomic.zone
mappings:
- "https:443:{{ http_port }}"
state: present

View File

@ -56,30 +56,6 @@
- "http:4000:4000"
state: absent
- name: Setup LE certificates
shell: dokku letsencrypt autonomic.zone
args:
creates: /home/dokku/autonomic.zone/letsencrypt/certs
- name: Setup LE certificates renew cron job
shell: dokku letsencrypt:cron-job --add
args:
creates: /home/dokku/autonomic.zone/letsencrypt/cron-job
- name: Set HTTP 443 port
dokku_ports:
app: autonomic.zone
mappings:
- "https:443:{{ http_port }}"
state: present
- name: Specify docker volume mounts
dokku_storage:
app: autonomic.zone
mounts:
- /home/dokku/autonomic.zone/letsencrypt/certs/current/key.pem:/etc/x509/https/tls.key
- /home/dokku/autonomic.zone/letsencrypt/certs/current/cert.pem:/etc/x509/https/tls.crt
- name: Configure the dokku app environment
dokku_config:
app: autonomic.zone

View File

@ -6,19 +6,10 @@ set -eu -o pipefail
run_jekyll() {
set -eu
local args="--port $JEKYLL_PORT --host $JEKYLL_HOST --trace"
# Note(decentral1se): handle the case where the Dokku is deploying the app
# with HTTP support only before we have a chance to deploy the lets encrypt
# certificates and mount them into the container
if [ -f "$JEKYLL_SSL_CERT" ]; then
args="${args} --ssl-cert $JEKYLL_SSL_CERT"
fi
if [ -f "$JEKYLL_SSL_KEY" ]; then
args="${args} --ssl-key $JEKYLL_SSL_KEY"
fi
jekyll serve "$args"
jekyll serve \
--port "$JEKYLL_PORT" \
--host "$JEKYLL_HOST" \
--trace
}
# Main entrypoint