From c0d696b6a69041b69c6b9e3f7edb81a90054715b Mon Sep 17 00:00:00 2001 From: Sheikah45 Date: Mon, 7 Sep 2026 18:40:25 -0400 Subject: [PATCH] use script version of populate-db for speed --- Tiltfile | 4 +--- tilt/scripts/populate-database.sh | 3 +++ tilt/yaml/populate-db.yaml | 20 -------------------- 3 files changed, 4 insertions(+), 23 deletions(-) create mode 100644 tilt/scripts/populate-database.sh delete mode 100644 tilt/yaml/populate-db.yaml diff --git a/Tiltfile b/Tiltfile index bf7f4534..25bb1e3a 100644 --- a/Tiltfile +++ b/Tiltfile @@ -254,6 +254,7 @@ def extract_ingress_details(yaml): agnostic_local_resource("create-hosts-file-content", cmd=["./tilt/scripts/print-hosts.sh"], labels=["core"], auto_init=False, trigger_mode=TRIGGER_MODE_MANUAL, allow_parallel=True) agnostic_local_resource("populate-featured-mod-files", cmd=["./tilt/scripts/update-faf-featured-mod.sh", faf_data_dir], labels=["database"], resource_deps=["faf-db-migrations"], auto_init=False, trigger_mode=TRIGGER_MODE_MANUAL, allow_parallel=True) +agnostic_local_resource("populate-db", cmd=["./tilt/scripts/populate-database.sh"], labels=["database"], resource_deps=["faf-db-migrations"], auto_init=False, trigger_mode=TRIGGER_MODE_MANUAL, allow_parallel=True) k8s_yaml("cluster/namespaces.yaml") k8s_yaml(helm_with_build_cache("infra/clusterroles", namespace="faf-infra", values=["config/local.yaml"])) @@ -341,9 +342,6 @@ for object in decode_yaml_stream(rabbitmq_init_user_yaml): k8s_yaml(cronjob_to_job(helm_with_build_cache("apps/faf-db-migrations", namespace="faf-apps", values=["config/local.yaml"]))) k8s_resource(workload="faf-db-migrations", objects=["faf-db-migrations:secret"], resource_deps=mariadb_setup_resources, labels=["database"]) -k8s_yaml("tilt/yaml/populate-db.yaml") -k8s_resource(workload="populate-db", resource_deps=["faf-db-migrations"], labels=["database"], auto_init=False, trigger_mode=TRIGGER_MODE_MANUAL) - k8s_yaml(helm_with_build_cache("apps/ergochat", namespace="faf-apps", values=["config/local.yaml"])) k8s_resource(new_name="ergochat-config", objects=["ergochat:configmap", "ergochat:secret"], labels=["chat"]) k8s_resource(workload="ergochat", objects=["ergochat-webirc:ingressroute"], resource_deps=["traefik"] + mariadb_setup_resources, port_forwards=["8097:8097"], labels=["chat"]) diff --git a/tilt/scripts/populate-database.sh b/tilt/scripts/populate-database.sh new file mode 100644 index 00000000..ae7f734d --- /dev/null +++ b/tilt/scripts/populate-database.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +curl -s https://raw.githubusercontent.com/FAForever/db/refs/heads/develop/test-data.sql | kubectl exec -i --namespace=faf-infra statefulset/mariadb -- mariadb --host=mariadb --user=root --password="banana" faf_lobby \ No newline at end of file diff --git a/tilt/yaml/populate-db.yaml b/tilt/yaml/populate-db.yaml deleted file mode 100644 index 2f0ae149..00000000 --- a/tilt/yaml/populate-db.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: populate-db - namespace: faf-infra -spec: - backoffLimit: 1 - template: - spec: - containers: - - name: populate-db - image: mariadb:12.2 - imagePullPolicy: Always - envFrom: - - secretRef: - name: mariadb - command: ["/bin/sh", "-c"] - args: - - apt-get update && apt-get install -y curl && curl -s https://raw.githubusercontent.com/FAForever/db/refs/heads/develop/test-data.sql | mariadb -h mariadb -uroot -p"${MARIADB_ROOT_PASSWORD}" -D faf_lobby - restartPolicy: Never \ No newline at end of file