librelist archives

« back to archive

Deploying on Windows

Deploying on Windows

From:
Kieran Darcy
Date:
2010-09-29 @ 13:28
  For various reasons (available infrastructure, a legacy database 
etc.), deploying a Flask application on Windows is our best option. 
We're running multiple sites/ domains on IIS7.

With a Linux-based solution our 2nd best option, we've been looking at 
alternatives: We tried PyISAPIe WSGI server, but ran into issues with 
the PostgreSQL driver (pyscopg2) and spawning processes within the 
application; we tried isapi-wsgi, but never really got off the ground; 
Apache on Windows has been problematic for us in the past, ruling out 
mod_wsgi.

As stand-alone servers, the built-in Werkzeug server in Flask just 
works, Twisted just works and gevent just works. Twisted or gevent are 
our choices at the moment.

My question is this: If we're running a stand-alone server (like Twisted 
or gevent), do we need something in front of it (like nginx), or can 
they just run as they are? What part does nginx play in the deployment, 
and is it's use advisable?

Thanks,

Kieran.

Re: [flask] Deploying on Windows

From:
Armin Ronacher
Date:
2010-09-29 @ 17:59
Hi,

On 9/29/10 3:28 PM, Kieran Darcy wrote:
> My question is this: If we're running a stand-alone server (like Twisted
> or gevent), do we need something in front of it (like nginx), or can
> they just run as they are? What part does nginx play in the deployment,
> and is it's use advisable?
I would like to expand the documentation for a recommendation for 
Windows based deployments.  In case you can share any experiences with 
it after a while, I will update the documentation accordingly.


Regards,
Armin

Re: [flask] Deploying on Windows

From:
bruce bushby
Date:
2010-09-29 @ 13:36
From what I understand it'll be fine on it's own....however if you have
heavy traffic and large numbers of static files/pictures etc then nginx can
off load them...however functionality wise it'll work 100% without sitting
behind an accelerator

After a fair bit of searching about, I settle on the following:

Apache + mod_wsgi (because it's easy to do virtual hosting...as in I know
the stanza)
gevent + nginx

gevent will probably also work fine on it's own...until the load gets silly



On Wed, Sep 29, 2010 at 2:28 PM, Kieran Darcy <kieranfdarcy@gmail.com>wrote:

>  For various reasons (available infrastructure, a legacy database etc.),
> deploying a Flask application on Windows is our best option. We're running
> multiple sites/ domains on IIS7.
>
>  With a Linux-based solution our 2nd best option, we've been looking at
> alternatives: We tried PyISAPIe WSGI server, but ran into issues with the
> PostgreSQL driver (pyscopg2) and spawning processes within the application;
> we tried isapi-wsgi, but never really got off the ground; Apache on
> Windows has been problematic for us in the past, ruling out mod_wsgi.
>
> As stand-alone servers, the built-in Werkzeug server in Flask just 
works, Twisted
> just works and gevent just works. Twisted or gevent are our choices at the
> moment.
>
> My question is this: If we're running a stand-alone server (like Twisted or
> gevent), do we need something in front of it (like nginx), or can they just
> run as they are? What part does nginx play in the deployment, and is it's
> use advisable?
>
> Thanks,
>
> Kieran.
>
>

Re: [flask] Deploying on Windows

From:
Jason Huck
Date:
2010-09-29 @ 13:48
>> we tried isapi-wsgi, but never really got off the ground; Apache on Windows
>> has been problematic for us in the past, ruling out mod_wsgi.

I can't comment on mod_wsgi specifically, but if it's been a while
since you tried Apache on Windows, you might want to give it another
go. Up through 2.0.x, things were definitely a little messy; it was
painful to get proper SSL support, etc., but since version 2.2, the
process of getting Apache up and running on Windows is pretty
straightforward, and we haven't seen any issues with performance or
stability.

- jason

Re: [flask] Deploying on Windows

From:
Kieran Darcy
Date:
2010-09-29 @ 13:58
  Thanks for the feedback Jason,
When Apache on Windows came up as an option, our IT director down-voted 
the idea based on past experiences. Maybe it's time to re-evaluate that 
option.

Re: [flask] Deploying on Windows

From:
Waldemar Osuch
Date:
2010-09-29 @ 15:54
Let me chip in with my experience.

