After a long struggle I managed to fix it finally.
Here is what needs to be done:
From the SSH session run the following command to find the container IDs or names:
docker ps
Use the following command to access the docker’s container’s shell
docker exec -it [container_id or name] bash
Export the Cloudflare API key and email as environment variables. This is to allow ‘acme.sh’ script to authenticate with Cloudflare’s API to create and remove DNS records needed for the DNS challenge. I used my actual email address and Global API Key from your Cloudflare account.
export CF_Key="your_cloudflare_global_api_key"
export CF_Email="your_cloudflare_email_address"
Change directory to the following:
cd /shared/letsencrypt
Run acme.sh with the --issue command, specifying that you want to use the dns_cf (DNS Cloudflare) mode for handling DNS challenges. Replace yourdomain.com with the domain for which you want the certificate.
./acme.sh --issue --dns dns_cf -d yourdomain.com -d *.yourdomain.com
After succesful cert creation the script will display what directory it was copied to. In my case it was:
Your cert is in: /root/.acme.sh/sprawy.info.pl_ecc/sprawy.info.pl.cer
Your cert key is in: /root/.acme.sh/sprawy.info.pl_ecc/sprawy.info.pl.key
The intermediate CA cert is in: /root/.acme.sh/sprawy.info.pl_ecc/ca.cer
And the full chain certs is there: /root/.acme.sh/sprawy.info.pl_ecc/fullchain.cer
Edit the discourse.conf file to update the path to the cert:
nano /etc/nginx/conf.d/discourse.conf
The existing ssl_certificate and ssl_certificate_key lines should be replaced with:
ssl_certificate /root/.acme.sh/sprawy.info.pl_ecc/sprawy.info.pl.cer;
ssl_certificate_key /root/.acme.sh/sprawy.info.pl_ecc/sprawy.info.pl.key;
So that it now is pointing to the new cert locations.
Run this to test the configuration:
nginx -t
If no errors-- reload the web server:
nginx -s reload
And-- voila!
