Error on installing letsencrypt

Hello guys, i am having trouble installing lets encrypt on my server.
it is VPS with Ubuntu 20, ERPNext with Bench Manager all installed and perfectly working, i have multiple sites the default one is erpnext.techmark.cloud rest of sites are are routed in deferent ports.
when i run sudo -H bench setup lets-encrypt erpnext.techmark.cloud i get this error msg.

erpnext@vmi477494:/opt/bench/erpnext$ sudo -H bench setup lets-encrypt erpnext.techmark.cloud
[sudo] password for erpnext:
Running this will stop the nginx service temporarily causing your sites to go offline
Do you want to continue? [y/N]: y
$ sudo systemctl stop nginx
$ /opt/certbot-auto --config /etc/letsencrypt/configs/erpnext.techmark.cloud.cfg certonly
Skipping bootstrap because certbot-auto is deprecated on this system.
WARNING: couldn’t find Python 2.7+ to check for updates.
Your system is not supported by certbot-auto anymore.
Certbot cannot be installed.
Please visit https://certbot.eff.org/ to check for other alternatives.
nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
$ sudo systemctl start nginx
Job for nginx.service failed because the control process exited with error code.
See “systemctl status nginx.service” and “journalctl -xe” for details.

i worked alot and found the error with missing the certificate files. means they are not generated except all other commands implemented but ssl_certificate /etc/letsencrypt/live/erpnext.techmark.cloud/fullchain.pem; and ssl_certificate_key /etc/letsencrypt/live/erpnext.techmark.cloud/privkey.pem; files are missing in general the whole /etc/letsencrypt/live folder is missing and there is no folder with such a name even i searched the certificate files and nothing is found. now my sites are not opening and i need to get back even if possible i am willing to undo the letsencrypt installation but i did not found anyway to do that. can someone help me out here.

Not sure about the error, but this may help to get your sites working again:

  • Check your site_config.json resp. common_site_config.json and delete everything regarding the ssl certificate
  • bench setup nginx
  • sudo service nginx restart

can you please tell me where it is located ?

frappe-bench/sites/common_site_config.json or
frappe-bench/sites/{{ site_name }}/site_config.json

More information: Using Let's Encrypt to setup HTTPS

erpnext@vmi477494:/opt/bench/erpnext$ bench setup nginx
WARN: bench is installed in editable mode!

This is not the recommended mode of installation for production. Instead, install the package from PyPI with: pip install frappe-bench

nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y

WARNING: The site config for the site erpnext.techmark.cloud is broken. If you want this command to fail, instead of just showing a warning, You may add the ‘strict_nginx’ flag to common_site_config.json and set it to 1

WARNING: The site config for the site erpnext.mediamark.biz is broken. If you want this command to fail, instead of just showing a warning, You may add the ‘strict_nginx’ flag to common_site_config.json and set it to 1

thanks found the files, did the deleting and did not worked.
Yes i exactly followed installation of lets encrypt according to the link you sent this was were the problem appeared at first.

Well, it seems something went wrong when you’ve deleted the lines.

inside your bench folder

nano ~/.bench/bench/config/ lets_encrypt.py

change

def get_certbot_path():
return “/opt/certbot-auto”

into

def get_certbot_path():
# switch to snap certbot - begin

# return "/opt/certbot-auto"

return "/snap/bin/certbot"

# switch to snap certbot - end

sudo apt install snapd

sudo snap install --classic certbot

sudo bench setup lets-encrypt yourSiteName

5 Likes

That’s one option! What do you think of this?

Please let me know which of these two methods is more robust.

Thanks

Jay

1 Like