+ _wait_until_port_listens(nginxconf['CONTROLLERSSLPORT'])
+
+def setup_config():
+ rails_api_port = find_available_port()
+ controller_port = find_available_port()
+ controller_external_port = find_available_port()
+ websocket_port = find_available_port()
+ websocket_external_port = find_available_port()
+ workbench1_port = find_available_port()
+ workbench1_external_port = find_available_port()
+ git_httpd_port = find_available_port()
+ git_httpd_external_port = find_available_port()
+ health_httpd_port = find_available_port()
+ health_httpd_external_port = find_available_port()
+ keepproxy_port = find_available_port()
+ keepproxy_external_port = find_available_port()
+ keepstore_ports = sorted([str(find_available_port()) for _ in range(0,4)])
+ keep_web_port = find_available_port()
+ keep_web_external_port = find_available_port()
+ keep_web_dl_port = find_available_port()
+ keep_web_dl_external_port = find_available_port()
+
+ configsrc = os.environ.get("CONFIGSRC", None)
+ if configsrc:
+ clusterconf = os.path.join(configsrc, "config.yml")
+ print("Getting config from %s" % clusterconf, file=sys.stderr)
+ pgconnection = yaml.safe_load(open(clusterconf))["Clusters"]["zzzzz"]["PostgreSQL"]["Connection"]
+ else:
+ # assume "arvados-server install -type test" has set up the
+ # conventional db credentials
+ pgconnection = {
+ "client_encoding": "utf8",
+ "host": "localhost",
+ "dbname": "arvados_test",
+ "user": "arvados",
+ "password": "insecure_arvados_test",
+ }
+
+ localhost = "127.0.0.1"
+ services = {
+ "RailsAPI": {
+ "InternalURLs": {
+ "https://%s:%s"%(localhost, rails_api_port): {},
+ },
+ },
+ "Controller": {
+ "ExternalURL": "https://%s:%s" % (localhost, controller_external_port),
+ "InternalURLs": {
+ "http://%s:%s"%(localhost, controller_port): {},
+ },
+ },
+ "Websocket": {
+ "ExternalURL": "wss://%s:%s/websocket" % (localhost, websocket_external_port),
+ "InternalURLs": {
+ "http://%s:%s"%(localhost, websocket_port): {},
+ },
+ },
+ "Workbench1": {
+ "ExternalURL": "https://%s:%s/" % (localhost, workbench1_external_port),
+ "InternalURLs": {
+ "http://%s:%s"%(localhost, workbench1_port): {},
+ },
+ },
+ "GitHTTP": {
+ "ExternalURL": "https://%s:%s" % (localhost, git_httpd_external_port),
+ "InternalURLs": {
+ "http://%s:%s"%(localhost, git_httpd_port): {}
+ },
+ },
+ "Health": {
+ "ExternalURL": "https://%s:%s" % (localhost, health_httpd_external_port),
+ "InternalURLs": {
+ "http://%s:%s"%(localhost, health_httpd_port): {}
+ },
+ },
+ "Keepstore": {
+ "InternalURLs": {
+ "http://%s:%s"%(localhost, port): {} for port in keepstore_ports
+ },
+ },
+ "Keepproxy": {
+ "ExternalURL": "https://%s:%s" % (localhost, keepproxy_external_port),
+ "InternalURLs": {
+ "http://%s:%s"%(localhost, keepproxy_port): {},
+ },
+ },
+ "WebDAV": {
+ "ExternalURL": "https://%s:%s" % (localhost, keep_web_external_port),
+ "InternalURLs": {
+ "http://%s:%s"%(localhost, keep_web_port): {},
+ },
+ },
+ "WebDAVDownload": {
+ "ExternalURL": "https://%s:%s" % (localhost, keep_web_dl_external_port),
+ "InternalURLs": {
+ "http://%s:%s"%(localhost, keep_web_dl_port): {},
+ },
+ },
+ }
+
+ config = {
+ "Clusters": {
+ "zzzzz": {
+ "ManagementToken": "e687950a23c3a9bceec28c6223a06c79",
+ "SystemRootToken": auth_token('system_user'),
+ "API": {
+ "RequestTimeout": "30s",
+ },
+ "Login": {
+ "Test": {
+ "Enable": True,
+ "Users": {
+ "alice": {
+ "Email": "alice@example.com",
+ "Password": "xyzzy"
+ }
+ }
+ },
+ },
+ "SystemLogs": {
+ "LogLevel": ('info' if os.environ.get('ARVADOS_DEBUG', '') in ['','0'] else 'debug'),
+ },
+ "PostgreSQL": {
+ "Connection": pgconnection,
+ },
+ "TLS": {
+ "Insecure": True,
+ },
+ "Services": services,
+ "Users": {
+ "AnonymousUserToken": auth_token('anonymous'),
+ "UserProfileNotificationAddress": "arvados@example.com",
+ },
+ "Collections": {
+ "CollectionVersioning": True,
+ "BlobSigningKey": "zfhgfenhffzltr9dixws36j1yhksjoll2grmku38mi7yxd66h5j4q9w4jzanezacp8s6q0ro3hxakfye02152hncy6zml2ed0uc",
+ "TrustAllContent": False,
+ "ForwardSlashNameSubstitution": "/",
+ "TrashSweepInterval": "-1s",
+ },
+ "Git": {
+ "Repositories": os.path.join(SERVICES_SRC_DIR, 'api', 'tmp', 'git', 'test'),
+ },
+ "Containers": {
+ "JobsAPI": {
+ "GitInternalDir": os.path.join(SERVICES_SRC_DIR, 'api', 'tmp', 'internal.git'),
+ },
+ "SupportedDockerImageFormats": {"v1": {}},
+ "ShellAccess": {
+ "Admin": True,
+ "User": True,
+ },
+ },
+ "Volumes": {
+ "zzzzz-nyw5e-%015d"%n: {
+ "AccessViaHosts": {
+ "http://%s:%s" % (localhost, keepstore_ports[n]): {},
+ },
+ "Driver": "Directory",
+ "DriverParameters": {
+ "Root": os.path.join(TEST_TMPDIR, "keep%d.data"%n),
+ },
+ } for n in range(len(keepstore_ports))
+ },
+ },
+ },
+ }
+
+ conf = os.path.join(TEST_TMPDIR, 'arvados.yml')
+ with open(conf, 'w') as f:
+ yaml.safe_dump(config, f)
+
+ ex = "export ARVADOS_CONFIG="+conf
+ print(ex)
+