Let's Encrypt setup issues on CentOS7

Hello Everyone,

I have a problem when trying to install Let’s Encryption by using bench.
I got this error when I ran command “sudo bench setup lets-encrypt erp.mysite.com

Here is an errors

Running this will stop the nginx service temporarily causing your sites to go offline
Do you want to continue? [y/N]: y
INFO:bench.utils:sudo systemctl stop nginx
INFO:bench.utils:/opt/certbot-auto --config /etc/letsencrypt/configs/erp.mysite.com.cfg certonly
Bootstrapping dependencies for RedHat-based OSes… (you can skip this with --no-bootstrap)
yum is /bin/yum
yum is hashed (/bin/yum)
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package gcc-4.8.5-28.el7_5.1.x86_64 already installed and latest version
Package augeas-libs-1.4.0-5.el7_5.1.x86_64 already installed and latest version
Package 1:openssl-1.0.2k-12.el7.x86_64 already installed and latest version
Package 1:openssl-devel-1.0.2k-12.el7.x86_64 already installed and latest version
Package libffi-devel-3.0.13-18.el7.x86_64 already installed and latest version
Package redhat-rpm-config-9.1.0-80.el7.centos.noarch already installed and latest version
Package ca-certificates-2018.2.22-70.0.el7_5.noarch already installed and latest version
Package python-devel-2.7.5-69.el7_5.x86_64 already installed and latest version
Package python-virtualenv-15.1.0-2.el7.noarch already installed and latest version
Package python-tools-2.7.5-69.el7_5.x86_64 already installed and latest version
Package python2-pip-8.1.2-6.el7.noarch already installed and latest version
Nothing to do
Creating virtual environment…
Traceback (most recent call last):
File “/usr/lib/python2.7/site-packages/virtualenv.py”, line 2327, in
main()
File “/usr/lib/python2.7/site-packages/virtualenv.py”, line 712, in main
symlink=options.symlink)
File “/usr/lib/python2.7/site-packages/virtualenv.py”, line 944, in create_environment
download=download,
File “/usr/lib/python2.7/site-packages/virtualenv.py”, line 900, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File “/usr/lib/python2.7/site-packages/virtualenv.py”, line 796, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /opt/eff.org/certbot/venv/bin/python2.7 - setuptools pip wheel failed with error code 1
INFO:bench.utils:sudo systemctl start nginx
There was a problem trying to setup SSL for your site

