electronic.alchemy :: FinServe
electronic.alchemy
where the past meets the future
pike > Fins > FinServe

FinServe

Created by hww3. Last updated by hww3, 3 years ago. Version #15.

FinServe is a simple web server which can serve Fins applications. Primarily intended as a development tool, FinServe is also useful when fronted by a full web server such as Apache or Roxen.

FinServe is bundled with the Fins framework, and is run using the following command line:

pike -x fins start [-p portnum|--port=portnum|--hilfe] [-s ram|file|sqlite|--session-manager=ram|file|sqlite [-l storage_path|--session-storage-location=storage_path]] [-c|--config configname] [--local-network=CIDR] [-d] -a appname

Ports and URLs

If you specify a port number, FinServe will start an HTTP listener on that port (the default is 8080). If you access this port (called the administrative port) using the ip address of your server, or using a hostname that isn't some application's specified url (see below), you will get an informational page that describes the current version of FinServe, along with information about applcations that are currently running in-process. Note that this administrative page is only available via requests from the localhost or networks specified using the --local-network option.

Each application may specify one or more ports to open for that application (see [ create ]). If any are specified, that specific application will be served from that port. Each application may also be accessed via the administrative port using name based virtual hosting, in which case the hostname used to access FinServe will be used to determine the application to serve. For details of how hostnames are mapped to applications, see the following paragraph.

URLs and Name-based virtual hosting

Fins will attempt to determine an appropriate URL for each application, used for constructing redirects as well as for determining which application to serve a request when using name based virtual hosting on the administrative port. Fins will apply the following algorithm:

  1. If the url setting in the web section of an application's config file is set, then this will be used as the application's canonical url.
  2. If one or more ports have been opened for the application, the last one opened will be used and either the bound ip's hostname or the hostname of the machine will be used to generate a url.
  3. If the use_xip_io setting in the web section of the config file is set, then the hostname portion of the application's url be appname-~~configname~~-my_ip_address.nip.io. See [external]http://nip.io for additional details of the dns service provided by nip.io.
  4. Otherwise, fins will attempt to look up the hostname of the server. In this case, a warning will be printed to the debug log indicating that this situation may produce undesired results.
  5. You can disable virtual hosting support using the --no-virtual option. This will effectively disable the administration page and make the first application loaded the default.
In any case, a message will be printed to the log indicating the URL(s) that may be used to access an application.

Hilfe and Interactive Fins

If you specify the "--hilfe" option to simple_start, FinServe will load the application and drop you to an interactive Pike session. The Fins application will be loaded and made available as the variable "application". From there, you may access the model, view and controller directly, which is useful for debugging the model and many other tasks.

If you have the Protocols.DNS_SD module, you'll get a Bonjour Bookmark in your browser which supports Bonjour (Rendezvous), such as Safari or Camino.

Multi-Tenant mode

When using Pike 7.9 or higher, FinServe supports Multi-Tenant mode, which allows multiple applications to be hosted from within a single process. Isolation between applications is quite good, and you can even run multiple copies of the same application (using different configurations).

Daemon mode

The command line option -d causes FinServe to run in daemon mode (not available on Windows). When starting in daemon mode, FinServe will detach from the console and redirect its standard out and standard error streams to a log file (finserve.log, by default, specified using the -l option). Additionally, each application should have a logging configuration that generates an application specific debug log file.

Configuration options

The following configuration file values are used by FinServe, describing the default values:

[web]
# defaults to ram, options include sqlite or file
session_storage_type=ram
# used for file or sqlite storage, this is the path
# to the database file or file storage location
session_storage_location=
# timeout period for sessions, in seconds
session_timeout=600
#
url=
#
port=

[port_XXX] port= bind= protocol=http certificate= key= # default port number to listen on port=8080

Not categorized | RSS Feed | BackLinks

comments powered by Disqus