ubuntu web2py

337 views
Skip to first unread message

xmarx

unread,
Feb 5, 2016, 12:33:57 PM2/5/16
to web2py-users
i install on ubuntu web2py, nginx and uwsgi.

when i run web2py (sudo python web2py.py) admin says Running on Rocket 1.2.6, Python 2.7.10. 

where did i mistake? it must run on nginx, am i right?

thanks.

Jim S

unread,
Feb 5, 2016, 12:52:16 PM2/5/16
to web2py-users

Jim S

unread,
Feb 5, 2016, 12:54:39 PM2/5/16
to web2py-users
Actually, this is the link you want:


Also, notice that there are automatic install scripts at the end of this section for ubuntu and nginx.

Assuming you're in production, you don't 'have' to run under nginx, it is just recommended.  

Once this is setup, web2py will be running through nginx and uwsgi, no need to 'start' it with the web2py.py pgm.

If you read through the docs it is explained pretty well.

-Jim

xmarx

unread,
Feb 5, 2016, 2:28:10 PM2/5/16
to web2py-users
i read the deployment recipes page and nginx section again and again. i don`t see about `after install`

i try install this script http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh after your message. when installing done. i type localhost on my browser. then i get web2py welcome page. but when i install nginx\ localhost is nginx`s welcome page.

thanks.

5 Şubat 2016 Cuma 17:54:39 UTC tarihinde Jim S yazdı:

Jim S

unread,
Feb 5, 2016, 2:56:00 PM2/5/16
to web2py-users
Did you install nginx after running the script?  nginx is automatically installed by the script, you don't have to do it manually.

If you didn't do that (I could be reading your message wrong), can you post the following files?

/home/www-data/web2py/routes.py
/etc/nginx/sites-available/web2py

They will tell us a bit about how it is behaving.

-Jim

xmarx

unread,
Feb 5, 2016, 4:18:06 PM2/5/16
to web2py-users
ubuntu 15.10 is running on vm VirtualBox.
i exec the script and didn't install anything. nginx is installed by the script and running.
http://localhost/ and https://localhost/ raise 502 Bad Gateway page.

there isn't a routes.py file in /home/www-data/web2py/
web2py file is attached in /etc/nginx/sites-available/

my script is: https://raw.githubusercontent.com/web2py/web2py/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh

thanks for your help Jim.



5 Şubat 2016 Cuma 21:56:00 UTC+2 tarihinde Jim S yazdı:
web2py

Jim Steil

unread,
Feb 5, 2016, 5:34:54 PM2/5/16
to web...@googlegroups.com
Do you know if uwsgi is running:

Try this from the command line...

ps -ewwf | grep uwsgi

results should look something like this:

Inline image 1

-Jim



--
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/ZM9IIEjtHSI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jim S

unread,
Feb 5, 2016, 5:46:28 PM2/5/16
to web2py-users
Also, what happens when you run:

sudo restart uwsgi-emperor

You should get something like this:

uwsgi-emperor start/running, process 2749

-Jim
To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.

xmarx

unread,
Feb 6, 2016, 11:20:31 AM2/6/16
to web2py-users

selman@selman-VirtualBox:~$ ps -ewwf | grep uwsgi
selman    
1878  1848  0 18:15 pts/2    00:00:00 grep --color=auto uwsgi
selman@selman
-VirtualBox:~$ sudo restart uwsgi-emperor
[sudo] password for selman:
restart
: Upstart'a bağlanılamıyor: Failed to connect to socket /com/ubuntu/upstart: Bağlantı reddedildi


english: could't connect upstart. Failed to connect to socket /com/ubuntu/upstart: connection denied.





6 Şubat 2016 Cumartesi 00:46:28 UTC+2 tarihinde Jim S yazdı:
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.

Jim S

unread,
Feb 8, 2016, 11:02:33 AM2/8/16
to web2py-users
I played with this a bit over the weekend but was unable to get it working on Ubuntu 15.x.

My production servers all run 14.4.

I think the problem is the change from upstart to systemd on Ubuntu.  Does anyone have experience getting uwsgi to start using systemd?  I don't know enough about these systems to get it all right.  I think it involves have a uwsgi.service file defined so that systemd will start it up, but I don't know for sure how to get that all working.

-Jim

Niphlod

unread,
Feb 8, 2016, 11:06:36 AM2/8/16
to web2py-users

Jim S

unread,
Feb 8, 2016, 3:25:31 PM2/8/16
to web2py-users
You're right, shouldn't be hard.  But, for me it is.

I'll post back if I can get it working...

-Jim

Niphlod

unread,
Feb 8, 2016, 3:44:16 PM2/8/16
to web2py-users

Jim S

unread,
Feb 10, 2016, 8:46:37 AM2/10/16
to web2py-users
I got this working!

Here is what I did.

1. Run the normal web2py installation script for nginx/ubuntu
2. sudo nano edit /etc/systemd/system/emperor.uwsgi.service

Add these lines
[Unit]
Description = uWSGI Emperor
After = syslog.target


[Service]
ExecStart = /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
RuntimeDirectory = uwsgi
Restart = always
KillSignal = SIGQUIT
Type = notify
StandardError = syslog
NotifyAccess = all


