Chapter 9
Setting up Sites

[p]This chapter describes the server model of Lasso Professional Server including how to create and administer multiple independent sites. [/p]

Overview

[p]Lasso Professional Server has a multi-site architecture. One master site (or process) accepts all incoming Web requests and routes them to the appropriate child site. This architecture allows different Web sites (e.g. for different clients or projects) to run in effect within their own copy of Lasso Service. Each site has its own settings, datasources, modules, sessions, and global variables. If one site crashes it can be restarted automatically without affecting any of the other sites. [/p]

System Requirements

[p]Each site which is configured within [code]ServerAdmin.LassoApp[/code] requires additional resources. By default Lasso launches the master site and default site. Combined, these two processes have comparable system requirements to earlier versions of Lasso. [/p]

[p]Each additional site should have at least 64 MB of available RAM beyond that required for the basic Lasso installation. [/p]

Site Routing Criteria

[p]The master site determines which child site to route incoming Web requests to using the site routing criteria. An incoming request has the following form: [/p]

[pre]http://www.example.com/folder/file.lasso [/pre]

[p]In this request [code]www.example.com[/code] is the host name (or may sometimes be an IP address), [code]/folder/[/code] is the path, and [code]file.lasso [/code]is the particular file being requested. Lasso looks at the host name and path when determining where to route an incoming request. [/p]

How Lasso routes incoming requests based on site criteria:

  1. The incoming host name is checked against each of the site routing criteria. The [code]%[/code] symbol can be used as a wildcard within the criteria in order to match multiple host names. The default site has a host name of simply [code]%[/code] which matches any incoming host name.
  1. The incoming path is matched against the host root in each of the site criteria. The [code]%[/code] symbol can be used as a wildcard within the criteria in order to match multiple paths. The default site has a host path of simply [code]/%[/code] which matches any incoming path. Any sites which should match only against the host name should use the [code]/%[/code] criteria for the host path.
  1. If multiple site criteria match an incoming request then the criteria with the longest host name and host path will be used. This means that the request will be routed to the site with most specific host name or host path criteria.
[note][b]Note: [/b]The master site has built-in routing criteria. The Lasso initialization screen and [code]ServerAdmin.LassoApp[/code] are automatically served from the master site. [/note]

Site Modules and Folders

[p]The Lasso Professional Server application folder is divided into two levels. The master level includes all of the folders within the Lasso Professional Server application folder itself. The site level includes equivalent site-specific folders within the [code]LassoSites[/code] folder. [/p]

[p]The master level includes the following folders: [/p]

[pre]JavaLibraries LassoModules
JDBCDrivers LassoSites
LassoAdmin LassoStartup
LassoApps SQLIteDBs
LassoLibraries [/pre]

[p]The [code]LassoSites[/code] folder includes a subfolder for each site. By default there is one subfolder named [code]default-1[/code] which corresponds to the default site. With the exception of the [code]LassoSites[/code] folder, each site specific folder contains the same folders as the master level: [/p]

[pre]JavaLibraries LassoLibraries
JDBCDrivers LassoModules
LassoAdmin LassoStartup
LassoApps SQLIteDB [/pre]

[p]By default, all of the site level folders except [code]SQLiteDBs[/code] are empty. [code]SQLiteDBs[/code] contains the [code]lasso_admin[/code], [code]lasso_internal[/code], and [code]lasso_site_#[/code] databases that hold the settings and preferences for the site. [/p]

[p]Each site level folder contains a [code]LassoErrors.txt[/code] file that records errors for the particular site based on the error routing preferences. The [code]LassoErrors.txt[/code] file in the master level only records errors for the master site. [/p]

[p]When Lasso requires a resource it looks in both the site level and the master level, but the order depends on the particular resource: [/p]

  1. [note][b]Note: [/b]The master site does not load Java so no JavaLibraries or JDBCDrivers are loaded in the master site. [/note]
  1. [note][b]Note: [/b]The master site does not load any modules. [/note]
  1. [note][b]Note: [/b]The master site only loads [code]Startup.LassoApp[/code] from the master level and no other startup items. [/note]

Site Independence

[p]Each site within Lasso is completely independent from the other sites: [/p]

Setting Up Sites

[p]Sites are created in the Sites > Sites section of [code]ServerAdmin.LassoApp[/code]. The default site is initially configured to catch all incoming Web requests. Many Lasso installations will only need to use this default site. Additional sites can be created for any of the following reasons: [/p]

Figure 1: Sites List Page

[p]The [code]Site Listing[/code] panel shows a list of all the sites that are defined in Lasso. Each site includes its ID, name, enabled status, running status, and a link to the [code]SiteAdmin.LassoApp[/code] for the site. [/p]

[p]Selecting an individual site will show its settings in the right panel. [code]Enable All[/code] will enable all defined sites. [code]Disable All[/code] will disable all defined sites except for the default site. When a site is disabled it is also stopped. [/p]

