def load_configuration(): global _conf argparser = ArgumentParser(description="Zoe Web interface: Container Analytics as a Service web component", default_config_files=config_paths, auto_env_var_prefix="ZOE_WEB_", args_for_setting_config_path=["--config"], args_for_writing_out_config_file=["--write-config"]) argparser.add_argument('--debug', action='store_true', help='Enable debug output') argparser.add_argument('--listen-address', type=str, help='Address to listen to for incoming connections', default="0.0.0.0") argparser.add_argument('--listen-port', type=int, help='Port to listen to for incoming connections', default=5001) argparser.add_argument('--master-url', help='URL of the Zoe master process', default='tcp://127.0.0.1:4850') argparser.add_argument('--deployment-name', help='name of this Zoe deployment', default='prod') # argparser.add_argument('--cookie-secret', help='key used to encrypt cookies', default="hr4h3H'kmn F8fz/;CJN5a!") argparser.add_argument('--ldap-server-uri', help='LDAP server to use for authentication', default='ldap://localhost') argparser.add_argument('--ldap-base-dn', help='LDAP base DN for users', default='ou=something,dc=any,dc=local') argparser.add_argument('--ldap-bind-user', help='LDAP user to bind as for user lookup', default='cn=guest,dc=bigfoot,dc=eurecom,dc=fr') argparser.add_argument('--ldap-bind-password', help='LDAP user password', default='notsosecret') argparser.add_argument('--ldap-admin-gid', type=int, help='LDAP group ID for admins', default=5000) argparser.add_argument('--ldap-user-gid', type=int, help='LDAP group ID for users', default=5001) argparser.add_argument('--ldap-guest-gid', type=int, help='LDAP group ID for guests', default=5002) argparser.add_argument('--dbname', help='DB name', default='zoe') argparser.add_argument('--dbuser', help='DB user', default='zoe') argparser.add_argument('--dbpass', help='DB password', default='zoe') argparser.add_argument('--dbhost', help='DB hostname', default='localhost') argparser.add_argument('--dbport', type=int, help='DB port', default=5432) opts = argparser.parse_args() if opts.debug: argparser.print_values() _conf = opts
def load_configuration(test_conf=None): global _conf if test_conf is None: argparser = ArgumentParser(description="Zoe Master - Container Analytics as a Service core component", default_config_files=config_paths, auto_env_var_prefix="ZOE_MASTER_", args_for_setting_config_path=["--config"], args_for_writing_out_config_file=["--write-config"]) argparser.add_argument('--debug', action='store_true', help='Enable debug output') argparser.add_argument('--swarm', help='Swarm/Docker API endpoint (ex.: zk://zk1:2181,zk2:2181 or http://swarm:2380)', default='http://localhost:2375') argparser.add_argument('--api-listen-uri', help='ZMQ API listen address', default='tcp://*:4850') argparser.add_argument('--deployment-name', help='name of this Zoe deployment', default='prod') argparser.add_argument('--influxdb-dbname', help='Name of the InfluxDB database to use for storing metrics', default='zoe') argparser.add_argument('--influxdb-url', help='URL of the InfluxDB service (ex. http://localhost:8086)', default='http://localhost:8086') argparser.add_argument('--influxdb-enable', action="store_true", help='Enable metric output toward influxDB') argparser.add_argument('--gelf-address', help='Enable Docker GELF log output to this destination (ex. udp://1.2.3.4:1234)', default='') argparser.add_argument('--workspace-base-path', help='Path where user workspaces will be created by Zoe. Must be visible at this path on all Swarm hosts.', default='/mnt/zoe-workspaces') argparser.add_argument('--overlay-network-name', help='Name of the Swarm overlay network Zoe should use', default='zoe') argparser.add_argument('--dbname', help='DB name', default='zoe') argparser.add_argument('--dbuser', help='DB user', default='zoe') argparser.add_argument('--dbpass', help='DB password', default='zoe') argparser.add_argument('--dbhost', help='DB hostname', default='localhost') argparser.add_argument('--dbport', type=int, help='DB port', default=5432) opts = argparser.parse_args() if opts.debug: argparser.print_values() _conf = opts else: _conf = test_conf
def load_configuration(test_conf=None): global _conf if test_conf is None: argparser = ArgumentParser(description="Zoe Scheduler - Container Analytics as a Service scheduling component", default_config_files=config_paths, auto_env_var_prefix="ZOE_SCHEDULER_", args_for_setting_config_path=["--config"], args_for_writing_out_config_file=["--write-config"]) argparser.add_argument('--debug', action='store_true', help='Enable debug output') argparser.add_argument('--swarm', help='Swarm/Docker API endpoint (ex.: zk://zk1:2181,zk2:2181 or http://swarm:2380)', default='http://localhost:2375') argparser.add_argument('--private-registry', help='Docker private registry address (ex.: 10.0.0.1:5000)', default='10.0.0.1:5000') argparser.add_argument('--state-dir', help='Directory where state checkpoints are saved', default='/var/lib/zoe') argparser.add_argument('--listen-address', help='REST API listen address', default='0.0.0.0') argparser.add_argument('--listen-port', help='REST API listen port', default='4850') argparser.add_argument('--zoeadmin-password', help='Password used to login as the master Zoe administrator', default='changeme') argparser.add_argument('--container-name-prefix', help='String prefixed to all container names generated by this instance of Zoe', default='prod') argparser.add_argument('--influxdb-dbname', help='Name of the InfluxDB database to use for storing metrics', default='zoe') argparser.add_argument('--influxdb-url', help='URL of the InfluxDB service (ex. http://localhost:8086)', default='http://localhost:8086') argparser.add_argument('--influxdb-enable', action="store_true", help='Enable metric output toward influxDB') argparser.add_argument('--passlib-rounds', type=int, help='Number of hashing rounds for passwords', default=60000) opts = argparser.parse_args() if opts.debug: argparser.print_values() _conf = opts else: _conf = test_conf
def load_configuration(test_conf=None): """Parses command line arguments.""" global _CONF if test_conf is None: argparser = ArgumentParser(description="Zoe - Container Analytics as a Service", default_config_files=_CONFIG_PATHS, auto_env_var_prefix="ZOE_", args_for_setting_config_path=["--config"], args_for_writing_out_config_file=["--write-config"]) # Common options argparser.add_argument('--debug', action='store_true', help='Enable debug output') argparser.add_argument('--swarm', help='Swarm/Docker API endpoint (ex.: zk://zk1:2181,zk2:2181 or http://swarm:2380)', default='http://localhost:2375') argparser.add_argument('--deployment-name', help='name of this Zoe deployment', default='prod') argparser.add_argument('--dbname', help='DB name', default='zoe') argparser.add_argument('--dbuser', help='DB user', default='zoe') argparser.add_argument('--dbpass', help='DB password', default='') argparser.add_argument('--dbhost', help='DB hostname', default='localhost') argparser.add_argument('--dbport', type=int, help='DB port', default=5432) # Master options argparser.add_argument('--api-listen-uri', help='ZMQ API listen address', default='tcp://*:4850') argparser.add_argument('--influxdb-dbname', help='Name of the InfluxDB database to use for storing metrics', default='zoe') argparser.add_argument('--influxdb-url', help='URL of the InfluxDB service (ex. http://localhost:8086)', default='http://localhost:8086') argparser.add_argument('--influxdb-enable', action="store_true", help='Enable metric output toward influxDB') argparser.add_argument('--gelf-address', help='Enable Docker GELF log output to this destination (ex. udp://1.2.3.4:1234)', default='') argparser.add_argument('--workspace-base-path', help='Path where user workspaces will be created by Zoe. Must be visible at this path on all Swarm hosts.', default='/mnt/zoe-workspaces') argparser.add_argument('--workspace-deployment-path', help='Path appended to the workspace path to distinguish this deployment. If unspecified is equal to the deployment name.', default='--default--') argparser.add_argument('--overlay-network-name', help='Name of the Swarm overlay network Zoe should use', default='zoe') # API options argparser.add_argument('--listen-address', type=str, help='Address to listen to for incoming connections', default="0.0.0.0") argparser.add_argument('--listen-port', type=int, help='Port to listen to for incoming connections', default=5001) argparser.add_argument('--master-url', help='URL of the Zoe master process', default='tcp://127.0.0.1:4850') # API auth options argparser.add_argument('--auth-type', help='Authentication type (text or ldap)', default='text') argparser.add_argument('--auth-file', help='Path to the CSV file containing user,pass,role lines for text authentication', default='zoepass.csv') argparser.add_argument('--ldap-server-uri', help='LDAP server to use for authentication', default='ldap://localhost') argparser.add_argument('--ldap-base-dn', help='LDAP base DN for users', default='ou=something,dc=any,dc=local') argparser.add_argument('--ldap-admin-gid', type=int, help='LDAP group ID for admins', default=5000) argparser.add_argument('--ldap-user-gid', type=int, help='LDAP group ID for users', default=5001) argparser.add_argument('--ldap-guest-gid', type=int, help='LDAP group ID for guests', default=5002) argparser.add_argument('--service-log-path', help='Save service logs in this directory, EXPERIMENTAL', default='') opts = argparser.parse_args() if opts.debug: argparser.print_values() if opts.workspace_deployment_path == '--default--': opts.workspace_deployment_path = opts.deployment_name _CONF = opts else: _CONF = test_conf
def load_configuration(test_conf=None): if test_conf is None: argparser = ArgumentParser( description="Zoe application tester - Container Analytics as a Service core component", default_config_files=config_paths, auto_env_var_prefix="ZOE_MASTER_", args_for_setting_config_path=["--config"], args_for_writing_out_config_file=["--write-config"], ) argparser.add_argument("--debug", action="store_true", help="Enable debug output") argparser.add_argument( "--swarm", help="Swarm/Docker API endpoint (ex.: zk://zk1:2181,zk2:2181 or http://swarm:2380)", default="http://localhost:2375", ) argparser.add_argument("--api-listen-uri", help="ZMQ API listen address", default="tcp://*:4850") argparser.add_argument("--deployment-name", help="name of this Zoe deployment", default="prod") argparser.add_argument( "--influxdb-dbname", help="Name of the InfluxDB database to use for storing metrics", default="zoe" ) argparser.add_argument( "--influxdb-url", help="URL of the InfluxDB service (ex. http://localhost:8086)", default="http://localhost:8086", ) argparser.add_argument("--influxdb-enable", action="store_true", help="Enable metric output toward influxDB") argparser.add_argument( "--gelf-address", help="Enable Docker GELF log output to this destination (ex. udp://1.2.3.4:1234)", default="", ) argparser.add_argument( "--workspace-base-path", help="Path where user workspaces will be created by Zoe. Must be visible at this path on all Swarm hosts.", default="/mnt/zoe-workspaces", ) argparser.add_argument( "--overlay-network-name", help="Name of the Swarm overlay network Zoe should use", default="zoe" ) argparser.add_argument("--dbname", help="DB name", default="zoe") argparser.add_argument("--dbuser", help="DB user", default="zoe") argparser.add_argument("--dbpass", help="DB password", default="zoe") argparser.add_argument("--dbhost", help="DB hostname", default="localhost") argparser.add_argument("--dbport", type=int, help="DB port", default=5432) argparser.add_argument("jsonfile", type=FileType("r"), help="Application description") opts = argparser.parse_args() opts.gelf_address = "" # For debugging we want to easily look at logs with 'docker logs' opts.influxdb_enable = False # don't send metrics for these test runs if opts.debug: argparser.print_values() return opts
def load_configuration(): """Load configuration from the command line.""" argparser = ArgumentParser(description="Zoe application tester - Container Analytics as a Service core component", default_config_files=CONFIG_PATHS, auto_env_var_prefix="ZOE_MASTER_", args_for_setting_config_path=["--config"], args_for_writing_out_config_file=["--write-config"]) argparser.add_argument('--debug', action='store_true', help='Enable debug output') argparser.add_argument('--swarm', help='Swarm/Docker API endpoint (ex.: zk://zk1:2181,zk2:2181 or http://swarm:2380)', default='http://localhost:2375') argparser.add_argument('--deployment-name', help='name of this Zoe deployment', default='prod') argparser.add_argument('--dbname', help='DB name', default='zoe') argparser.add_argument('--dbuser', help='DB user', default='zoe') argparser.add_argument('--dbpass', help='DB password', default='') argparser.add_argument('--dbhost', help='DB hostname', default='localhost') argparser.add_argument('--dbport', type=int, help='DB port', default=5432) # Master options argparser.add_argument('--api-listen-uri', help='ZMQ API listen address', default='tcp://*:4850') argparser.add_argument('--influxdb-dbname', help='Name of the InfluxDB database to use for storing metrics', default='zoe') argparser.add_argument('--influxdb-url', help='URL of the InfluxDB service (ex. http://localhost:8086)', default='http://localhost:8086') argparser.add_argument('--influxdb-enable', action="store_true", help='Enable metric output toward influxDB') argparser.add_argument('--gelf-address', help='Enable Docker GELF log output to this destination (ex. udp://1.2.3.4:1234)', default='') argparser.add_argument('--workspace-base-path', help='Path where user workspaces will be created by Zoe. Must be visible at this path on all Swarm hosts.', default='/mnt/zoe-workspaces') argparser.add_argument('--overlay-network-name', help='Name of the Swarm overlay network Zoe should use', default='zoe') # API options argparser.add_argument('--listen-address', type=str, help='Address to listen to for incoming connections', default="0.0.0.0") argparser.add_argument('--listen-port', type=int, help='Port to listen to for incoming connections', default=5001) argparser.add_argument('--master-url', help='URL of the Zoe master process', default='tcp://127.0.0.1:4850') # API auth options argparser.add_argument('--auth-type', help='Authentication type (text or ldap)', default='text') argparser.add_argument('--auth-file', help='Path to the CSV file containing user,pass,role lines for text authentication', default='zoepass.csv') argparser.add_argument('--ldap-server-uri', help='LDAP server to use for authentication', default='ldap://localhost') argparser.add_argument('--ldap-base-dn', help='LDAP base DN for users', default='ou=something,dc=any,dc=local') argparser.add_argument('--ldap-admin-gid', type=int, help='LDAP group ID for admins', default=5000) argparser.add_argument('--ldap-user-gid', type=int, help='LDAP group ID for users', default=5001) argparser.add_argument('--ldap-guest-gid', type=int, help='LDAP group ID for guests', default=5002) argparser.add_argument('jsonfile', type=FileType("r"), help='Application description') opts = argparser.parse_args() opts.gelf_address = '' # For debugging we want to easily look at logs with 'docker logs' opts.influxdb_enable = False # don't send metrics for these test runs opts.deployment_name = 'zapp-test' if opts.debug: argparser.print_values() return opts
def load_configuration(test_conf=None): global _conf if test_conf is None: argparser = ArgumentParser( description= "Zoe Observer - Container Analytics as a Service Swarm Observer component", default_config_files=config_paths, auto_env_var_prefix="ZOE_OBSERVER_", args_for_setting_config_path=["--config"], args_for_writing_out_config_file=["--write-config"]) argparser.add_argument('--debug', action='store_true', help='Enable debug output') argparser.add_argument( '--swarm', help= 'Swarm/Docker API endpoint (ex.: zk://zk1:2181,zk2:2181 or http://swarm:2380)', default='http://localhost:2375') argparser.add_argument('--master-url', help='URL of the master\'s REST API', default='http://127.0.0.1:4850') argparser.add_argument( '--zoeadmin-password', help='Password used to login as the master Zoe administrator', default='changeme') argparser.add_argument( '--spark-activity-timeout', help= 'Number of seconds of inactivity (no jobs run) before a Spark cluster is terminated', type=int, default=18000) argparser.add_argument('--loop-time', help='Time between consecutive check', type=int, default=300) opts = argparser.parse_args() if opts.debug: argparser.print_values() _conf = opts info_api = ZoeInfoAPI(opts.master_url, 'zoeadmin', opts.zoeadmin_password) info = info_api.info() opts.deployment_name = info['deployment_name'] # FIXME: check compatibility for API versions else: _conf = test_conf
def load_configuration(): global _conf argparser = ArgumentParser(description="Zoe Web interface: Container Analytics as a Service web component", default_config_files=config_paths, auto_env_var_prefix="ZOE_WEB_", args_for_setting_config_path=["--config"], args_for_writing_out_config_file=["--write-config"]) argparser.add_argument('--debug', action='store_true', help='Enable debug output') argparser.add_argument('--listen-address', type=str, help='Address to listen to for incoming connections', default="0.0.0.0") argparser.add_argument('--listen-port', type=int, help='Port to listen to for incoming connections', default=5001) argparser.add_argument('--zoe-url', help='URL of the Zoe scheduler process', default='http://127.0.0.1:4850') argparser.add_argument('--zoe-admin-user', help='Admin-level user in Zoe', default='zoeadmin') argparser.add_argument('--zoe-admin-pass', help='Password for the admin-level user in Zoe', default='changeme') argparser.add_argument('--cookie-secret', help='key used to encrypt cookies', default="hr4h3H'kmn F8fz/;CJN5a!") opts = argparser.parse_args() if opts.debug: argparser.print_values() _conf = opts
def load_configuration(test_conf=None): """Parses command line arguments.""" global _CONF if test_conf is None: argparser = ArgumentParser( description="Zoe - Container Analytics as a Service", default_config_files=_CONFIG_PATHS, auto_env_var_prefix="ZOE_", args_for_setting_config_path=["--config"], args_for_writing_out_config_file=["--write-config"]) # Common options argparser.add_argument('--debug', action='store_true', help='Enable debug output') argparser.add_argument('--deployment-name', help='name of this Zoe deployment', default='prod') argparser.add_argument('--dbname', help='DB name', default='zoe') argparser.add_argument('--dbuser', help='DB user', default='zoe') argparser.add_argument('--dbpass', help='DB password', default='') argparser.add_argument('--dbhost', help='DB hostname', default='localhost') argparser.add_argument('--dbport', type=int, help='DB port', default=5432) # Master options argparser.add_argument('--api-listen-uri', help='ZMQ API listen address', default='tcp://*:4850') argparser.add_argument('--kairosdb-enable', action="store_true", help='Enable usage metric input from KairosDB') argparser.add_argument( '--kairosdb-url', help='URL of the KairosDB service (ex. http://localhost:8090)', default='http://localhost:8090') argparser.add_argument('--influxdb-enable', action="store_true", help='Enable usage metric input from InfluxDB') argparser.add_argument( '--influxdb-url', help='URL of the InfluxDB service (ex. http://localhost:8086)', default='http://localhost:8086') argparser.add_argument( '--workspace-base-path', help= 'Base directory where user workspaces will be created. Must be visible at this path on all hosts.', default='/mnt/zoe-workspaces') argparser.add_argument( '--workspace-deployment-path', help= 'Path appended to the workspace path to distinguish this deployment. If unspecified is equal to the deployment name.', default='--default--') argparser.add_argument( '--overlay-network-name', help='Name of the Swarm overlay network Zoe should use', default='zoe') # Service logs argparser.add_argument( '--gelf-address', help= 'Enable Docker GELF log output to this destination (ex. udp://1.2.3.4:7896)', default='') argparser.add_argument( '--gelf-listener', type=int, help= 'Enable the internal GELF log listener on this port, set to 0 to disable', default='7896') argparser.add_argument( '--service-logs-base-path', help= 'Path where service logs coming from the GELF listener will be stored', default='/var/lib/zoe/service-logs') argparser.add_argument( '--log-url', help= 'URL where log files are available via HTTP as /deployment-name/execution-id/service-name.txt', default='https://cloud-platform.eurecom.fr/zoe-logs/') argparser.add_argument( '--log-use-websockets', help= 'Use websockets or standard ajax with an external web server for serving service logs', action="store_true") # API options argparser.add_argument( '--listen-address', help='Address to listen to for incoming connections', default="0.0.0.0") argparser.add_argument( '--listen-port', type=int, help='Port to listen to for incoming connections', default=5001) argparser.add_argument('--master-url', help='URL of the Zoe master process', default='tcp://127.0.0.1:4850') argparser.add_argument('--cookie-secret', help='secret used to encrypt cookies', default='changeme') argparser.add_argument( '--auth-file', help= 'Path to the CSV file containing user,pass,role lines for text authentication', default='zoepass.csv') argparser.add_argument('--ldap-server-uri', help='LDAP server to use for authentication', default='ldap://localhost') argparser.add_argument('--ldap-bind-user', help='Full LDAP user to use for binding', default='ou=something,dc=any,dc=local') argparser.add_argument('--ldap-bind-password', help='Password for the bind user', default='mysecretpassword') argparser.add_argument('--ldap-base-dn', help='LDAP base DN for users', default='ou=something,dc=any,dc=local') argparser.add_argument( '--oauth-client-id', help='OAuth2 client ID as generated by your identity provider') argparser.add_argument( '--oauth-client-secret', help='OAuth2 client secret as generated by your identity provider') argparser.add_argument('--oauth-redirect-uri', help='Full URL of the Zoe API OAuth callback', default='https://my.zoe.com/api/v7/user/oauth') argparser.add_argument( '--oauth-role', help='Role to assign to new users authenticated via OAuth2', default='user') argparser.add_argument( '--oauth-quota', help='Quota to assign to new users authenticated via OAuth2', default='default') argparser.add_argument( '--oauth-create-workspace-script', help= 'Full path to a script that creates user workspace, Zoe will call using sudo and pass username and fs_id as arguments', default='/usr/local/bin/zoe_create_workspace.sh') argparser.add_argument( '--fs-group-id', type=int, help='Group ID to use for all Zoe users in workspace files', default='5001') # Proxy options argparser.add_argument('--proxy-path', help='Proxy base path', default='127.0.0.1') argparser.add_argument( '--reverse-proxy-path', help='Base path in case Zoe is behind a reverse proxy under a path', default='') argparser.add_argument( '--websocket_base', help= 'Base URL for websocket connections, you need to change it only when running Zoe behind a reverse proxy', default='ws://{{ server_address }}') argparser.add_argument( '--traefik-zk-ips', help='ZooKeeper address storing dynamic configuration for træfik', default=None) argparser.add_argument( '--traefik-base-url', help='Base path used in reverse proxy URLs generated for træfik', default='/zoe/proxy/') # Scheduler argparser.add_argument( '--scheduler-class', help='Scheduler class to use for scheduling ZApps', choices=['ZoeElasticScheduler'], default='ZoeElasticScheduler') argparser.add_argument( '--scheduler-policy', help='Scheduler policy to use for scheduling ZApps', choices=['FIFO', 'SIZE', 'DYNSIZE'], default='FIFO') argparser.add_argument('--placement-policy', help='Placement policy', choices=['waterfill', 'random', 'average'], default='average') argparser.add_argument('--backend', choices=['Kubernetes', 'DockerEngine'], default='DockerEngine', help='Which backend to enable') # Docker Engine backend options argparser.add_argument( '--backend-docker-config-file', help='Location of the Docker Engine config file', default='docker.conf') # Kubernetes backend argparser.add_argument('--kube-config-file', help='Kubernetes configuration file', default='/opt/zoe/kube.conf') argparser.add_argument('--kube-namespace', help='The namespace that Zoe operates on', default='default') # Kubernetes Ingress Controller (NGINX) argparser.add_argument( '--kube-ingress-controller', help= 'Kubernetes Ingress controller is used. Impacts the endpoint handling in Zoe', default='no') argparser.add_argument( '--kube-ingress-url-suffix', help= 'URL suffix, for subdomain based ingress reverse proxy routing. Impacts endpoint URL creation', default='platform.atosdigital.nl') # other options argparser.add_argument('--zapp-shop-path', help='Path where ZApp folders are stored', default='/var/lib/zoe-apps') argparser.add_argument('--log-file', help='output logs to a file', default='stderr') argparser.add_argument( '--max-core-limit', help='Maximum amount of cores users are able to reserve', type=int, default=16) argparser.add_argument( '--max-memory-limit', help='Maximum amount of memory services can use (in GiB)', type=int, default=64) argparser.add_argument( '--additional-volumes', help= 'Additional volumes to mount in services filesystems. (ex: /mnt/data:data,/mnt/data_n:data_n)', default='') argparser.add_argument('--enable-plots', action='store_true', help='Enable generation of URLs to Grafana') argparser.add_argument( '--enable-cephfs-quotas', action='store_true', help='Enable reading cephfs quotas (needs sudo configuration)') argparser.add_argument( '--eurecom', action='store_true', help='Enable options specific to Eurecom\'s deployment') opts = argparser.parse_args() if opts.debug: argparser.print_values() if opts.workspace_deployment_path == '--default--': opts.workspace_deployment_path = opts.deployment_name if len(opts.additional_volumes) > 0: vols = str(opts.additional_volumes).split(',') opts.additional_volumes = [v.split(':') for v in vols] log.info('Additional volumes:') for path, mountpoint in opts.additional_volumes: log.info(' - {} -> {}'.format(path, mountpoint)) else: opts.additional_volumes = [] _CONF = opts else: _CONF = test_conf
def load_configuration(test_conf=None): """Parses command line arguments.""" global _CONF if test_conf is None: argparser = ArgumentParser(description="Zoe - Container Analytics as a Service", default_config_files=_CONFIG_PATHS, auto_env_var_prefix="ZOE_", args_for_setting_config_path=["--config"], args_for_writing_out_config_file=["--write-config"]) # Common options argparser.add_argument('--debug', action='store_true', help='Enable debug output') argparser.add_argument('--deployment-name', help='name of this Zoe deployment', default='prod') argparser.add_argument('--dbname', help='DB name', default='zoe') argparser.add_argument('--dbuser', help='DB user', default='zoe') argparser.add_argument('--dbpass', help='DB password', default='') argparser.add_argument('--dbhost', help='DB hostname', default='localhost') argparser.add_argument('--dbport', type=int, help='DB port', default=5432) # Master options argparser.add_argument('--api-listen-uri', help='ZMQ API listen address', default='tcp://*:4850') argparser.add_argument('--kairosdb-enable', action="store_true", help='Enable usage metric input from KairosDB') argparser.add_argument('--kairosdb-url', help='URL of the KairosDB service (ex. http://localhost:8086)', default='http://localhost:8090') argparser.add_argument('--workspace-base-path', help='Base directory where user workspaces will be created. Must be visible at this path on all hosts.', default='/mnt/zoe-workspaces') argparser.add_argument('--workspace-deployment-path', help='Path appended to the workspace path to distinguish this deployment. If unspecified is equal to the deployment name.', default='--default--') argparser.add_argument('--overlay-network-name', help='Name of the Swarm overlay network Zoe should use', default='zoe') # Service logs argparser.add_argument('--gelf-address', help='Enable Docker GELF log output to this destination (ex. udp://1.2.3.4:7896)', default='') argparser.add_argument('--gelf-listener', type=int, help='Enable the internal GELF log listener on this port, set to 0 to disable', default='7896') argparser.add_argument('--service-logs-base-path', help='Path where service logs coming from the GELF listener will be stored', default='/var/lib/zoe/service-logs') # API options argparser.add_argument('--listen-address', type=str, help='Address to listen to for incoming connections', default="0.0.0.0") argparser.add_argument('--listen-port', type=int, help='Port to listen to for incoming connections', default=5001) argparser.add_argument('--master-url', help='URL of the Zoe master process', default='tcp://127.0.0.1:4850') argparser.add_argument('--cookie-secret', help='secret used to encrypt cookies', default='changeme') # API auth options argparser.add_argument('--auth-type', help='Authentication type (text, ldap or ldapsasl)', default='text') argparser.add_argument('--auth-file', help='Path to the CSV file containing user,pass,role lines for text authentication', default='zoepass.csv') argparser.add_argument('--ldap-server-uri', help='LDAP server to use for authentication', default='ldap://localhost') argparser.add_argument('--ldap-bind-user', help='Full LDAP user to use for binding', default='ou=something,dc=any,dc=local') argparser.add_argument('--ldap-bind-password', help='Password for the bind user', default='mysecretpassword') argparser.add_argument('--ldap-base-dn', help='LDAP base DN for users', default='ou=something,dc=any,dc=local') argparser.add_argument('--ldap-admin-gid', help='LDAP group ID for admins', default='5000') argparser.add_argument('--ldap-user-gid', help='LDAP group ID for users', default='5001') argparser.add_argument('--ldap-guest-gid', help='LDAP group ID for guests', default='5002') argparser.add_argument('--ldap-group-name', help='LDAP user field containing group names/IDs', default='gidNumber') # Proxy options argparser.add_argument('--proxy-path', help='Proxy base path', default='127.0.0.1') # Scheduler argparser.add_argument('--scheduler-class', help='Scheduler class to use for scheduling ZApps', choices=['ZoeSimpleScheduler', 'ZoeElasticScheduler'], default='ZoeElasticScheduler') argparser.add_argument('--scheduler-policy', help='Scheduler policy to use for scheduling ZApps', choices=['FIFO', 'SIZE'], default='FIFO') argparser.add_argument('--backend', choices=['Swarm', 'Kubernetes', 'DockerEngine'], default='DockerEngine', help='Which backend to enable') # Docker Swarm backend options argparser.add_argument('--backend-swarm-url', help='Swarm/Docker API endpoint (ex.: zk://zk1:2181,zk2:2181 or http://swarm:2380)', default='http://localhost:2375') argparser.add_argument('--backend-swarm-zk-path', help='Swarm/Docker optional ZooKeeper path for Swarm Znodes', default='/docker') argparser.add_argument('--backend-swarm-tls-cert', help='Docker TLS certificate file', default='cert.pem') argparser.add_argument('--backend-swarm-tls-key', help='Docker TLS private key file', default='key.pem') argparser.add_argument('--backend-swarm-tls-ca', help='Docker TLS CA certificate file', default='ca.pem') # Docker Engine backend options argparser.add_argument('--backend-docker-config-file', help='Location of the Docker Engine config file', default='docker.conf') # Kubernetes backend argparser.add_argument('--kube-config-file', help='Kubernetes configuration file', default='/opt/zoe/kube.conf') argparser.add_argument('--kube-namespace', help='The namespace that Zoe operates on', default='default') # other options argparser.add_argument('--zapp-shop-path', help='Path where ZApp folders are stored', default='/var/lib/zoe-apps') argparser.add_argument('--log-file', help='output logs to a file', default='stderr') argparser.add_argument('--max-core-limit', help='Maximum amount of cores users are able to reserve', type=int, default=16) argparser.add_argument('--max-memory-limit', help='Maximum amount of memory services can use (in GiB)', type=int, default=64) argparser.add_argument('--no-user-edit-limits-web', action='store_true', help='Disable editing ZApp resource limits from the web interface (only admins will able to)') argparser.add_argument('--additional-volumes', help='Additional volumes to mount in services filesystems. (ex: /mnt/data:data,/mnt/data_n:data_n)', default='') opts = argparser.parse_args() if opts.debug: argparser.print_values() if opts.workspace_deployment_path == '--default--': opts.workspace_deployment_path = opts.deployment_name if len(opts.additional_volumes) > 0: vols = str(opts.additional_volumes).split(',') opts.additional_volumes = [v.split(':') for v in vols] log.info('Additional volumes:') for path, mountpoint in opts.additional_volumes: log.info(' - {} -> {}'.format(path, mountpoint)) else: opts.additional_volumes = [] _CONF = opts else: _CONF = test_conf
def load_configuration(): global _conf argparser = ArgumentParser( description= "Zoe Web interface: Container Analytics as a Service web component", default_config_files=config_paths, auto_env_var_prefix="ZOE_WEB_", args_for_setting_config_path=["--config"], args_for_writing_out_config_file=["--write-config"]) argparser.add_argument('--debug', action='store_true', help='Enable debug output') argparser.add_argument( '--listen-address', type=str, help='Address to listen to for incoming connections', default="0.0.0.0") argparser.add_argument('--listen-port', type=int, help='Port to listen to for incoming connections', default=5001) argparser.add_argument('--master-url', help='URL of the Zoe master process', default='tcp://127.0.0.1:4850') argparser.add_argument('--deployment-name', help='name of this Zoe deployment', default='prod') # argparser.add_argument('--cookie-secret', help='key used to encrypt cookies', default="hr4h3H'kmn F8fz/;CJN5a!") argparser.add_argument('--ldap-server-uri', help='LDAP server to use for authentication', default='ldap://localhost') argparser.add_argument('--ldap-base-dn', help='LDAP base DN for users', default='ou=something,dc=any,dc=local') argparser.add_argument('--ldap-bind-user', help='LDAP user to bind as for user lookup', default='cn=guest,dc=bigfoot,dc=eurecom,dc=fr') argparser.add_argument('--ldap-bind-password', help='LDAP user password', default='notsosecret') argparser.add_argument('--ldap-admin-gid', type=int, help='LDAP group ID for admins', default=5000) argparser.add_argument('--ldap-user-gid', type=int, help='LDAP group ID for users', default=5001) argparser.add_argument('--ldap-guest-gid', type=int, help='LDAP group ID for guests', default=5002) argparser.add_argument('--dbname', help='DB name', default='zoe') argparser.add_argument('--dbuser', help='DB user', default='zoe') argparser.add_argument('--dbpass', help='DB password', default='zoe') argparser.add_argument('--dbhost', help='DB hostname', default='localhost') argparser.add_argument('--dbport', type=int, help='DB port', default=5432) opts = argparser.parse_args() if opts.debug: argparser.print_values() _conf = opts