[Install]
WantedBy = multi-user.target

3. Exit and save the file
4. systemctl enable emperor.uwsgi.service
5. systemctl start emperor.uwsgi.service

You should now be able to browse to http://localhost or https://localhost

On restart of the system, this service will automatically start.

Let me know if you have questions.

-Jim

Thanks niphlod for the pointers and encouragement...

Mirek Zvolský

unread,
Feb 11, 2016, 12:45:46 PM2/11/16
to web2py-users
I am trying do the same on Debian 8 Jessie and have a question:
From where do you have /etc/uwsgi/web2py.ini
I have no such file. From that reason your point (5) will fail for me.




Dne středa 10. února 2016 14:46:37 UTC+1 Jim S napsal(a):

Mirek Zvolský

unread,
Feb 11, 2016, 12:59:19 PM2/11/16
to web2py-users
I have found the content for web2py.ini in web2py repository:

...and it works - great !
Debian 8 Jessie, Forpsi virtual server 1G RAM (1 EUR/month, however maybe for IT,DE,UK,CZ customers only)




Dne čtvrtek 11. února 2016 18:45:46 UTC+1 Mirek Zvolský napsal(a):

Jim Steil

unread,
Feb 11, 2016, 2:12:19 PM2/11/16
to web...@googlegroups.com
It gets created in the web2py/nginx/ubuntu install script.

-Jim

--

Mirek Zvolský

unread,
Feb 12, 2016, 3:11:26 AM2/12/16
to web2py-users
Yes. Thanks.

But I have used the script from current stable version 2.13.4-stable+timestamp.2015.12.26.04.59.39 and that is bad idea.
With up-to-date script from web2py respository it probably completly works without problems.
But if you use the older version of setup-web2py-nginx-uwsgi-ubuntu.sh then you can repair it so, that you find content for /etc/uwsgi/web2py.ini in same up-to-date script in web2py repository and manually create the .ini file.

And I should say, I have added your code listed here above for /etc/systemd/system/emperor.uwsgi.service
I am not sure if this is already in the latest version of script or not (just run the script and then see...)

After that you can control both
service nginx status/start/stop
service emperor.uwsgi status/start/stop
and all works well.
At least at Debian 8 Jessie.

Note: the description in web2py.com/book is however to old and cannot be used for systemd.





Dne čtvrtek 11. února 2016 20:12:19 UTC+1 Jim S napsal(a):

Jim S

unread,
Feb 12, 2016, 9:25:52 AM2/12/16
to web2py-users
I'm confused by which script you're running for installation.  When I install web2py on ubuntu I go through the following steps.

1.  Install Ubuntu
2.  sudo apt-get install git
3.  in my home directory ->  git clone https://github.com/web2py/web2py.git
4.  cd web2py/scripts
5.  sudo chmod +x setup-web2py-nginx-uwsgi-ubuntu.sh
6.  ./setup-web2py-nginx-uwsgi-ubuntu.sh
7.  create the emperor.uwsgi.service file (from earlier in this thread) in /etc/systemd/system

There is probably a more precise way of doing it, but this is what I've been using.

-Jim

Mirek Zvolský

unread,
Feb 12, 2016, 11:45:28 AM2/12/16
to web2py-users
Yes! Exactly.
You use web2py script from web2py repository (2016, Feb) - this is good idea.
I have used web2py script from web2py stable (2015, Dec) - this is bad idea (missing ini file).





Dne pátek 12. února 2016 15:25:52 UTC+1 Jim S napsal(a):

Jim Steil

unread,
Feb 12, 2016, 11:48:14 AM2/12/16
to web...@googlegroups.com
Thanks for the clarification!

I'm looking at the script and working on a mod that will install the systemd init script as well.  I'm not real good with shell scripting but will try to get it done.

-Jim

Mirek Zvolský

unread,
Feb 18, 2016, 5:28:04 AM2/18/16
to web...@googlegroups.com
Hi Jim,
At github.com/zvolsky/web2py I have a new script which probably works:

Should I generate push request?
If you will do it, then you can take a look to my changes:

sudo mkdir /etc/systemd
sudo mkdir /etc/systemd/system
new content for /etc/systemd/system/emperor.uwsgi.service
systemctl enable emperor.uwsgi.service
systemctl start emperor.uwsgi.service
   (both last replace start.... before nginx restart)

+ I have had another problem, see next message

Mirek Zvolský

unread,
Feb 18, 2016, 5:34:56 AM2/18/16
to web2py-users
Another problem with nginx/uwsgi script (ubuntu/debian):

On my virtual server (forpsi) I have just one user, root,
and 'sudo' was not installed.

So commands like 'sudo mkdir ...' has failed and many files were not created.

So check 'sudo' first if running as root user.

apt install sudo-ldap
or
apt install sudo
will help.




Dne pátek 5. února 2016 18:33:57 UTC+1 xmarx napsal(a):

xmarx

unread,
Feb 20, 2016, 3:20:36 PM2/20/16
to web2py-users
thank you. it works.

10 Şubat 2016 Çarşamba 15:46:37 UTC+2 tarihinde Jim S yazdı:
Reply all
Reply to author
Forward
0 new messages