Пример #1
0
        def import_initial_services_jobs(is_first):

            # All non-internal services that we have deployed
            locally_deployed = []

            # Internal modules with that are potentially to be deployed
            internal_service_modules = []

            # This was added between 3.0 and 3.1, which is why it is optional
            deploy_internal = self.fs_server_config.get(
                'deploy_internal', default_internal_modules)

            # Above, we potentially got the list of internal modules to be deployed as they were defined in server.conf.
            # However, if someone creates an environment and then we add a new module, this module will not neccessarily
            # exist in server.conf. This is why we need to add any such missing ones explicitly below.
            for internal_module, is_enabled in default_internal_modules.items(
            ):
                if internal_module not in deploy_internal:
                    deploy_internal[internal_module] = is_enabled

            # All internal modules were found, now we can build a list of what is to be enabled.
            for module_name, is_enabled in deploy_internal.items():
                if is_enabled:
                    internal_service_modules.append(module_name)

            locally_deployed.extend(
                self.service_store.import_internal_services(
                    internal_service_modules, self.base_dir,
                    self.sync_internal, is_first))

            logger.info('Deploying user-defined services (%s)', self.name)

            user_defined_deployed = self.service_store.import_services_from_anywhere(
                self.service_modules + self.service_sources,
                self.base_dir).to_process

            locally_deployed.extend(user_defined_deployed)
            len_user_defined_deployed = len(user_defined_deployed)

            suffix = ' ' if len_user_defined_deployed == 1 else 's '

            logger.info('Deployed %d user-defined service%s (%s)',
                        len_user_defined_deployed, suffix, self.name)

            return set(locally_deployed)
Пример #2
0
# Zato
from zato.cli import ZatoCommand, common_logging_conf_contents, common_odb_opts, kvdb_opts, sql_conf_contents
from zato.cli._apispec_default import apispec_files
from zato.common import CONTENT_TYPE, default_internal_modules, SERVER_JOIN_STATUS
from zato.common.crypto import well_known_data
from zato.common.defaults import http_plain_server_port
from zato.common.odb.model import Cluster, Server

# ################################################################################################################################

server_conf_dict = deepcopy(CONTENT_TYPE)
server_conf_dict.deploy_internal = {}

deploy_internal = []

for key, value in default_internal_modules.items():
    deploy_internal.append('{}={}'.format(key, value))

server_conf_dict.deploy_internal = '\n'.join(deploy_internal)

server_conf_template = """[main]
gunicorn_bind=0.0.0.0:{{port}}
gunicorn_worker_class=gevent
gunicorn_workers={{gunicorn_workers}}
gunicorn_timeout=240
gunicorn_user=
gunicorn_group=
gunicorn_proc_name=
gunicorn_logger_class=
gunicorn_graceful_timeout=1