- Make sure to create
.env
from.env.sample
and replace the key - Get the first certificate:
docker-compose -f docker-compose.deploy.yml run --rm certbot /opt/certify-init.sh
- Then need to stop the docker service first, then run again
docker-compose -f docker-compose.deploy.yml down docker-compose -f docker-compose.deploy.yml up
HANDLING RENEW CERTIFICATE
-
Create
renew.sh
vim ~/renew.sh
-
Add the code bellow but need to replace YOUR_PROJECT_DIR to your project location
#!/bin/sh set -e cd YOUR_PROJECT_DIR /usr/local/bin/docker-compose -f docker-compose.deploy.yml run --rm certbot certbot renew
-
Run
chmod +x ~/renew.sh
-
Run
crontab -e
-
Then add
0 0 * * 6 sh /home/ec2-user/renew.sh