librelist archives

« back to archive

"hnu testserver" : How does it work ?

"hnu testserver" : How does it work ?

From:
nico
Date:
2011-03-22 @ 23:25
Hello,

I started playing with Photon today, after talking with Loïc a few weeks ago
and reading parts of the source code.

As William Martin said a few days ago on this same list, having to restart the
application server every time your code changes can be annoying...even
though I completely understand why it is that way.

Looking at the help topic for the "hnu" command, I noticed there's a
"testserver" mode that's supposed to "run the development server to test
your application". Thinking it might solve this issue, I launched it but was
not able to have it answer any request ("Host not found" in my browser even
though the server is running). I assume it must bind to a specific interface
and/or port that's not necessarily the one defined in the mongrel2 conf
file. Is there a way to configure the host and port the test server will be
bound to ?

And if the test server doesn't solve this issue, do you guys have tricks to
make the many restarts less painful ?

Thanks in advance.
Nicolas

Re: [photon.users] "hnu testserver" : How does it work ?

From:
Loic d'Anterroches
Date:
2011-03-23 @ 09:02
Hello,

> I started playing with Photon today, after talking with Loïc a few weeks
> ago and reading parts of the source code.
> 
> As William Martin said a few days ago on this same list, having to
> restart the application server every time your code changes can be
> annoying...even though I completely understand why it is that way.
> 
> Looking at the help topic for the "hnu" command, I noticed there's a
> "testserver" mode that's supposed to "run the development server to test
> your application". Thinking it might solve this issue, I launched it but
> was not able to have it answer any request ("Host not found" in my
> browser even though the server is running). I assume it must bind to a
> specific interface and/or port that's not necessarily the one defined in
> the mongrel2 conf file. Is there a way to configure the host and port
> the test server will be bound to ?
> 
> And if the test server doesn't solve this issue, do you guys have tricks
> to make the many restarts less painful ?

Saddly not. The test server is just a simple server which is not
daemonizing and thus, that you can kill with just Ctl+C.

The only way to have autorestart, is to setup like Django inotify.
inotify will monitor your project folder and kill/restart the handlers
when it find changes. This is not really complicated to do and I expect
it to be part of Photon is the near future.

loïc

--
Indefero - Project management and code hosting - http://www.indefero.net
Photon - High Performance PHP Framework - http://photon-project.com
Céondo Ltd - Web + Science = Fun - http://www.ceondo.com

Re: [photon.users] "hnu testserver" : How does it work ?

From:
nico
Date:
2011-03-23 @ 09:29
On Wed, Mar 23, 2011 at 10:02 AM, Loic d'Anterroches <loic@ceondo.com>wrote:

> Hello,
>
> > I started playing with Photon today, after talking with Loïc a few weeks
> > ago and reading parts of the source code.
> >
> > As William Martin said a few days ago on this same list, having to
> > restart the application server every time your code changes can be
> > annoying...even though I completely understand why it is that way.
> >
> > Looking at the help topic for the "hnu" command, I noticed there's a
> > "testserver" mode that's supposed to "run the development server to test
> > your application". Thinking it might solve this issue, I launched it but
> > was not able to have it answer any request ("Host not found" in my
> > browser even though the server is running). I assume it must bind to a
> > specific interface and/or port that's not necessarily the one defined in
> > the mongrel2 conf file. Is there a way to configure the host and port
> > the test server will be bound to ?
> >
> > And if the test server doesn't solve this issue, do you guys have tricks
> > to make the many restarts less painful ?
>
> Saddly not. The test server is just a simple server which is not
> daemonizing and thus, that you can kill with just Ctl+C.
>
> The only way to have autorestart, is to setup like Django inotify.
> inotify will monitor your project folder and kill/restart the handlers
> when it find changes. This is not really complicated to do and I expect
> it to be part of Photon is the near future.
>


Hello Loïc,

This is great news.

I was thinking there could be a way to do reload the classes when modified,
by using reflection. But after looking at what PHP has to offer in the field
of reflection, I don't think it's even possible. And, you know, it was not a
good idea to begin with :)

Nicolas