Creating a Site

[p]Selecting the [code]Create…[/code]button will show the [code]Add Site[/code] panel to the right. [/p]

Figure 2: Add Site Panel

To add a new site:

  1. Enter a name of the site. Site names should consist of only alphanumeric characters and the underscore. The site level folders will be stored in a folder with the entered name, a dash, and the site ID. For example, [code]New_Site_6[/code].
  1. Enter the site criteria. The host path matches against the host name or IP address of incoming Web requests. The [code]%[/code] symbol can be used as a wildcard to match multiple host names. Host names are usually entered as [code]%example[/code].com to match [code]www.example.com[/code] or [code]example.com[/code].
  1. The [code]Description[/code] field can be used to store notes about the site.
  1. The [code]Duplicate Site[/code] popup can be used to optionally copy all of the site level folders from an existing site to serve as the basis of the new site. Otherwise, default settings will be used for the new site.
  1. If [code]Install Lasso Reference[/code] option is set to [code]Yes[/code] then the [code]LassoScript8_Reference[/code] will be copied into the site. This database is required in order to use the local copy of the Lasso Reference.
  1. The [code]Administrator Username[/code] and [code]Password[/code] can be established for the new site. The site administrator will need this username and password to access the site’s settings through [code]SiteAdmin.LassoApp[/code]. The username cannot match that selected for the server administrator.
  2. [note][b]Note: [/b]The server administrator can also access each site’s settings using [code]SiteAdmin.LassoApp[/code] with the server administrator username and password. [/note]
  1. The [code]Prompt for Initialization[/code] option will prompt the site administrator to change their username and password and establish some other settings the first time they access [code]SiteAdmin.LassoApp[/code].
  1. The SMTP settings allow the host, port, and SMTP AUTH username and password for the site to be established. By default, these settings match those which were set when Lasso was initialized.
  2. [note][b]Note: [/b]The site administrator username and password and site preferences can be modified on the Sites > Preferences section once the site is created. [/note]
[p]After selecting the [code]Add Site…[/code] button the newly added site is selected for additional modifications. If the site is enabled it will be started automatically. If the site is disabled it will not be started. [/p]

[p]The following section describes the actions that Lasso takes when it creates a new site. [/p]

How Lasso creates a new site:

  1. The site name and criteria are validated. A folder named with the site name and ID is created in [code]LassoSites[/code].
  1. If a site has been selected for duplication then all of the site level folders for that site are copied to the new folder.
  1. The Lasso Reference database is copied if required.
  1. The site is started. Any additional required site level folders are created automatically. If the site level databases have not been duplicated then they are created automatically.
  1. The site level [code]lasso_internal[/code] database is accessed so the site administrator username and password and SMTP settings can be stored.
  1. The default allowed file paths of the Web server root and file upload path are added to the site.

Updating Site Properties

[p]Selecting a site name in the [code]Sites Listing[/code] panel will shows its details in the [code]Site Detail[/code] panel which appears to the right. Here, the server administrator can update the sites properties and site criteria. Site preferences can be modified in the Sites > Preferences section and allows file paths can be modified in in the Sites > File Paths section. [/p]

To update details for a specific site:

  1. The name and ID of the site are fixed after it is created. They cannot be modified.
  1. A site can be enabled or disabled. If a site is disabled it will be stopped and will not be automatically started the next time Lasso is launched. Enabled sites are automatically started each time Lasso is launched.
  1. The [code]Description[/code] field can be used to store notes about the site.
  1. The [code]Site Admin URL[/code] is generated automatically based on the site criteria and is used for the [code]Admin[/code] link in the site listing. The URL can be modified if required so it properly loads [code]SiteAdmin.LassoApp[/code] for the site.
  1. The [code]Site Criteria[/code] are established in a listing each with a [code]Host Name[/code] and [code]Host Path[/code]. The [code]%[/code] symbol can be used as a wildcard in either field. New site criteria can be added by inserting values into the [code]New[/code] line then selecting [code]Update[/code]. Site criteria can be deleted using the minus button next to each line.
[p]All of the specified changes are made when the [code]Update[/code] button is selected. [/p]

Stopping or Starting a Site

[p]Selecting a site name in the [code]Sites Listing[/code] panel will shows its details in the [code]Site Detail[/code] panel which appears to the right. Here, the server administrator can start or stop the specified site. [/p]

To start a site:

[p]Select the [code]Start[/code] button at the bottom of the [code]Site Detail[/code] panel. The [code]Start[/code] button will only be visible if the site is currently stopped. [/p]

[note][b]Note: [/b]Disabled sites can be started, but will not be automatically restarted if they crash. Disabled sites are not started automatically when Lasso is launched. [/note]

To stop a site:

