From 755aae1f9fc9819f5e77c5f1f0921d53e1e078bc Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Tue, 15 Apr 2025 09:58:30 -0700 Subject: [PATCH 01/15] fix: gh action env vars --- .github/workflows/build.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 41cc5fa..aeed98f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -118,6 +118,19 @@ jobs: env: COMPOSE_DOCKER_CLI_BUILD: 0 DOCKER_BUILDKIT: 1 + RUST_LOG: ${{ vars.RUST_LOG }} + # Database variables + POSTGRES_DB: ${{ vars.POSTGRES_DB }} + POSTGRES_USER: ${{ vars.POSTGRES_USER }} + POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} + DATABASE_URL: postgres://${{ vars.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@postgres:5432/${{ vars.POSTGRES_DB }} + # API Service variables + API_PORT: ${{ vars.API_PORT }} + API_URL: ${{ vars.API_URL }} + # LLM Engine variables + LLM_API_KEY: ${{ secrets.LLM_API_KEY }} + LLM_MODEL: ${{ vars.LLM_MODEL }} + LLM_ENGINE_PORT: ${{ vars.LLM_ENGINE_PORT }} - name: Wait for services to be healthy run: | From 1261afa14c3be78bc843a2400e22b32b6d3add23 Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Tue, 15 Apr 2025 10:01:22 -0700 Subject: [PATCH 02/15] Update .github/workflows/build.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aeed98f..70ad052 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -123,7 +123,7 @@ jobs: POSTGRES_DB: ${{ vars.POSTGRES_DB }} POSTGRES_USER: ${{ vars.POSTGRES_USER }} POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} - DATABASE_URL: postgres://${{ vars.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@postgres:5432/${{ vars.POSTGRES_DB }} + DATABASE_URL: "postgres://${{ vars.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@postgres:5432/${{ vars.POSTGRES_DB }}" # API Service variables API_PORT: ${{ vars.API_PORT }} API_URL: ${{ vars.API_URL }} From 5ded22c791f0b5de07c5c1745a7c453c03fd6510 Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Tue, 15 Apr 2025 10:10:50 -0700 Subject: [PATCH 03/15] create an empty .env file --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aeed98f..37a8c02 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -111,6 +111,9 @@ jobs: docker load < /tmp/query-runner-image.tar docker images + - name: Create empty .env file + run: touch .env + - name: Start services with docker compose run: | # Use the pre-built images instead of rebuilding From 1550d1d3a1a0c4d7291b4d96d0d09c6d6d644558 Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Tue, 15 Apr 2025 10:20:36 -0700 Subject: [PATCH 04/15] add debug ENV VAR step --- .github/workflows/build.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c93c381..dcb038c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -129,12 +129,26 @@ jobs: DATABASE_URL: "postgres://${{ vars.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@postgres:5432/${{ vars.POSTGRES_DB }}" # API Service variables API_PORT: ${{ vars.API_PORT }} + API_HOST: ${{ vars.API_HOST }} API_URL: ${{ vars.API_URL }} # LLM Engine variables LLM_API_KEY: ${{ secrets.LLM_API_KEY }} LLM_MODEL: ${{ vars.LLM_MODEL }} LLM_ENGINE_PORT: ${{ vars.LLM_ENGINE_PORT }} + - name: Debug - Print Environment Variables + run: | + echo "=== Custom Variables ===" + echo "RUST_LOG: ${{ vars.RUST_LOG }}" + echo "POSTGRES_DB: ${{ vars.POSTGRES_DB }}" + echo "POSTGRES_USER: ${{ vars.POSTGRES_USER }}" + echo "DATABASE_URL: postgres://${{ vars.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@postgres:5432/${{ vars.POSTGRES_DB }}" + echo "API_PORT: ${{ vars.API_PORT }}" + echo "API_HOST: ${{ vars.API_HOST }}" + echo "API_URL: ${{ vars.API_URL }}" + echo "LLM_MODEL: ${{ vars.LLM_MODEL }}" + echo "LLM_ENGINE_PORT: ${{ vars.LLM_ENGINE_PORT }}" + - name: Wait for services to be healthy run: | # Give services some time to start up From 23b9dc4eb38a9dd39e15303da7ecf148bb577c76 Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Tue, 15 Apr 2025 10:26:33 -0700 Subject: [PATCH 05/15] move debug step --- .github/workflows/build.yml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dcb038c..32c748f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -116,6 +116,16 @@ jobs: - name: Start services with docker compose run: | + echo "=== Custom Variables ===" + echo "RUST_LOG: ${{ vars.RUST_LOG }}" + echo "POSTGRES_DB: ${{ vars.POSTGRES_DB }}" + echo "POSTGRES_USER: ${{ vars.POSTGRES_USER }}" + echo "DATABASE_URL: postgres://${{ vars.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@postgres:5432/${{ vars.POSTGRES_DB }}" + echo "API_PORT: ${{ vars.API_PORT }}" + echo "API_HOST: ${{ vars.API_HOST }}" + echo "API_URL: ${{ vars.API_URL }}" + echo "LLM_MODEL: ${{ vars.LLM_MODEL }}" + echo "LLM_ENGINE_PORT: ${{ vars.LLM_ENGINE_PORT }} # Use the pre-built images instead of rebuilding docker compose up -d env: @@ -136,19 +146,6 @@ jobs: LLM_MODEL: ${{ vars.LLM_MODEL }} LLM_ENGINE_PORT: ${{ vars.LLM_ENGINE_PORT }} - - name: Debug - Print Environment Variables - run: | - echo "=== Custom Variables ===" - echo "RUST_LOG: ${{ vars.RUST_LOG }}" - echo "POSTGRES_DB: ${{ vars.POSTGRES_DB }}" - echo "POSTGRES_USER: ${{ vars.POSTGRES_USER }}" - echo "DATABASE_URL: postgres://${{ vars.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@postgres:5432/${{ vars.POSTGRES_DB }}" - echo "API_PORT: ${{ vars.API_PORT }}" - echo "API_HOST: ${{ vars.API_HOST }}" - echo "API_URL: ${{ vars.API_URL }}" - echo "LLM_MODEL: ${{ vars.LLM_MODEL }}" - echo "LLM_ENGINE_PORT: ${{ vars.LLM_ENGINE_PORT }}" - - name: Wait for services to be healthy run: | # Give services some time to start up From f502c5b2e07838940ec621c2bea8b05ab8a99687 Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Tue, 15 Apr 2025 10:38:56 -0700 Subject: [PATCH 06/15] write vars to .env file --- .github/workflows/build.yml | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 32c748f..252191f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -111,8 +111,24 @@ jobs: docker load < /tmp/query-runner-image.tar docker images - - name: Create empty .env file - run: touch .env + - name: Create .env file + run: | + cat > .env << EOF + # Rust config + RUST_LOG=${{ vars.RUST_LOG }} + # Database variables + POSTGRES_DB=${{ vars.POSTGRES_DB }} + POSTGRES_USER=${{ vars.POSTGRES_USER }} + POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }} + DATABASE_URL="postgres://${{ vars.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@db:5432/${{ vars.POSTGRES_DB }}" + # API Service variables + API_PORT=${{ vars.API_PORT }} + API_HOST=${{ vars.API_HOST }} + API_URL=${{ vars.API_URL }} + # LLM Engine variables + LLM_API_KEY=${{ secrets.LLM_API_KEY }} + LLM_MODEL=${{ vars.LLM_MODEL }} + LLM_ENGINE_PORT=${{ vars.LLM_ENGINE_PORT }} - name: Start services with docker compose run: | @@ -131,20 +147,6 @@ jobs: env: COMPOSE_DOCKER_CLI_BUILD: 0 DOCKER_BUILDKIT: 1 - RUST_LOG: ${{ vars.RUST_LOG }} - # Database variables - POSTGRES_DB: ${{ vars.POSTGRES_DB }} - POSTGRES_USER: ${{ vars.POSTGRES_USER }} - POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} - DATABASE_URL: "postgres://${{ vars.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@postgres:5432/${{ vars.POSTGRES_DB }}" - # API Service variables - API_PORT: ${{ vars.API_PORT }} - API_HOST: ${{ vars.API_HOST }} - API_URL: ${{ vars.API_URL }} - # LLM Engine variables - LLM_API_KEY: ${{ secrets.LLM_API_KEY }} - LLM_MODEL: ${{ vars.LLM_MODEL }} - LLM_ENGINE_PORT: ${{ vars.LLM_ENGINE_PORT }} - name: Wait for services to be healthy run: | From a491c3f7e8114b0808b924b8b3a84475edac325c Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Tue, 15 Apr 2025 10:39:23 -0700 Subject: [PATCH 07/15] add EOF --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 252191f..77862dd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -129,6 +129,7 @@ jobs: LLM_API_KEY=${{ secrets.LLM_API_KEY }} LLM_MODEL=${{ vars.LLM_MODEL }} LLM_ENGINE_PORT=${{ vars.LLM_ENGINE_PORT }} + EOF - name: Start services with docker compose run: | From a39b0987aad8e94f4744d24ae68ca8b88110d70d Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Tue, 15 Apr 2025 10:40:49 -0700 Subject: [PATCH 08/15] remove debugging code --- .github/workflows/build.yml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 77862dd..013faac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -132,19 +132,7 @@ jobs: EOF - name: Start services with docker compose - run: | - echo "=== Custom Variables ===" - echo "RUST_LOG: ${{ vars.RUST_LOG }}" - echo "POSTGRES_DB: ${{ vars.POSTGRES_DB }}" - echo "POSTGRES_USER: ${{ vars.POSTGRES_USER }}" - echo "DATABASE_URL: postgres://${{ vars.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@postgres:5432/${{ vars.POSTGRES_DB }}" - echo "API_PORT: ${{ vars.API_PORT }}" - echo "API_HOST: ${{ vars.API_HOST }}" - echo "API_URL: ${{ vars.API_URL }}" - echo "LLM_MODEL: ${{ vars.LLM_MODEL }}" - echo "LLM_ENGINE_PORT: ${{ vars.LLM_ENGINE_PORT }} - # Use the pre-built images instead of rebuilding - docker compose up -d + run: docker compose up -d env: COMPOSE_DOCKER_CLI_BUILD: 0 DOCKER_BUILDKIT: 1 From bea86d78d76cf439f2f077d89fa166464f9a6a4c Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Tue, 15 Apr 2025 11:18:15 -0700 Subject: [PATCH 09/15] add debug logs --- .github/workflows/build.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 013faac..96668de 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -131,6 +131,36 @@ jobs: LLM_ENGINE_PORT=${{ vars.LLM_ENGINE_PORT }} EOF + - name: Start database container only + run: | + docker compose up -d db + # Wait for database to be ready + echo "Waiting for database to be healthy..." + sleep 30 + + - name: Start API container with logs + run: | + # Start API container in detached mode + docker compose up -d api + # Show logs as it starts + docker compose logs api + # Check container status + docker ps -a + + - name: Debug - Check environment variables + run: | + echo "=== Docker Compose Configuration ===" + # Use grep to filter out potential secrets + docker compose config | grep -v -E '(PASSWORD|SECRET|TOKEN|KEY|PASS)' + + echo "=== API Container Environment ===" + docker compose exec -T db env | grep -v -E '(PASSWORD|SECRET|TOKEN|KEY|PASS)' | sort + + - name: Debug - Database container logs + run: | + echo "=== Database Container Logs ===" + docker compose logs db + - name: Start services with docker compose run: docker compose up -d env: From 219defe1bc9b0fb56c8b806fea4831d8fb90eaee Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Tue, 15 Apr 2025 12:52:04 -0700 Subject: [PATCH 10/15] add more debugging --- .github/workflows/build.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 96668de..0d8197f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -160,6 +160,13 @@ jobs: run: | echo "=== Database Container Logs ===" docker compose logs db + + - name: Debug - Test database connection + run: | + # Use a temporary container to test connection + docker run --rm --network lucidata_default postgres:15 \ + pg_isready -h db -U lucidata + echo "Connection result: $?" - name: Start services with docker compose run: docker compose up -d @@ -167,6 +174,11 @@ jobs: COMPOSE_DOCKER_CLI_BUILD: 0 DOCKER_BUILDKIT: 1 + - name: Debug - API container logs + run: | + echo "=== API Container Logs ===" + docker compose logs api + - name: Wait for services to be healthy run: | # Give services some time to start up From 85f51e4e21453206b51196e6d34c8a5f94f336c0 Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Tue, 15 Apr 2025 12:52:45 -0700 Subject: [PATCH 11/15] simplify healthcheck --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8e631b9..26430b8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,7 +37,7 @@ services: db: condition: service_healthy healthcheck: - test: ["CMD", "curl", "-f", "http://api:${API_PORT}/api/health"] + test: ["CMD", "ls", "/app"] interval: 10s timeout: 5s retries: 5 From 9409987e17f4efbc2f2af2b1ddcfd9cc802faf90 Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Tue, 15 Apr 2025 13:02:10 -0700 Subject: [PATCH 12/15] add more API log debugging --- .github/workflows/build.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0d8197f..66488f6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -115,7 +115,7 @@ jobs: run: | cat > .env << EOF # Rust config - RUST_LOG=${{ vars.RUST_LOG }} + RUST_LOG=DEBUG # Database variables POSTGRES_DB=${{ vars.POSTGRES_DB }} POSTGRES_USER=${{ vars.POSTGRES_USER }} @@ -167,7 +167,12 @@ jobs: docker run --rm --network lucidata_default postgres:15 \ pg_isready -h db -U lucidata echo "Connection result: $?" - + - name: Start API service + run: docker compose up -d api + + - name: Check API logs immediately + run: docker compose logs api + - name: Start services with docker compose run: docker compose up -d env: From 4f15ddd57764b4bc2f126465bdc65e14e3e9411f Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Wed, 16 Apr 2025 10:38:13 -0700 Subject: [PATCH 13/15] add query router env vars --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2f8b387..c7960ec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -129,6 +129,9 @@ jobs: LLM_API_KEY=${{ secrets.LLM_API_KEY }} LLM_MODEL=${{ vars.LLM_MODEL }} LLM_ENGINE_PORT=${{ vars.LLM_ENGINE_PORT }} + LLM_ENGINE_URL=${{ vars.LLM_ENGINE_URL }} + # Query Router variables + QUERY_ROUTER_PORT=${{ vars.QUERY_ROUTER_PORT }} EOF - name: Start database container only From baab8392fc5f1abd91effc2e6d075da2d6b909da Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Wed, 16 Apr 2025 10:47:32 -0700 Subject: [PATCH 14/15] add more debugging --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c7960ec..6057587 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -133,6 +133,10 @@ jobs: # Query Router variables QUERY_ROUTER_PORT=${{ vars.QUERY_ROUTER_PORT }} EOF + - name: Validate .env file + run: | + echo "Validating .env file..." + cat .env - name: Start database container only run: | @@ -186,6 +190,7 @@ jobs: run: | echo "=== API Container Logs ===" docker compose logs api + docker inspect lucidata-api-1 - name: Wait for services to be healthy run: | From 681a4ab60cddfc6dd49e5f670357b655e9208a82 Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Wed, 16 Apr 2025 10:59:16 -0700 Subject: [PATCH 15/15] increase all timeouts --- docker-compose.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0adf4f1..d8b2547 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,8 +17,8 @@ services: - ./database/scripts/import_mtcars.sh:/docker-entrypoint-initdb.d/99_import_mtcars.sh healthcheck: test: ["CMD-SHELL", "pg_isready -U lucidata"] - interval: 5s - timeout: 5s + interval: 30s + timeout: 10s retries: 5 api: @@ -38,8 +38,8 @@ services: condition: service_healthy healthcheck: test: ["CMD", "curl", "-f", "http://api:${API_PORT}/api/health"] - interval: 10s - timeout: 5s + interval: 30s + timeout: 10s retries: 5 start_period: 15s @@ -68,8 +68,8 @@ services: condition: service_healthy healthcheck: test: ["CMD", "curl", "-f", "http://localhost:${LLM_ENGINE_PORT}/health"] - interval: 10s - timeout: 5s + interval: 30s + timeout: 10s retries: 3 start_period: 5s