nginx-certbot icon indicating copy to clipboard operation
nginx-certbot copied to clipboard

WIP: Attempt to automate initial bootstrap without need to run `init-letsencrypt.sh` manually

Open andrius opened this issue 4 years ago • 3 comments

In some my project I do need to fully automate SSL certificate creation without user intervention. Idea is to move init-letsencrypt.sh and tune up scripts so initial certificates will be created automatically.

Steps:

  • [x] Update docker-compose.yml or create a Dockerfile so certbot service won't start without "healthy" nginx service;
  • [x] Create a Dockerfile for nginx service, add a docker-entrypoint.sh, that replicate most of the init-letsencrypt.sh logic:
    • [x] Create new SSL for first run (by checking for a files presence in the certain folder);
    • [x] Start nginx linux service and remove created SSL certificate right after that;
    • [x] Wait for certbot docker service and request certificate first time;
    • [x] domain, email and other user-data should be available through environment variable (introduce .env file;
  • [ ] Update README.md.

andrius avatar Oct 25 '20 15:10 andrius

Is there a plan to accept this pull request?

bzgec avatar Apr 15 '21 07:04 bzgec

if domains were an array, the init-letsencrypt.sh will failed, it just handled the first domain in array.

### no for loop here.

echo "### Creating dummy certificate for $domains ..."

path="/etc/letsencrypt/live/$domains"
mkdir -p "$data_path/conf/live/$domains"

docker-compose run --rm --entrypoint "\
  openssl req -x509 -nodes -newkey rsa:$rsa_key_size -days 1\
    -keyout '$path/privkey.pem' \
    -out '$path/fullchain.pem' \
    -subj '/CN=localhost'" certbot
echo

zx1986 avatar May 28 '22 05:05 zx1986

Also need to update README.md

mzbik avatar Jan 05 '23 22:01 mzbik