All our Python apps run on top of Twisted.  The newer ones are WSGI based
and use twisted.web.wsgi.WSGIResource as a container.  The Twisted apps
themselves are packaged with py2exe as a Windows service.

Twisted on Windows runs very reliably and with "iocpreactor" it even promises
to perform very well.

The apps do run on a separate server.  They are accessible trough the proxy
installed on the main web server.
Currently our proxy is Apache but it could be Ngnix if your IT director is
OK with a Linux machine in the environment.  Or it could be IIS if you find
a reliable proxy for it.  Maybe you already have ISA Server?

Anyway I may provide more details if you are interested.

Waldemar

Re: [flask] Deploying on Windows

From:
Kieran Darcy
Date:
2010-09-29 @ 16:07
  "Let me chip in with my experience."

Thank you so much, I feel like the decision to go with Twisted is the 
right one now.

"...if your IT director is OK with a Linux machine in the environment..."

We already run several Linux servers, and a few people choose to run 
Linux as their desktop, so we're open to all workable solutions.

"Anyway I may provide more details if you are interested."

You've done enough for now, thanks again. When we eventually do get our 
server up and running I'll post something about our experiences.

Re: [flask] Deploying on Windows

From:
Dan Jacob
Date:
2010-09-29 @ 13:34
I assume you are serving static content (images etc) directly from IIS.

I've used Twisted server on Windows aeons ago, and it worked fine then
- you shouldn't need another server in front, just serve to port 80.

The only issue I recall (it was long ago, so memory hazy) was
restarting the server automatically - you might have to wrap it in a
Windows service. Not sure if supervisord (http://supervisord.org)
works in a Windows environment, that may be worth a shot.

Hopefully there is someone on the list with more recent Windows
experience who can help you further.

On 29 September 2010 14:28, Kieran Darcy <kieranfdarcy@gmail.com> wrote:
> For various reasons (available infrastructure, a legacy database etc.),
> deploying a Flask application on Windows is our best option. We're running
> multiple sites/ domains on IIS7.
>
> With a Linux-based solution our 2nd best option, we've been looking at
> alternatives: We tried PyISAPIe WSGI server, but ran into issues with the
> PostgreSQL driver (pyscopg2) and spawning processes within the application;
> we tried isapi-wsgi, but never really got off the ground; Apache on Windows
> has been problematic for us in the past, ruling out mod_wsgi.
>
> As stand-alone servers, the built-in Werkzeug server in Flask just works,
> Twisted just works and gevent just works. Twisted or gevent are our choices
> at the moment.
>
> My question is this: If we're running a stand-alone server (like Twisted or
> gevent), do we need something in front of it (like nginx), or can they just
> run as they are? What part does nginx play in the deployment, and is it's
> use advisable?
>
> Thanks,
>
> Kieran.
>
>

Re: [flask] Deploying on Windows

From:
Kieran Darcy
Date:
2010-09-29 @ 13:44
  Thanks Dan,

"I assume you are serving static content (images etc) directly from IIS."

Yes, we're using IIS to serve static content.

"The only issue I recall (it was long ago, so memory hazy) was
restarting the server automatically - you might have to wrap it in a
Windows service. Not sure if supervisord (http://supervisord.org)
works in a Windows environment, that may be worth a shot."

Thanks for the tip. A quick Google pointed me to SRVANY.EXE; already 
part of Windows http://support.microsoft.com/kb/137890/en-gb

Deploying on Windows

From:
Kieran Darcy
Date:
2010-09-29 @ 13:28
  For various reasons (available infrastructure, a legacy database 
etc.), deploying a Flask application on Windows is our best option. 
We're running multiple sites/ domains on IIS7.

With a Linux-based solution our 2nd best option, we've been looking at 
alternatives: We tried PyISAPIe WSGI server, but ran into issues with 
the PostgreSQL driver (pyscopg2) and spawning processes within the 
application; we tried isapi-wsgi, but never really got off the ground; 
Apache on Windows has been problematic for us in the past, ruling out 
mod_wsgi.

As stand-alone servers, the built-in Werkzeug server in Flask just 
works, Twisted just works and gevent just works. Twisted or gevent are 
our choices at the moment.

My question is this: If we're running a stand-alone server (like Twisted 
or gevent), do we need something in front of it (like nginx), or can 
they just run as they are? What part does nginx play in the deployment, 
and is it's use advisable?

Thanks,

Kieran.