What is Director?
Director is a website management interface created for use at TJHSST. It allows students to create custom websites under the sites.tjhsst.edu address space. Through Director, any student at TJHSST can design and launch a website using the framework of their choosing. Formerly, students could only design in PHP and HTML, but with the advent of more modern web technologies like Node.js, we wanted students to be able to use them for their websites, which Director allows. Direcotr currently serves over 1000 websites and is used by all the web development classes at TJHSST.
How does it work?
Creating Users and Sites
Director operates by linking the Linux user system to the Postgres database managed by Django. This allows a new unix user to be created for every student and website, which provides sandboxing capabilities and ensures that people can't mess with other people's websites. It also lets the system manage which users can edit a site by creating unix group permissions.
Running Static Sites
When a static site (HTML or PHP) is created, all Director does is create an NGINX configuration file with the relevant paths and site names. Then, when NGINX is reloaded, it takes over and serves the website with no help from Director.
Running Dynamic Sites
Operating a dynamic site is a little more complicated. First, Director will create an NGINX configuration file with a specific port number only it knows. Then, it creates a Supervisor configuration file because Supervisor is the process management tool we use. Once this Supervisor configuration is created, a process will spawn with relevant information available in the environment of the running process, including port information and database information.
You can check out the code on GitHub.