web2py scripts setup nginx uwsgi tested on docker

133 views
Skip to first unread message

黄祥

unread,
Dec 7, 2018, 8:22:21 PM12/7/18
to web2py-users
tested all web2py scripts setup nginx uwsgi on docker, result none of it's worked (for ubuntu discussed on another thread)

opensuse
docker pull opensuse
docker run
-it opensuse /bin/bash

zypper
in -y unzip wget sudo
mkdir
/srv
cd
/srv
wget
-c http://web2py.com/examples/static/web2py_src.zip
unzip
-o web2py_src.zip
chmod
+x web2py/scripts/setup-web2py-nginx-uwsgi-opensuse.sh
web2py
/scripts/setup-web2py-nginx-uwsgi-opensuse.sh

result
/usr/bin/uwsgi not installed
web2py
/scripts/setup-web2py-nginx-uwsgi-opensuse.sh: line 215: /etc/init.d/nginx: No such fileor directory

Note: This output shows SysV services only and does not include native
systemd services
. SysV configuration data might be overridden by native
systemd configuration
.

If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.

uwsgi                    
0:off  1:off  2:off  3:on   4:off  5:on   6:off
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.

centos (setup-web2py-nginx-uwsgi-centos7.sh)
docker pull centos
docker run
-it centos /bin/bash

yum install
-y unzip wget sudo firewalld
mkdir
/srv
cd
/srv
wget
-c http://web2py.com/examples/static/web2py_src.zip
unzip
-o web2py_src.zip
chmod
+x web2py/scripts/setup-web2py-nginx-uwsgi-centos7.sh
web2py
/scripts/setup-web2py-nginx-uwsgi-centos7.sh

result
mv: cannot stat '/opt/web2py_apps/web2py.crt*': No such file or directory
mv
: cannot stat '/opt/web2py_apps/web2py.key*': No such file or directory
Failed to get D-Bus connection: Operation not permitted
Failed to get D-Bus connection: Operation not permitted
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service, pointing to /usr/lib/systemd/system/nginx.service.
Created symlink /etc/systemd/system/multi-user.target.wants/uwsgi.service, pointing to /etc/systemd/system/uwsgi.service.
Error: DBUS_ERROR: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
Error: DBUS_ERROR: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
Error: DBUS_ERROR: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
Error: DBUS_ERROR: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory

Web2py is now installed on this server!

result on browser
Failed to complete tunnel connection
The connection to http://172164a3.ngrok.io was successfully tunneled to your ngrok client, but the client failed to establish a connection to the local address localhost:80.

Make sure that a web service is running on localhost:80 and that it is a valid address.

The error encountered was: dial tcp 127.0.0.1:80: getsockopt: connection refused

centos (setup-web2py-nginx-uwsgi-centos64.sh)
docker pull centos
docker run
-it centos /bin/bash

yum install
-y unzip wget sudo iptables
mkdir
/srv
cd
/srv
wget
-c http://web2py.com/examples/static/web2py_src.zip
unzip
-o web2py_src.zip
chmod
+x web2py/scripts/setup-web2py-nginx-uwsgi-centos64.sh
web2py
/scripts/setup-web2py-nginx-uwsgi-centos64.sh

result
chown: invalid user: 'nginx:nginx'
sudo
: unknown user: nginx
sudo
: unable to initialize policy plugin
/etc/init.d/uwsgi: line 16: /etc/rc.d/init.d/functions: No such file or directory
web2py
/scripts/setup-web2py-nginx-uwsgi-centos64.sh: line 204: /etc/init.d/nginx: No such fileor directory
web2py
/scripts/setup-web2py-nginx-uwsgi-centos64.sh: line 206: /etc/init.d/iptables: No such file or directory
error reading information on service iptables
: No such file or directory
error reading information on service nginx
: No such file or directory

centos (setup-web2py-nginx-uwsgi-on-centos.sh)
docker pull centos
docker run
-it centos /bin/bash

yum install
-y unzip wget sudo  
mkdir
/srv
cd
/srv
wget
-c http://web2py.com/examples/static/web2py_src.zip
unzip
-o web2py_src.zip
chmod
+x web2py/scripts/setup-web2py-nginx-uwsgi-on-centos.sh
web2py
/scripts/setup-web2py-nginx-uwsgi-on-centos.sh

result
Error: Package: nginx-1.10.3-1.el5.ngx.x86_64 (nginx)
           
Requires: libpcre.so.0()(64bit)
 
You could try using --skip-broken to work around the problem
 
You could try running: rpm -Va --nofiles --nodigest
We don't want the defaults, so remove them
web2py/scripts/setup-web2py-nginx-uwsgi-on-centos.sh: line 145: cd: /etc/nginx/conf.d: No suchfile or directory
mv: cannot stat '
default.conf': No such file or directory
mv: cannot stat '
example_ssl.conf': No such file or directory

The following configuration files are also needed
The options for uwsgi are in the following file.
Other options could be included.

uwsgi_for_nginx.conf

The next configuration file is for nginx, and goes in /etc/nginx/conf.d
It serves the static directory of applications directly. I have not set up
ssl because I access web2py admin by using ssh tunneling and the web2py rocket server.
It should be straightforward to set up the ssl server however.

web2py.conf
web2py/scripts/setup-web2py-nginx-uwsgi-on-centos.sh: line 210: /etc/nginx/conf.d/web2py.conf:No such file or directory
Auto-signed ssl certs
mkdir: cannot create directory '
/etc/nginx/ssl': No such file or directory
creating a self signed certificate
==================================
web2py/scripts/setup-web2py-nginx-uwsgi-on-centos.sh: line 217: /etc/nginx/ssl/web2py.key: No such file or directory
chmod: cannot access '
/etc/nginx/ssl/web2py.key': No such file or directory
web2py/scripts/setup-web2py-nginx-uwsgi-on-centos.sh: line 219: /etc/nginx/ssl/web2py.cert: Nosuch file or directory
web2py/scripts/setup-web2py-nginx-uwsgi-on-centos.sh: line 220: /etc/nginx/ssl/web2py.cert: Nosuch file or directory
uwsgi as service

You can test it with

service uwsgi start

and stop it similarly.

Nginx has automatically been set up as a service
if you want to start it run

service nginx start

You should find the web2py welcome app will be displayed at your web address.
As they are both services, they should automatically start on a system reboot.
If you already had a server running, such as apache, you would need to stop
that and turn its service off before running nginx.

Turning off apache service
web2py/scripts/setup-web2py-nginx-uwsgi-on-centos.sh: line 344: service: command not found
error reading information on service httpd: No such file or directory

Installation complete. You might want to restart your server running

reboot

as superuser

best regards,
stifan
Reply all
Reply to author
Forward
0 new messages