Runtime System

The Maxscape Web Application Server is built on top of the generic web server platform. Server and application software are executed within application daemons that contain the run-time objects and the application process main loop.

In general, content generation takes place within application servers, each with a unique name. An application server consists of one or more daemon processes. Application code is running within these application daemons and can use the Maxscape server run-time objects via its API.

Application objects and functions can be plugged in via the application server module files or stored in the content database. Applications can define callbacks at many stages of the content generation loop, for example, to render the database content.

You might want to use the run-time objects of the Maxscape server library, which implements a layer between the platform and the application server daemons. Most notably, to access the CGI environment and the objects to work with the content database.

Maxscape Start, Restart and Stop Scripts

To start, restart and stop the Maxscape runtime system open a terminal, login to the super-user (su) account, maybe set the project environment (sp) and execute the maxscape shell script directly or via the Tcsh maxscape alias.

account> su - su                             # login to the su account
home/su> sp                                  # set shell environment
home/su> /maxscape/etc/init.d/maxscape start # Start Maxscape with Apache
home/su> maxscape -s maxdaemon start         # Start Maxscape with Maxdaemon
Starting Maxscape at 2026-10-17 10:00:05 from /maxscape.
Starting Mysql Database.
Starting Maxscape Control Daemon.
Starting Maxscape Administration Server.
Starting Maxdaemon Application Server

After changing code stored in files on the file system, you need to restart the related daemons. Changes to the Perl code stored in the content database do not require a process restart. To restart all application daemons, simply say:

home/su> maxscape -s maxdaemon restart
Restarting Maxdaemon Application Server.

You might want to adapt the global shell environment, the set project script and the maxscape start script to the requirements of your projects.

Maxscape Server Global Configuration

To configure Maxscape, as well as the application servers, you need to edit some of the following configuration files:

/maxscape/etc/profile         # Global Shell user environment
/maxscape/etc/skel/.tcshrc    # Global Tcsh startup resource file

/maxscape/etc/maxscape.cnf    # Server global configuration
/maxscape/etc/httpd.conf      # Apache configuration
/maxscape/etc/maxdaemon.conf  # Maxdaemon configuration
...
# Administration server configuration
/maxscape/server/WebServer/etc/maxscape.conf
/maxscape/server/WebServer/etc/httpd.conf
/maxscape/server/WebServer/etc/maxdaemon.conf
...

Virtual Application Server

With Maxscape, content generation takes place within application servers. An application server comprises one or more process daemons and is referred to by its unique application server name. Each application server has its own:

  • Unique Name
  • File System Structure
  • Application Server Configuration
  • Application Process Daemons
  • Application Modules
  • Application Callbacks
  • Content Database Instance

Application Server Root Directories

Each application server is located in a separate subtree under the '/maxscape/server' directory. The root directory should have the name of the application server and the tree has a standardized file system structure. It contains the documents, images, media files, application code, libraries and the export of the content database tables of the application server.

> ls /maxscape/server/
WebServer/    # Administration Server
Maxscape/     # Maxscape Website
Test/         # Test Server
Template/     # Template Server
MyAppServer/  # 'MyAppServer' Application Server 
...

Maxscape and Application Server Configuration

An application server's configuration inherits the global configuration and is defined in the following iles:

/maxscape/server/<AppServerName>/etc/maxscape.conf
/maxscape/server/<AppServerName>/etc/httpd.conf
/maxscape/server/<AppServerName>/etc/maxdaemon.conf
...

Application Server Main Loop Script

An application server's main loop script has to be created or copied to the server's document root and the HTTP server must be configured, accordingly. With Apache you should use the FCGI and with Maxdaemon the SCGI or the DCGI interfaces. The SCGI compares to Apache's FCGI interface, while with the DCGI interface applications are directly integrated into the Maxdaemon HTTP server, similar to ModPerl with Apache.

Application Process Mainloop Daemons

An application process dameon is implemented by a main script that executes the application and server software on top of the server platform. It contains the run-time server object's definitions and implements the process daemon's main loop.

This script is located under the application server's 'docs' directory which appears to be the 'DocumentRoot' of the HTTP server's configuration. Application modules can be defined by Perl's 'use Module;' statement or may be plugged in via the plugin mechanism. Callbacks can be executed at several stages of the content generation loop.

The main loop type reflects the purpose of the daemon. At least it it waits for a client request and generates some response.

# Application process daemon's main loop using Apache's FCGI interface.
# File: /maxscape/server/<application server>/docs/www.fcg

use FCGI;

use Maxscape::HTTP::Request;
use Maxscape::HTTP::Response;
use Maxscape::Process;
use Maxscape::ServerApplication;

my $Process = Maxscape::Process->new->initialise;

my $Request;
my $Response;
my $FCGI_Request = FCGI::Request();

while ($FCGI_Request->Accept >= 0)
{
  $Request = Maxscape::HTTP::Request->new;
  $Response = $Process->execute ($Request);
  print $Response->HeaderAsString, $Response->Content;
  $Process->postProcess;
  $Process->cleanup;
}

In the above main loop example, the database connections are established at the initialization phase of the process and are reused afterwards.

The application daemon gets a request from a client and sends a response to the HTTP server, in this case, via the Fcgi interface. The server and the application code are executed within the execute method of the $Process object, thus hiding details from the main loop script.

Note, that the code never prints directly to stdout but returns output to the calling function. The $Response object is a container to store and send the generated content.

Maxscape provides several CGI interfaces to communicate with the HTTP server such as CGI, FCGI, SCGI and DCGI. The main loop script's CGI object needs to be adapted and has to be configured as required by the interface type.

Runtime System Objects

The main loop creates the run-time objects to provide an API to the server's CGI environment and the content of the application server's database instance. These objects are used in the application code to generate the website's content.

Next ∙ Previous ∙ Top ∙ Join ∙ Contact © Maxscape