Exemplo n.º 1
0
    def start(self,
              port: int,
              tls_key_filepath: Path = None,
              tls_certificate_filepath: Path = None,
              dry_run: bool = False):
        if dry_run:
            return

        if tls_key_filepath and tls_certificate_filepath:
            self.log.info("Starting HTTPS Control...")
            # HTTPS endpoint
            hx_deployer = HendrixDeployTLS(
                action="start",
                key=str(tls_key_filepath.absolute()),
                cert=str(tls_certificate_filepath.absolute()),
                options={
                    "wsgi": self._transport,
                    "https_port": port,
                    "resources": get_static_resources()
                })
        else:
            # HTTP endpoint
            # TODO #845: Make non-blocking web control startup
            self.log.info("Starting HTTP Control...")
            hx_deployer = HendrixDeploy(action="start",
                                        options={
                                            "wsgi": self._transport,
                                            "http_port": port,
                                            "resources":
                                            get_static_resources()
                                        })

        hx_deployer.run()  # <--- Blocking Call to Reactor
Exemplo n.º 2
0
    def start(self,
              host: str,
              port: int,
              web_services: bool = True,
              distribution: bool = True,
              crash_on_error: bool = False):

        self.crash_on_error = crash_on_error

        if self.start_time is not NOT_RUNNING:
            raise RuntimeError("Felix is already running.")

        self.start_time = maya.now()
        payload = {
            "wsgi": self.rest_app,
            "http_port": port,
            "resources": get_static_resources()
        }
        deployer = HendrixDeploy(action="start", options=payload)

        if distribution is True:
            self.start_distribution()

        if web_services is True:
            deployer.run()  # <-- Blocking call (Reactor)
Exemplo n.º 3
0
    def start(self, http_port: int, dry_run: bool = False):

        self.log.info("Starting HTTP Character Control...")
        if dry_run:
            return

        # TODO #845: Make non-blocking web control startup
        hx_deployer = HendrixDeploy(action="start",
                                    options={
                                        "wsgi": self._transport,
                                        "http_port": http_port,
                                        "resources": get_static_resources()
                                    })
        hx_deployer.run()  # <--- Blocking Call to Reactor
Exemplo n.º 4
0
 def get_deployer(self, rest_app, port):
     return HendrixDeployTLS("start",
                             key=self._privkey,
                             cert=X509.from_cryptography(self.certificate),
                             context_factory=ExistingKeyTLSContextFactory,
                             context_factory_kwargs={
                                 "curve_name": _TLS_CURVE.name,
                                 "sslmethod": TLSv1_2_METHOD
                             },
                             options={
                                 "wsgi": rest_app,
                                 "https_port": port,
                                 "max_upload_bytes":
                                 MAX_UPLOAD_CONTENT_LENGTH,
                                 'resources': get_static_resources(),
                             })