Stopping fastcgi-mono-server gracefully, website content updating with no need to restart it

asp.netfastcgimono

I've been playing a lot recently with Mono 2.10.5 with .NET 4 and MVC 3 with razor views. I am now hosting my website with nginx and fastcgi-mono-server4 configured. Although the website is still not known to public (and will not be until it reaches a desirable state), we've been testing it for many days and things seem to run just fine so far.
So, given the context, let's go the questions that drive me insane some times:

  1. Can I update the contents of my website (dll's, for instance) without having to restart the fastcgi process safely? Is there a possibility of momentaneous failure for my visitors when I'm doing that?
  2. How can I gracefully stop fastcgi-mono-server? I took the initialization script from http://yojimbo87.github.com/2010/03/14/mono-startup-script.html as basis, but it just kills (sends SIGTERM) the fastcgi-mono-server process, not calling Application_End in Global.asax (and that is what I mean by ungraceful shutdown). SIGHUP won't work either (though it also kills the server)

Also, I can't find a page to follow the news or the state of mono-fastcgi-server, the only references I have taught me how to set up the server and the basic workings of it, but I have NO IDEA where to look for new versions and changelogs (or even a download page, so far I've been using portage to install the xsp package, which comes with fastcgi-mono-server). I found http://kerrick.wordpress.com/2007/08/ but the last post on fastcgi-mono-server is so old that it scares me.

If I may ask one last question, how can I run fastcgi-mono-server as an unprivileged user? I'm afraid to try to setuid the process, since I'm not quite sure if mono will respect the setuid flag (haven't tried it yet) and most important, I'm not sure whether fastcgi-mono-server needs root access at some point to set things. I'm deeply inclined to try something along this line, but since I can't find any docs on the matter, I haven't done anything yet. Obviously, I'm quite desperate, since the server is running as root!!

Thank you in advance!

Best Answer

I'm starting also a new adventure with very similar setup and we share similar concerns about it. Let's talk more ;)

I'll try to answer avoiding new questions, but not guaranteed:

  1. I think, need to try, it can be done similar on when you update on a regular IIS deployment scenario. Understanding ASP.NET Dynamic Compilation can help to get more into this. Updates side-effects can always be minimized and all depends on your needs.
  2. It's possible to have several fastcgi-mono-server instances running, still investigating some details dough, listening on different internal ports. I've managed to do this but require more testing.

Other 2 questions...

I also haven't find to many news and documentation on the subject but I'm using fastcgi-mono-server, fastcgi-mono-server2 and fastcgi-mono-server4 without any problems and, as you, I have mono 2.10.5. Consider yourself as an adventurer on asp.net+mono world. I'll try to blog more about my findings to contribute with a more broader discussion.

AFAIK fastcgi-mono-server does not need to run as privileged user, that is root access should not be needed. I'me also investigating more about on security level because at deployment level/running my apps right now I feel I'v reached a stable solution.

Hope this can bring some light to your doubt's... and mine.

Related Topic