Now that ASP.NET Core is available for Linux, I'd like to use it on my web server. It's running Ubuntu 14.04 (upgrade to 16.04 scheduled for autumn) and Apache with a multi-user shared web hosting configuration. Each user has their own system user account and owns all their files. PHP is already set up with suEXEC. This roughly corresponds to the application pool identity in IIS/Windows.
The official Linux setup guide describes how to configure the reverse proxy with Nginx and use supervisor as process manager. I haven't heard of supervisor before and feel like it has some flaws that cause trouble with hosting processes. I like the idea of AspNetCore module for IIS but that isn't available for Apache and probably won't anytime soon. So I'm looking into creating my own solution for that.
I know how to configure the reverse proxy in Apache and in fact I have my custom script in place that generates the VirtualHost configurations for all domains based on a database backend. This could also generate the proxy configuration. My idea is to write a program that does the process management, reading from the same database backend:
- Runs as daemon with root privilege, started with the system, never restarted for configuration
- Reads the database to know which web applications to start on which TCP port
- Re-reads the database regularly for updated configuration
- Starts the web application process under the user that owns the files (prevent starting as root)
- Reads the published web.config file to know the start command, logging and restart options etc.
- Monitors started child processes and performs restarting according to configuration in web.config
Because it would be able to read the web.config file, the only database contents is the public URL, the local port, and the application base directory.
I'm looking into writing this as a .NET Core application itself so it doesn't have additional runtime requirements. Hopefully this provides all the security and process APIs I need.
Does something like this already exist? Is anybody interested in such a solution? Any further ideas, concerns, or tips?
I guess that the public URL as well as the local port are specified by the calling process through environment variables. I haven't looked closely at how AspNetCore module does it yet.