gws.server.control

Functions to start, reconfigure and reload the servers.

Source code: gws.server.control

Module Contents

gws.server.control.app_is_running(srv)

Check whether a server is running, by its pid file.

Parameters:

srv – Server name, web, spool or nginx.

Returns:

True if the pid from the pid file belongs to a running process.

gws.server.control.config_test(manifest_path='', config_path='', dirs_to_watch='', with_parse_only=False, with_watch=False)

Configure or parse the configuration and log the report.

In the watch mode, the test is repeated whenever a file in the watched directories changes, and the function never returns.

Parameters:
  • manifest_path – Path to the application manifest.

  • config_path – Path to the configuration file.

  • dirs_to_watch – Directories to watch, /data by default.

  • with_parse_only – Only parse the configuration, do not configure the objects.

  • with_watch – Keep watching the directories and repeat the test on changes.

gws.server.control.configure(manifest_path='', config_path='', is_starting=False)

Configure the application and log the configuration report.

If the configuration fails and the manifest enables withFallbackConfig, a minimal fallback configuration is used.

Parameters:
  • manifest_path – Path to the application manifest.

  • config_path – Path to the configuration file.

  • is_starting – True on the server start, runs the server.autoRun command before initialization.

Returns:

The configured root object.

Raises:

gws.ConfigurationError – If the configuration fails.

gws.server.control.configure_and_store(manifest_path='', config_path='', is_starting=False)

Configure the application and store the configuration, so that the servers can load it.

Parameters:
  • manifest_path – Path to the application manifest.

  • config_path – Path to the configuration file.

  • is_starting – True on the server start, runs the server.autoRun command before initialization.

Returns:

The configured root object.

Raises:

gws.ConfigurationError – If the configuration fails.

gws.server.control.reconfigure(manifest_path='', config_path='')

Configure the application, rewrite the server configuration files and reload all servers.

Exits the process with code 1 if the web server is not running.

Parameters:
  • manifest_path – Path to the application manifest.

  • config_path – Path to the configuration file.

Raises:

gws.ConfigurationError – If the configuration fails.

gws.server.control.reload_all()

Empty the transient directory and reload the spool and web servers and NGINX.

Returns:

Always True.

gws.server.control.reload_app(srv)

Reload a uWSGI backend, if it is running.

Parameters:

srv – Backend name, web or spool.

gws.server.control.reload_nginx()

Reload the NGINX configuration.

gws.server.control.start(manifest_path='', config_path='')

Configure the application and write the server configuration files and the start script.

Called once on the container start. The start script itself is executed by bin/gws. Exits the process with code 1 if the web server is already running.

Parameters:
  • manifest_path – Path to the application manifest.

  • config_path – Path to the configuration file.

Raises:

gws.ConfigurationError – If the configuration fails.