I try to remove “/etc/letsencrypt/configs/*.cfg” before run above command, it’s still not work.

As I check it’s same error here : Lets-encrypt-no-longer-works-from-bench-setup from centos 7 - #3 by captainhook

Please help! Thank you.

Could you try from within home/frappe/frappe-bench/
sudo pip install --upgrade setuptools
sudo pip install --upgrade virtualenv
sudo pip install --upgrade pip
sudo service nginx restart
sudo supervisorctl restart all
sudo bench setup lets-encrypt erp.your-url-here.com

If it fails again check Wheel settings.
HTH

Hey could you tell me how I can check the wheel settings?

I too have these problems setting up letsencrypt.

Here is my output:

Lets ENcrypt Error

[root@MyERP frappe-bench]# sudo bench setup lets-encrypt erp.mydomain.com
Running this will stop the nginx service temporarily causing your sites to go offline
Do you want to continue? [y/N]: y
INFO:bench.utils:sudo systemctl stop nginx
INFO:bench.utils:/opt/certbot-auto --config /etc/letsencrypt/configs/erp.mydomain.com.cfg certonly
Bootstrapping dependencies for RedHat-based OSes… (you can skip this with --no-bootstrap)
yum is /bin/yum
yum is hashed (/bin/yum)
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • base: ftp.plusline.net
  • epel: d2lzkl7pfhq30w.cloudfront.net
  • extras: ftp.plusline.net
  • ius: mirrors.ircam.fr
  • updates: mirror.imt-systems.com
    Package gcc-4.8.5-28.el7_5.1.x86_64 already installed and latest version
    Package augeas-libs-1.4.0-5.el7_5.1.x86_64 already installed and latest version
    Package 1:openssl-1.0.2k-12.el7.x86_64 already installed and latest version
    Package 1:openssl-devel-1.0.2k-12.el7.x86_64 already installed and latest version
    Package libffi-devel-3.0.13-18.el7.x86_64 already installed and latest version
    Package redhat-rpm-config-9.1.0-80.el7.centos.noarch already installed and latest version
    Package ca-certificates-2018.2.22-70.0.el7_5.noarch already installed and latest version
    Package python-devel-2.7.5-69.el7_5.x86_64 already installed and latest version
    Package python-virtualenv-15.1.0-2.el7.noarch already installed and latest version
    Package python-tools-2.7.5-69.el7_5.x86_64 already installed and latest version
    Package python2-pip-8.1.2-6.el7.noarch already installed and latest version
    Nothing to do
    Creating virtual environment…
    Traceback (most recent call last):
    File “/usr/lib/python2.7/site-packages/virtualenv.py”, line 2327, in
    main()
    File “/usr/lib/python2.7/site-packages/virtualenv.py”, line 712, in main
    symlink=options.symlink)
    File “/usr/lib/python2.7/site-packages/virtualenv.py”, line 944, in create_environment
    download=download,
    File “/usr/lib/python2.7/site-packages/virtualenv.py”, line 900, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
    File “/usr/lib/python2.7/site-packages/virtualenv.py”, line 796, in call_subprocess
    % (cmd_desc, proc.returncode))
    OSError: Command /opt/eff.org/certbot/venv/bin/python2.7 - setuptools pip wheel failed with error code 1
    INFO:bench.utils:sudo systemctl start nginx
    There was a problem trying to setup SSL for your site

Normally you would not do this from root. On initial server setup your would create a new user (in this case frappe) and then do all ERPNext/Frappe install & operation from the frappe user account. Read this tut for more info.

You should always disable root login.
Once user frappe has been added to wheel and you have logged into server as frappe you shouldn’t receive this issue.
You are also running an old version of pip. Install the latest version with:

# sudo curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
# sudo python2.7 get-pip.py
# pip -V

I’ve done all the steps.

Disabled root, added frappe user to wheel.
Currently I upgraded to V11.

I havent done the upgrade of pip so far - why is there not the newest build in the setup process?
Do I have to upgrade pip now? Everything is working fine now except ssl and I dont want to start from scratch now - that’s why I want to make sure that this is the next step.

Thanks

Did you solve this issue?

Just checking that:
Your registrars zone file has an A record added to it erp.mydomain.com pointing to your Digital ocean droplet IP.
Digital Ocean droplet settings are all erp.mydomain.com
Your erpnext site is called erp.mydomain.com
From within your droplet /frappe-bench/ folder you call
sudo -H bench setup lets-encrypt erp.mydomain.com

I’m sorry I didn’t. But I haven’t tried this pip upgrade thing as I’m confused I upgraded both bench. Updated erpnext to v11.

Should I do it?

Updating pip shouldn’t harm anything. Before you do this can you post the results you get from:

python2.7 -V
and
nvm --version
and
npm -v
and
node -v

I haven’t used the frappe installer in a long while so npm or nvm might not show up as installed depending on how it is currently configured.
Im not sure why but even sudo yum update/grade doesn’t fully update some python/node modules.

Sorry for not replying so long!

Here is the output:

HEY! USE SCREEN -bash-4.2$ python2.7 -V
Python 2.7.5
HEY! USE SCREEN -bash-4.2$ nvm --version
-bash: nvm: command not found
HEY! USE SCREEN -bash-4.2$ npm -v
6.4.1
HEY! USE SCREEN -bash-4.2$ node -v
v8.13.0
HEY! USE SCREEN -bash-4.2$

I answered this issue in another post on this forum about a year ago

This is an annoying bash setting…
The short answer is:
$ sudo nano /etc/profile.d/bashrc.sh
Add the line below
export PS1="\u@\h:\w$:”
save / exit file
$ exit
close terminal window and ssh in again and all should look good.

Also install nvm

It seems be issue with nginx only.

Let’s find the root cause of the issue.
Can you execute the sudo systemctl start nginx and systemctl status application.service?
If there’re error then post the error traceback so that someone can assist you to fix error.

Thanks for helping me with this, I installed now nvm and edited the file according to your suggestion - tought this would prevent the “Hey! USE SCREEN” Message but even if I change a typo? "\u@\h:\w$: to " this seems not to work.

Anyway here is the latest output:

HEY! USE SCREEN -bash-4.2$ sudo systemctl start nginx
HEY! USE SCREEN -bash-4.2$ systemctl status application.service
Unit application.service could not be found.
HEY! USE SCREEN -bash-4.2$

It was issue with your virtual environment.

2 Likes

Hello @ptec5000,
I facing the same problem here, are you found a solution for it plz?

Can you advise another solution plz? @navdeepghai

I have removed the env folder from frappe-bench and re created it using virtualenv command.

Follow these commands for fix it:

Step 1: Go to frappe-bench dir (using cd ~/frappe-bench) command.

Step 2: remove the env folder using( rm -rf ./env) command.
Step 3: Re-create it using (virtualenv env) command.
Step 4: Install the bench using(./env/bin/pip install ./)
Step 5: install the frappe app using (./env/bin/pip install -e ./apps/frappe --no-cache-dir)command.
Step 6: install the erpnext app using (./env/bin/pip install -e ./apps/erpnext --no-cache-dir) command.
Step 7: activate the env using (source ./env/bin/activate) command.
Step 8: install requirements using( bench setup requirements) command.

Now execute the sudo ./env/bin/bench setup lets-encrypt command to setup lets encrypt.

Prerequisites:
nginx

for more information use this link:

3 Likes

It’s working now.

Thank you!