running Cherrypy web service without using Sudo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

running Cherrypy web service without using Sudo

Hvit Draken
Hi All,

Hoping someone might be able to give advise.

Running a webservice using Cherrypy. When using with sudo I am able to get a valid response that I expect.

aka sudo ./engine.py

2017-06-20 12:12:04,214536 INFO   Got successful response [200], continuing
[20/Jun/2017:12:12:04] ENGINE Listening for SIGTERM.
[20/Jun/2017:12:12:04] ENGINE Listening for SIGHUP.
[20/Jun/2017:12:12:04] ENGINE Listening for SIGUSR1.
[20/Jun/2017:12:12:04] ENGINE Bus STARTING

but running withouth sudo I get:

2017-06-20 12:12:56,197863 INFO   Got unsuccessful response [403], will try again in 20 seconds

My first thought was it is due to using a privileged port so I used:
sudo setcap CAP_NET_BIND_SERVICE=+eip  /engine.py
which did not resolve the issue.

I also changed the port to port 8080

but the service still won't run successfully without using sudo.

Has anyone come across this before and know how to fix it.

Best

H




--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: running Cherrypy web service without using Sudo

Stephan Semerad
not sure if this helps, but im my Ubuntu Server I run it as following:

python app.py &


On Tuesday, June 20, 2017 at 1:23:32 PM UTC+2, Hvit Draken wrote:
Hi All,

Hoping someone might be able to give advise.

Running a webservice using Cherrypy. When using with sudo I am able to get a valid response that I expect.

aka sudo ./engine.py

2017-06-20 12:12:04,214536 INFO   Got successful response [200], continuing
[20/Jun/2017:12:12:04] ENGINE Listening for SIGTERM.
[20/Jun/2017:12:12:04] ENGINE Listening for SIGHUP.
[20/Jun/2017:12:12:04] ENGINE Listening for SIGUSR1.
[20/Jun/2017:12:12:04] ENGINE Bus STARTING

but running withouth sudo I get:

2017-06-20 12:12:56,197863 INFO   Got unsuccessful response [403], will try again in 20 seconds

My first thought was it is due to using a privileged port so I used:
sudo setcap CAP_NET_BIND_SERVICE=+eip  /engine.py
which did not resolve the issue.

I also changed the port to port 8080

but the service still won't run successfully without using sudo.

Has anyone come across this before and know how to fix it.

Best

H




--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: running Cherrypy web service without using Sudo

Michiel Overtoom

> On 2017-06-23, at 14:50, Stephan Semerad <[hidden email]> wrote:
>
> not sure if this helps, but im my Ubuntu Server I run it as following:
>
> python app.py &

But what happens if you log out, or your connection to the server is lost?

Greetings,

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: running Cherrypy web service without using Sudo

DJW-2
Michiel

If this for a production/live service, you really should hand responsibility off to something like nginx+uwsgi.   The hook for uwsgi is shown here http://docs.cherrypy.org/en/latest/deploy.html#uwsgi and there are much better sources for setting up nginx + uwsgi on their own if you google for them.

 
But what happens if you log out, or your connection to the server is lost?

Greetings, 

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: running Cherrypy web service without using Sudo

Michiel Overtoom
Hi,

> On 2017-06-25, at 06:36, DJW <[hidden email]> wrote:
>
> If this for a production/live service, you really should hand responsibility off to something like nginx+uwsgi.

That is good advice.

I myself use nginx in front of my webapps. I then let supervisord control the starting/stopping of the webapp, which is built using cherrypy. I also let nginx handle the SSL and the static files.


>> But what happens if you log out, or your connection to the server is lost?

This was a bit of a retorical question. Running the webapp from the commandline is indeed a bad idea, because the app stops funcioning if the above happens. You could run it in a tmux (or screen) to prevent that, but then you don't have the added benefits of nginx.

Greetings,

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: running Cherrypy web service without using Sudo

DJW-2
This was a bit of a retorical question. 

My apologies, a bit slow today and just caught on to that.


--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Loading...