python-gunicorn-systemd-service-unit-file
Description
n/a
Variables
Name | Type | Default | Description |
---|---|---|---|
|
string | -- | The app entry point. Required |
|
string | -- | The name of the systemd service. Required |
|
string | -- | The (base) path of the virtualenv to use. Required |
|
boolean | -- | Whether to enable the service. |
|
string | -- | The group who owns/runs the virtualenv. |
|
string | -- | The gunicorn config. |
|
integer | 8088 | The port the gunicorn should listen to. |
|
dict | ordereddict() | A map of key/value-pairs to put into a '/etc/conf.d/ This can be used in addition or instead of 'service_environment' and 'service_environment_file'. It is meant as a short-cut, to not have to create the config file (in '/etc/conf.d') in an extra step. |
|
boolean | -- | Whether to start the service. |
|
string | -- | The user who owns/runs the virtualenv. |
|
string | -- | The working directory of the service. |
Code
args: _import: - python-virtualenv - systemd-service-unit service_name: doc: short_help: The name of the systemd service. type: string required: true venv_path: doc: short_help: The (base) path of the virtualenv to use. type: string required: true app_module: doc: short_help: The app entry point. type: string service_config: doc: short_help: Environment variables to configure the app. type: dict keyschema: type: string empty: true required: false default: {} working_directory: doc: short_help: The working directory of the service. type: string required: false port: doc: short_help: The port the gunicorn should listen to. type: integer required: false default: 8088 gunicorn_config: doc: short_help: The gunicorn config. type: string required: false frecklets: - systemd-service-unit: name: '{{:: service_name ::}}' unit_description: '{{:: service_name ::}} service daemon (gunicorn)' service_config: '{{:: service_config ::}}' service_type: simple service_user: '{{:: user ::}}' service_group: '{{:: group ::}}' service_exec_start: '{{:: venv_path ::}}/bin/gunicorn {%:: if gunicorn_config is defined and gunicorn_config ::%}-c {{:: gunicorn_config ::}} {%:: endif ::%}-w 10 -k gevent --timeout 120 -b 0.0.0.0:{{:: port ::}} --limit-request-line 0 --limit-request-field_size 0 {{:: app_module ::}} --pid /run/{{:: service_name ::}}/{{:: service_name ::}}.pid' service_exec_reload: +/bin/kill -s HUP $MAINPID service_exec_stop: +/bin/kill -s TERM $MAINPID service_private_tmp: true service_pid_file: '/run/{{:: service_name ::}}/{{:: service_name ::}}.pid' service_working_directory: '{{:: working_directory ::}}' service_exec_start_pre: - '+/bin/mkdir /run/{{:: service_name ::}}' - '+/bin/chown -R {{:: user ::}}{%:: if group is defined and group ::%}:{{:: group ::}}{%:: endif ::%} /run/{{:: service_name ::}}' service_exec_stop_post: - '+/bin/rm -rf /run/{{:: service_name ::}}' unit_after: - network.target install_wanted_by: - multi-user.target enabled: '{{:: enabled ::}}' started: '{{:: started ::}}'
frecklecute python-gunicorn-systemd-service-unit-file --help Usage: frecklecute python-gunicorn-systemd-service-unit-file [OPTIONS] n/a Options: --app-module APP_MODULE The app entry point. [required] --service-name SERVICE_NAME The name of the systemd service. [required] --venv-path VENV_PATH The (base) path of the virtualenv to use. [required] --enabled / --no-enabled Whether to enable the service. --group GROUP The group who owns/runs the virtualenv. --gunicorn-config GUNICORN_CONFIG The gunicorn config. --port PORT The port the gunicorn should listen to. --service-config SERVICE_CONFIG Environment variables to configure the app. --started / --no-started Whether to start the service. --user USER The user who owns/runs the virtualenv. --working-directory WORKING_DIRECTORY The working directory of the service. --help Show this message and exit.
# -*- coding: utf-8 -*- # # module path: pycklets.python_gunicorn_systemd_service_unit_file.PythonGunicornSystemdServiceUnitFile # from dataclasses import dataclass from pyckles import AutoPycklet from typing import * # noqa @dataclass class PythonGunicornSystemdServiceUnitFile(AutoPycklet): """No documentation available. Args: app_module: The app entry point. enabled: Whether to enable the service. group: The group who owns/runs the virtualenv. gunicorn_config: The gunicorn config. port: The port the gunicorn should listen to. service_config: Environment variables to configure the app. service_name: The name of the systemd service. started: Whether to start the service. user: The user who owns/runs the virtualenv. venv_path: The (base) path of the virtualenv to use. working_directory: The working directory of the service. """ FRECKLET_ID = "python-gunicorn-systemd-service-unit-file" app_module: str = None enabled: bool = None group: str = None gunicorn_config: str = None port: int = None service_config: Dict = None service_name: str = None started: bool = None user: str = None venv_path: str = None working_directory: str = None def __post_init__(self): super(PythonGunicornSystemdServiceUnitFile, self).__init__(var_names=["app_module", "enabled", "group", "gunicorn_config", "port", "service_config", "service_name", "started", "user", "venv_path", "working_directory"]) frecklet_class = PythonGunicornSystemdServiceUnitFile
# -*- coding: utf-8 -*- # # module path: pycklets.python_gunicorn_systemd_service_unit_file.PythonGunicornSystemdServiceUnitFile # from pyckles import AutoPycklet class PythonGunicornSystemdServiceUnitFile(AutoPycklet): """No documentation available. Args: app_module: The app entry point. enabled: Whether to enable the service. group: The group who owns/runs the virtualenv. gunicorn_config: The gunicorn config. port: The port the gunicorn should listen to. service_config: Environment variables to configure the app. service_name: The name of the systemd service. started: Whether to start the service. user: The user who owns/runs the virtualenv. venv_path: The (base) path of the virtualenv to use. working_directory: The working directory of the service. """ FRECKLET_ID = "python-gunicorn-systemd-service-unit-file" def __init__(self, app_module=None, enabled=None, group=None, gunicorn_config=None, port=8088, service_config=None, service_name=None, started=None, user=None, venv_path=None, working_directory=None): super(PythonGunicornSystemdServiceUnitFile, self).__init__(var_names=["app_module", "enabled", "group", "gunicorn_config", "port", "service_config", "service_name", "started", "user", "venv_path", "working_directory"]) self._app_module = app_module self._enabled = enabled self._group = group self._gunicorn_config = gunicorn_config self._port = port self._service_config = service_config self._service_name = service_name self._started = started self._user = user self._venv_path = venv_path self._working_directory = working_directory @property def app_module(self): return self._app_module @app_module.setter def app_module(self, app_module): self._app_module = app_module @property def enabled(self): return self._enabled @enabled.setter def enabled(self, enabled): self._enabled = enabled @property def group(self): return self._group @group.setter def group(self, group): self._group = group @property def gunicorn_config(self): return self._gunicorn_config @gunicorn_config.setter def gunicorn_config(self, gunicorn_config): self._gunicorn_config = gunicorn_config @property def port(self): return self._port @port.setter def port(self, port): self._port = port @property def service_config(self): return self._service_config @service_config.setter def service_config(self, service_config): self._service_config = service_config @property def service_name(self): return self._service_name @service_name.setter def service_name(self, service_name): self._service_name = service_name @property def started(self): return self._started @started.setter def started(self, started): self._started = started @property def user(self): return self._user @user.setter def user(self, user): self._user = user @property def venv_path(self): return self._venv_path @venv_path.setter def venv_path(self, venv_path): self._venv_path = venv_path @property def working_directory(self): return self._working_directory @working_directory.setter def working_directory(self, working_directory): self._working_directory = working_directory frecklet_class = PythonGunicornSystemdServiceUnitFile