@@ -5,11 +5,13 @@ config.define_string("default-pull-policy", args=False, usage="Pull policy to us
55config .define_string ("host-ip" , args = False , usage = "IP Address of the host to enable redirection to local services" )
66config .define_string ("hostname" , args = False , usage = "Accessible name of the host to enable redirection to local services" )
77config .define_string ("faf-data-dir" , args = False , usage = "Directory where the FAF Data lives normally C:/ProgramData/FAForever on Windows or ~/.faforever on Linux" )
8+ config .define_string ("base-domain" , args = False , usage = "Base Domain to use for all faf services. Defaults to faforever.localhost" )
89config .define_string_list ("local-services" , args = False , usage = "Names of services that you intend to run locally" )
910cfg = config .parse ()
1011windows_bash_path = cfg .get ("windows-bash-path" , "C:\\ Program Files\\ Git\\ bin\\ bash.exe" )
1112host_ip = cfg .get ("host-ip" , "" )
1213local_services = cfg .get ("local-services" , [])
14+ base_domain = cfg .get ("base-domain" , "faforever.localhost" )
1315
1416data_relative_path = ".local-data"
1517if os .name == "nt" :
@@ -99,6 +101,7 @@ def helm_with_build_cache(chart, namespace="", values=[], set=[], specifier = ""
99101 command .extend (["--namespace" , namespace ])
100102 command .extend (value_flags )
101103 command .extend (set_flags )
104+ command .extend (["--set" , "baseDomain=" + base_domain ])
102105
103106 deps = [chart ]
104107 deps .extend (values )
@@ -215,7 +218,7 @@ def proxy_local_service_if_set(service_name, service_chart, service_namespace, a
215218 k8s_yaml (service_proxy_yaml )
216219 for object in decode_yaml_stream (service_proxy_yaml ):
217220 service_objects .append (object ["metadata" ]["name" ] + ":" + object ["kind" ].lower ())
218- k8s_resource (new_name = service_name , objects = service_objects , resource_deps = all_service_deps , labels = user_service_labels , links = user_service_links , pod_readiness = "ignore" )
221+ k8s_resource (new_name = service_name , objects = service_objects , resource_deps = all_service_deps , labels = service_labels , links = user_service_links , pod_readiness = "ignore" )
219222 else :
220223 if service_name == "faf-icebreaker" :
221224 service_yaml = remove_init_container (service_yaml )
@@ -257,7 +260,7 @@ for object in decode_yaml_stream(storage_yaml):
257260
258261k8s_resource (new_name = "volumes" , objects = volume_identifiers , labels = ["core" ], trigger_mode = TRIGGER_MODE_MANUAL )
259262
260- traefik_yaml = helm_with_build_cache ("cluster/traefik" , values = ["config/local.yaml" , "cluster/traefik/values-local.yaml" ], namespace = "traefik" )
263+ traefik_yaml = helm_with_build_cache ("cluster/traefik" , values = ["config/local.yaml" , "cluster/traefik/values-local.yaml" ], set = [ "traefik.ingressRoute.dashboard.matchRule='Host(`traefik.{}`)'" . format ( base_domain )], namespace = "traefik" )
261264k8s_yaml (traefik_yaml )
262265
263266traefik_identifiers = []
@@ -325,23 +328,23 @@ k8s_resource(workload="ergochat", objects=["ergochat-webirc:ingressroute"], reso
325328
326329k8s_yaml (helm_with_build_cache ("apps/wordpress" , namespace = "faf-apps" , values = ["config/local.yaml" ]))
327330k8s_resource (new_name = "wordpress-config" , objects = ["wordpress:configmap" , "wordpress:secret" ], labels = ["website" ])
328- k8s_resource (workload = "wordpress" , objects = ["wordpress:ingressroute" ], resource_deps = ["traefik" ], labels = ["website" ], links = [link ("http://direct.localhost" , "FAF Wordpress" )])
331+ k8s_resource (workload = "wordpress" , objects = ["wordpress:ingressroute" ], resource_deps = ["traefik" ], labels = ["website" ], links = [link ("http://direct.{}" . format ( base_domain ) , "FAF Wordpress" )])
329332
330333k8s_yaml (helm_with_build_cache ("apps/wikijs" , namespace = "faf-apps" , values = ["config/local.yaml" ]))
331334k8s_resource (new_name = "wikijs-config" , objects = ["wikijs:configmap" , "wikijs:secret" , "wikijs-sso:configmap" ], labels = ["wiki" ])
332- k8s_resource (workload = "wikijs" , objects = ["wikijs:ingressroute" ], resource_deps = ["traefik" ] + postgres_setup_resources , labels = ["wiki" ], links = [link ("http://wiki.localhost" , "FAF Wiki" )])
335+ k8s_resource (workload = "wikijs" , objects = ["wikijs:ingressroute" ], resource_deps = ["traefik" ] + postgres_setup_resources , labels = ["wiki" ], links = [link ("http://wiki.{}" . format ( base_domain ) , "FAF Wiki" )])
333336
334337k8s_yaml (helm_with_build_cache ("apps/nodebb" , namespace = "faf-apps" , values = ["config/local.yaml" ]))
335338k8s_resource (new_name = "nodebb-config" , objects = ["nodebb:configmap" , "nodebb:secret" ], labels = ["forum" ])
336- k8s_resource (workload = "nodebb" , objects = ["nodebb:ingressroute" ], resource_deps = ["traefik" ] + mongodb_setup_resources , labels = ["forum" ], links = [link ("http://forum.localhost" , "FAF Forum" )])
339+ k8s_resource (workload = "nodebb" , objects = ["nodebb:ingressroute" ], resource_deps = ["traefik" ] + mongodb_setup_resources , labels = ["forum" ], links = [link ("http://forum.{}" . format ( base_domain ) , "FAF Forum" )])
337340
338341k8s_yaml (keep_objects_of_kind (helm_with_build_cache ("apps/debezium" , namespace = "faf-apps" , values = ["config/local.yaml" ]), kinds = ["ConfigMap" , "Secret" ]))
339342k8s_resource (new_name = "debezium-config" , objects = ["debezium:configmap" , "debezium:secret" ], labels = ["database" ])
340343
341344hydra_yaml = helm_with_build_cache ("apps/ory-hydra" , namespace = "faf-apps" , values = ["config/local.yaml" ])
342345hydra_client_create_yaml , hydra_resources_yaml = filter_yaml (hydra_yaml , {"app" : "ory-hydra-create-clients" })
343346_ , hydra_resources_yaml = filter_yaml (hydra_resources_yaml , {"app" : "ory-hydra-janitor" })
344- hydra_resources_yaml = patch_config (hydra_resources_yaml , "ory-hydra" , {"URLS_SELF_ISSUER" : "http://ory-hydra:4444" , "URLS_SELF_PUBLIC" : "http://hydra.localhost" , "URLS_LOGIN" : "http://user.localhost /oauth2/login" , "URLS_CONSENT" : "http://user.localhost /oauth2/consent" , "DEV" : "true" })
347+ hydra_resources_yaml = patch_config (hydra_resources_yaml , "ory-hydra" , {"URLS_SELF_ISSUER" : "http://ory-hydra:4444" , "URLS_SELF_PUBLIC" : "http://hydra.{}" . format ( base_domain ) , "URLS_LOGIN" : "http://user.{} /oauth2/login" . format ( base_domain ) , "URLS_CONSENT" : "http://user.{} /oauth2/consent" . format ( base_domain ) , "DEV" : "true" })
345348k8s_yaml (hydra_resources_yaml )
346349k8s_yaml (hydra_client_create_yaml )
347350k8s_resource (new_name = "ory-hydra-config" , objects = ["ory-hydra:configmap" , "ory-hydra:secret" ], labels = ["hydra" ])
@@ -358,24 +361,24 @@ k8s_resource(new_name="faf-policy-server-config", objects=["faf-policy-server:co
358361
359362# k8s_yaml(helm_with_build_cache("apps/faf-content", namespace="faf-apps", values=["config/local.yaml"]))
360363# k8s_resource(new_name="faf-content-config", objects=["faf-content:configmap"], labels=["content"])
361- # k8s_resource(workload="faf-content", objects=["faf-content:ingressroute", "cors:middleware", "redirect-replay-subdomain:middleware"], resource_deps=["traefik"], labels=["content"], links=[link("http://content.localhost" , "FAForever Content")])
364+ # k8s_resource(workload="faf-content", objects=["faf-content:ingressroute", "cors:middleware", "redirect-replay-subdomain:middleware"], resource_deps=["traefik"], labels=["content"], links=[link("http://content.{}".format(base_domain) , "FAForever Content")])
362365
363366user_service_deps = ["faf-db-migrations" , "ory-hydra" ]
364367user_service_labels = ["user" ]
365- user_service_links = [link ("http://user.localhost /register" , "User Service Registration" )]
366- user_service_patch = {"HYDRA_TOKEN_ISSUER" : "http://ory-hydra:4444" , "HYDRA_JWKS_URL" : "http://ory-hydra:4444/.well-known/jwks.json" , "LOBBY_URL" :"ws://ws.localhost" , "REPLAY_URL" :"ws://replay-ws.localhost" }
368+ user_service_links = [link ("http://user.{} /register" . format ( base_domain ) , "User Service Registration" )]
369+ user_service_patch = {"HYDRA_TOKEN_ISSUER" : "http://ory-hydra:4444" , "HYDRA_JWKS_URL" : "http://ory-hydra:4444/.well-known/jwks.json" , "LOBBY_URL" :"ws://ws.{}" . format ( base_domain ) , "REPLAY_URL" :"ws://replay-ws.{}" . format ( base_domain ) }
367370proxy_local_service_if_set (service_name = "faf-user-service" , service_chart = "apps/faf-user-service" , service_namespace = "faf-apps" , service_deps = user_service_deps , service_labels = user_service_labels , service_links = user_service_links , config_patch = user_service_patch )
368371
369372website_deps = ["wordpress" ]
370373website_labels = ["website" ]
371- website_links = [link ("http://www.localhost" , "FAForever Website" )]
372- website_patch = {"OAUTH_URL" : "http://ory-hydra:4444" , "OAUTH_PUBLIC_URL" : "http://hydra.localhost" , "API_URL" : "http://faf-api:8010" , "WP_URL" : "http://wordpress:80" }
374+ website_links = [link ("http://www.{}" . format ( base_domain ) , "FAForever Website" )]
375+ website_patch = {"OAUTH_URL" : "http://ory-hydra:4444" , "OAUTH_PUBLIC_URL" : "http://hydra.{}" . format ( base_domain ) , "API_URL" : "http://faf-api:8010" , "WP_URL" : "http://wordpress:80" }
373376proxy_local_service_if_set (service_name = "faf-website" , service_chart = "apps/faf-website" , service_namespace = "faf-apps" , service_deps = website_deps , service_labels = website_labels , service_links = website_links , additional_values = ["apps/faf-website/values-prod.yaml" ], config_patch = website_patch )
374377
375378api_deps = ["faf-db-migrations" , "ory-hydra" ] + rabbitmq_setup_resources
376379api_labels = ["api" ]
377- api_links = [link ("http://api.localhost" , "FAF API" )]
378- api_patch = {"JWT_FAF_HYDRA_ISSUER" : "http://ory-hydra:4444" , "REPLAY_DOWNLOAD_URL_FORMAT" : "http://replays.localhost /%s" , "MOD_DOWNLOAD_URL_FORMAT" : "http://content.localhost /mods/%s" , "MAP_DOWNLOAD_URL_FORMAT" : "http://content.localhost /maps/%s" , "FEATURED_MOD_URL_FORMAT" :"http://content.localhost /legacy-featured-mod-files/%s/%s" , "AVATAR_DOWNLOAD_URL_FORMAT" :"http://content.localhost /faf/avatars/%s" }
380+ api_links = [link ("http://api.{}" . format ( base_domain ) , "FAF API" )]
381+ api_patch = {"JWT_FAF_HYDRA_ISSUER" : "http://ory-hydra:4444" , "REPLAY_DOWNLOAD_URL_FORMAT" : "http://replays.{} /%s" . format ( base_domain ) , "MOD_DOWNLOAD_URL_FORMAT" : "http://content.{} /mods/%s" . format ( base_domain ) , "MAP_DOWNLOAD_URL_FORMAT" : "http://content.{} /maps/%s" . format ( base_domain ) , "FEATURED_MOD_URL_FORMAT" :"http://content.{} /legacy-featured-mod-files/%s/%s" . format ( base_domain ) , "AVATAR_DOWNLOAD_URL_FORMAT" :"http://content.{} /faf/avatars/%s" . format ( base_domain ) }
379382proxy_local_service_if_set (service_name = "faf-api" , service_chart = "apps/faf-api" , service_namespace = "faf-apps" , service_deps = api_deps , service_labels = api_labels , service_links = api_links , config_patch = api_patch )
380383
381384league_service_deps = mariadb_setup_resources + rabbitmq_setup_resources
@@ -392,7 +395,7 @@ replay_server_labels = ["replay"]
392395proxy_local_service_if_set (service_name = "faf-replay-server" , service_chart = "apps/faf-replay-server" , service_namespace = "faf-apps" , service_deps = replay_server_deps , service_labels = replay_server_labels )
393396
394397unitdb_labels = ["unitdb" ]
395- unitdb_links = [link ("http://unitdb.localhost" , "Rackover UnitDB" )]
398+ unitdb_links = [link ("http://unitdb.{}" . format ( base_domain ) , "Rackover UnitDB" )]
396399proxy_local_service_if_set (service_name = "faf-unitdb" , service_chart = "apps/faf-unitdb" , service_namespace = "faf-apps" , service_labels = unitdb_labels , service_links = unitdb_links )
397400
398401ws_bridge_deps = ["faf-lobby-server" ]
0 commit comments