Fixes for uWSGI + ngnix install script in Ubuntu 20.04.01 LTS?

204 показвания
Преминаване към първото непрочетено съобщение

david...@gmail.com

непрочетено,
18.12.2020 г., 6:12:4018.12.20 г.
до web2py-users
Hi there,

I'm trying to set up Web2Py in Ubuntu 20.04.01 LTS using the scripts:

https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh

It doesn't work. I've been going through it some details and have almost got it working but wanted to (a) check I'm not being an idiot (b) ask about a couple of unresolved issues and (c) does this merit a pull request?

# Problem 1:

https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh#L31-34

Python 2 is no longer shipped in 20.04 and --no-build-wheel is deprecated. Rather than install it, it makes sense to me to switch this section and use the installed Python 3.8. I understand that this makes the script Python 3 specific, but that seems a sane thing to offer as a script with Ubuntu 20.04

```
apt-get -y install build-essential python3-dev libxml2-dev python-pip3 unzippip3 install setuptools --no-binary :all: --upgrade
PIPPATH=`which pip3`
$PIPPATH install --upgrade uwsgi
```

# Problem 2:

https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh#L133-136

OpenSSL no longer accepts 1024 bit keys, so this needs to be altered. I think these two lines do the same job with a 2048 bit key.

```
openssl req -x509 -nodes -sha256 -days 365 -newkey rsa:2048 -keyout web2py.key -out web2py.crt
openssl x509 -noout -text -in web2py.crt -out web2py.info
```

# Problem 3:

https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh#L185

I'm really out on a limb here, but I don't think this is creating the services correctly on 20.04, which I think is to do with the removal of Upstart (?). If I _manually_ start uwsgi from the command line on my server, then I can access the web2py Welcome page:

```
sudo uwsgi --master --die-on-term --emperor /etc/uwsgi --logto /var/log/uwsgi/uwsgi.log
```

The script does create a uwsgi service:

https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh#L144

This doesn't seem to work as expected and I think this is because the ExecStart statement isn't correct. If I substitute the ExecStart command with the one in the upstart config at line 201 and restart the services, then it works. I suspect that makes lines 185 to 202 redundant?

And I think that is it - I get an instance running on Ubuntu 20.04 with:

2.21.1-stable+timestamp.2020.11.28.04.10.44
(Running on nginx/1.18.0, Python 3.8.5)

Thoughts / Comments / Have you never read about this massive security hole you've just opened up?

david...@gmail.com

непрочетено,
18.12.2020 г., 6:14:4118.12.20 г.
до web2py-users
Just to add: I fixed the unresolved issues as I typed the email and then forgot to change the opening paragraph, so ignore part (b). Part (a) and part (c) from the first paragraph still apply.

Tim Nyborg

непрочетено,
7.01.2021 г., 5:28:147.01.21 г.
до web2py-users
Agree that the changes merit a pull request, and the script should now be py3-specific, since we're past py2 EOL.

Re. problem 3, I think the script once handled ubuntu/debian versions with initd OR systemd, and that the init config is long obsolete and should be removed.  It was useful having both back when some of us were on Debian 7 or other versions without systemd, but that's no longer the case.

And yes, the Execstart in the uwsgi service should match the options in the upstart config.  On my Debian servers, I have `ExecStart = /usr/local/bin/uwsgi --emperor /etc/uwsgi/apps-enabled --logto /var/log/uwsgi/uwsgi.log`, and it works just fine.

david...@gmail.com

непрочетено,
7.01.2021 г., 5:33:397.01.21 г.
до web2py-users
OK - thanks for the feedback. I've read around on similar comments and I completely get that there is a groundswell against making web2py code require python 3 (essentially other frameworks should be used instead), but this would just be removing a barrier to getting it working with python 3 on Ubuntu 20.04 without requiring python 2 to run the setup script. I'll submit it.  

Tim Nyborg

непрочетено,
7.01.2021 г., 9:05:007.01.21 г.
до web...@googlegroups.com

Agreed that the web2py itself shouldn’t require python 3, but python 2 is no longer the default for Ubuntu, and a public configuration recipe should reflect that.    A user who really needs 2.7 for their projects will be able to adapt it without much effort.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/Kp2kTz-X_Lo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/7f0aabf3-03f5-4730-9a37-fadbacc0fc6dn%40googlegroups.com.

Отговор до всички
Отговор до автора
Препращане
0 нови съобщения