Webserver#

class plinth.modules.apache.components.Webserver(component_id: str, web_name: str, kind: str = 'config', urls: list[str] | None = None, expect_redirects: bool = False, last_updated_version: int | None = None)[source]#

Component to enable/disable Apache configuration.

__init__(component_id: str, web_name: str, kind: str = 'config', urls: list[str] | None = None, expect_redirects: bool = False, last_updated_version: int | None = None)[source]#

Initialize the web server component.

component_id should be a unique ID across all components of an app and across all components.

web_name is the primary part of the configuration file path which must be enabled/disabled by this component.

kind is the type of Apache configuration being enabled/disabled. This must be ‘config’ for a configuration in /etc/apache/conf-available/, ‘module’ for configuration in /etc/apache2/mods-available/, ‘site’ for configuration in /etc/apache2/sites-available/.

urls is a list of URLs over which a HTTP services will be available due to this component. This list is only used for running diagnostics.

expect_redirects is a boolean that allows redirects when trying to access the URLs during diagnosis of the component.

last_updated_version is the app version in which the web server configuration/site/module file was updated. Using this, web server will be automatically reloaded or restarted as necessary during app upgrade.

diagnose() list[DiagnosticCheck][source]#

Check if the web path is accessible by clients.

See plinth.app.Component.diagnose().

disable() None[source]#

Disable the Apache configuration.

enable() None[source]#

Enable the Apache configuration.

is_enabled() bool[source]#

Return whether the Apache configuration is enabled.

setup(old_version: int)[source]#

Restart/reload web server if configuration files changed.

class plinth.modules.apache.components.WebserverRoot(component_id: str, web_name: str, expect_redirects: bool = False, last_updated_version: int | None = None)[source]#

Component to enable/disable Apache configuration for domain root.

Each domain has a unique virtual host configuration in Apache. This file includes an option configuration file that can dropped in by FreedomBox. If an app wants to be hosted on a dedicated domain, it can provide a configuration file that is meant to be in the <VirtualHost> section. Using this component, the include file fragment for a selected domain can be linked to app’s configuration file. Then, for the selected domain, the app’s configuration becomes the domain’s root configuration.

This components uses key/value store to remember the selected domain. When the domain changes, the change must be notified using domain_set().

__init__(component_id: str, web_name: str, expect_redirects: bool = False, last_updated_version: int | None = None)[source]#

Initialize the web server component for domain root.

component_id should be a unique ID across all components of an app and across all components.

web_name is the primary part of the configuration file path which must be enabled/disabled by this component. The file’s path should be /etc/apache2/includes/<web_name>.conf.

expect_redirects is a boolean that allows redirects when trying to access the domain URL during diagnosis of the component.

last_updated_version is the app version in which the web server configuration/site/module file was updated. Using this, web server will be automatically reloaded or restarted as necessary during app upgrade.

diagnose() list[DiagnosticCheck][source]#

Check if the site root path is accessible by clients.

See plinth.app.Component.diagnose().

disable() None[source]#

Unlink the Apache site root configuration from app configuration.

domain_get() str | None[source]#

Return the currently configured domain name.

domain_set(domain: str | None)[source]#

Set the domain to use with the app.

enable() None[source]#

Link the Apache site root configuration to app configuration.

setup(old_version: int)[source]#

Restart/reload web server if configuration files changed.

uninstall()[source]#

Remove the domain configured.

class plinth.modules.apache.components.Uwsgi(component_id: str, uwsgi_name: str)[source]#

Component to enable/disable uWSGI configuration.

__init__(component_id: str, uwsgi_name: str)[source]#

Initialize the uWSGI component.

component_id should be a unique ID across all components of an app and across all components.

uwsgi_name is the primary part of the configuration file path which must be enabled/disabled by this component.

disable() None[source]#

Disable the uWSGI configuration.

enable() None[source]#

Enable the uWSGI configuration.

is_enabled() bool[source]#

Return whether the uWSGI configuration is enabled.

is_running() bool[source]#

Return whether the uWSGI daemon is running with configuration.