Skip to content

Commit

Permalink
Add script to set heroku certs
Browse files Browse the repository at this point in the history
Switching to heroku due to openshift 2 shutdown #173
  • Loading branch information
cben committed Sep 29, 2017
1 parent 29f5600 commit b3f94b3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
32 changes: 32 additions & 0 deletions deployment/tls-certs-letsencrypt/heroku-set-certs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

# Deploy certs files per https://devcenter.heroku.com/articles/ssl
# Requires `heroku` CLI, and being logged in.

# (Alternative: paid dynos (including Hobby) can simply enable https://devcenter.heroku.com/articles/automated-certificate-management)

set -e -u -o pipefail
set -x

cd "$(dirname "$0")"

# TODO: command-line parameters like rhc-set-certs.sh ?

# One cert for all 4 domains.
main_domain='mathdown.net'
alt_domains=('www.mathdown.net' 'www.mathdown.com' 'mathdown.com')
domains=("$main_domain" "${alt_domains[@]}")

app=mathdown
cert=certs/mathdown.net/cert.pem
privkey=certs/mathdown.net/privkey.pem
if heroku certs:info --app "$app"; then
heroku certs:update --app "$app" "$cert" "$privkey"
else
heroku certs:add --app "$app" "$cert" "$privkey"
fi

curl --head "https://$main_domain/"

echo 'To analyze certs & security:'
printf ' https://www.ssllabs.com/ssltest/analyze.html?d=%s&latest\n' "${domains[@]}"
2 changes: 1 addition & 1 deletion deployment/tls-certs-letsencrypt/rhc-set-certs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ else
keyopts=(--certificate="certs/$main_domain"/fullchain.pem --private-key="$3" --passphrase="$4")
fi

# <rant>In fish $X does the right thing, in bash I need "${X[@]}" and it only comes close.</rant>
# <rant>In fish $ARRAY does the right thing, in bash I need "${ARRAY[@]}" and it only comes close.</rant>

echo '== before: =='
rhc alias list "${appopts[@]}"
Expand Down

0 comments on commit b3f94b3

Please sign in to comment.