[p]Select the [code]Stop[/code] button at the bottom of the [code]Site Detail[/code] panel. The [code]Stop[/code] button will only be visible if the site is currently running. [/p]

[note][b]Note: [/b]Enabled sites can be stopped, but will automatically restart if an incoming Web request is routed to the site. Enabled sites will be started automatically when Lasso is launched. [/note]

To restart a site:

[p]A site can be restarted by first stopping the site, then starting it again. An enabled site which is stopped will also automatically restart when an incoming Web request is routed to the site or if Lasso is relaunched. [/p]

Deleting a Site

[p]Selecting a site name in the [code]Sites Listing[/code] panel will shows its details in the [code]Site Detail[/code] panel which appears to the right. Here, the server administrator can delete the specified site. [/p]

To delete a site:

[p]Select the [code]Delete…[/code] button within the [code]Site Detail[/code] panel and confirm the dialog that appears. The site is stopped and deleted from within Lasso’s settings. [/p]

[p]The site level folders for the site are moved to a [code]LassoSitesDeleted[/code] folder. To completely delete a site the corresponding site level folder must also be deleted from the [code]LassoSitesDeleted[/code] folder. [/p]

Site Preferences

[p]The Sites > Preferences section allows the site preferences to be modified. These include the site administrator username and password and the default SMTP settings for sending mail. [/p]

Figure 3: Site Preferences

[p]The control at the top of the section allows the current site to be selected. Details of the current site are also provided in the left panel. Sites cannot be started and stopped through this interface. The Sites > Sites section should be used instead. [/p]

[p]The Prompt for Initialization option controls whether the site administrator will be prompted for a new username and password the next time they log in to Site Administration. This allows the site administrator username and password to be set to a temporary value and then reset by the actual administrator to a value they choose. [/p]

Allowed Files Paths

[p]Lasso has built-in file security for site users and site administrators. A site can only access the allowed file paths that are established in the Sites > File Paths section of Server Administration. [/p]

Figure 4: Allowed File Paths

[p]The control at the top of the section allows the current site to be selected. Details of the current site are also provided in the left panel. Sites cannot be started and stopped through this interface. The Sites > Sites section should be used instead. [/p]

[p]The left panel shows the file paths that are currently allowed for the site. The [code][File][/code] tags will only work within a path that is defined in this panel for either the users or the site administrator of the current site. Paths can be deleted by selecting the minus symbol next to a path. Paths can be added by typing the name of the path in the text input and then selecting Add Path. [/p]

[note][b]Important: [/b]The site administrator controls what permissions are assigned to a path. If a path is deleted and recreated within this interface then those permissions will be lost. [/note]

[p]Several special purpose paths can be added automatically using the buttons at the bottom of the panel if they are not already included in the list of allowed paths. These include the Web server root path [code]/[/code] and the file uploads path (established in the right panel). [/p]

File Uploads Path

[p]The right panel allows the file uploads path to be established. This path can vary depending on platform, operating system version, local volume names, and Web server. The most foolproof way to determine the file uploads path is to try a file upload and then store the location of the uploaded temporary file. [/p]

[p]The current file uploads path is displayed at the top of the panel. As long as this value is not [code]Undefined[/code] it should not need to be redefined unless Lasso has been moved to a different machine. A new file uploads path can be determined by selecting a small (32k or less) file with the [code]Choose File[/code] control and then selecting the [code]Test[/code] button. The uploaded file will be deleted immediately after its location has been determined. [/p]

[p]The path which is determined with this procedure can then be added to the list of allowed paths using the [code]Allow File Upload Path[/code] button at the bottom of the left panel (if the path is not already in the list of allowed paths). Newly created sites will have this path allowed by default. [/p]

Managing Sites

[p]This section includes technical details about sites in Lasso including how they are represented within system administration tools on each platform, what error messages they report, and how to troubleshoot problems. [/p]

Site Processes

[p]Each individual site which is running in Lasso is seen as a separate process by the operating system. [/p]

[pre]ps -U lasso [/pre]

[pre]➜ 11689 p1 S+ 0:03.50 ./Lasso8Service
11690 p1 S+ 0:27.56 ./Lasso8Service--nolisten --ischild --siteid=1
--sitename=default --pipename=lassosite_1 --workingdir=LassoSites/default-1 [/pre]

Error Messages

[p]Lasso logs error messages related to site operations within the [code]errors[/code] database and [code]LassoErrors.txt[/code] file for the master site. Informative messages about the normal operation of sites are logged at the [code]Warning[/code] level. Serious problems are logged at the [code]Critical[/code] level. [/p]

[pre]Restarted site process <id> <name>. [/pre] [pre]Unable to hand request to site process even after restarting it <id> <name>.
Unable to restart site process <id> <name>.
Unable to get PID from child process for site <id> <name>.
Unable to create child process for site <id> <name>.
Child process failed to create named pipe for site <id> <name>. [/pre]