Created
April 24, 2020 08:35
-
-
Save AntouanK/d6407b6e4b2c37003e0385c3594dba41 to your computer and use it in GitHub Desktop.
generic certbot script to update letsencrypt certificates
This file contains hidden or 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
#!/bin/bash | |
COMPOSE_DIR='/home/user/foo' | |
COMPOSE_FILE="$COMPOSE_DIR/docker-compose.yml" | |
DOMAIN=foo.bar.com | |
docker pull certbot/certbot ; | |
docker-compose -f $COMPOSE_FILE down; | |
sudo docker run \ | |
-it \ | |
--rm \ | |
-p 443:443 \ | |
-p 80:80 \ | |
--name certbot \ | |
-v "/etc/letsencrypt:/etc/letsencrypt" \ | |
-v "/var/lib/letsencrypt:/var/lib/letsencrypt" \ | |
certbot/certbot certonly \ | |
--rsa-key-size 4096 \ | |
--keep-until-expiring \ | |
--standalone \ | |
--preferred-challenges http \ | |
-n \ | |
--agree-tos \ | |
-m [email protected] \ | |
-d $DOMAIN ; | |
sudo cp -v /etc/letsencrypt/live/$DOMAIN/fullchain.pem /etc/letsencrypt/live/$DOMAIN/privkey.pem $COMPOSE_DIR/certs/ | |
docker-compose -f $COMPOSE_FILE up -d; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment