diff --git a/libs/cli/langgraph_cli/docker.py b/libs/cli/langgraph_cli/docker.py index d2cffc26b..f28274f4d 100644 --- a/libs/cli/langgraph_cli/docker.py +++ b/libs/cli/langgraph_cli/docker.py @@ -174,8 +174,8 @@ def compose( interval: 5s""" compose_str = f"""{volumes}services: -{db} {REDIS} +{db} {debugger_compose(port=debugger_port, base_url=debugger_base_url)} langgraph-api: ports: @@ -189,8 +189,8 @@ def compose( condition: service_healthy""" compose_str += f""" environment: - POSTGRES_URI: {postgres_uri} REDIS_URI: redis://langgraph-redis:6379 + POSTGRES_URI: {postgres_uri} """ if capabilities.healthcheck_start_interval: compose_str += """ healthcheck: diff --git a/libs/cli/tests/unit_tests/test_cli.py b/libs/cli/tests/unit_tests/test_cli.py index da9354c07..a4972f393 100644 --- a/libs/cli/tests/unit_tests/test_cli.py +++ b/libs/cli/tests/unit_tests/test_cli.py @@ -45,6 +45,13 @@ def test_prepare_args_and_stdin(): langgraph-data: driver: local services: + langgraph-redis: + image: redis:6 + healthcheck: + test: redis-cli ping + interval: 5s + timeout: 1s + retries: 5 langgraph-postgres: image: postgres:16 ports: @@ -76,9 +83,12 @@ services: ports: - "8000:8000" depends_on: + langgraph-redis: + condition: service_healthy langgraph-postgres: condition: service_healthy environment: + REDIS_URI: redis://langgraph-redis:6379 POSTGRES_URI: {DEFAULT_POSTGRES_URI} healthcheck: test: python /api/healthcheck.py diff --git a/libs/cli/tests/unit_tests/test_docker.py b/libs/cli/tests/unit_tests/test_docker.py index 4d5e09b94..781c049c1 100644 --- a/libs/cli/tests/unit_tests/test_docker.py +++ b/libs/cli/tests/unit_tests/test_docker.py @@ -20,10 +20,21 @@ def test_compose_with_no_debugger_and_custom_db(): DEFAULT_DOCKER_CAPABILITIES, port=port, postgres_uri=custom_postgres_uri ) expected_compose_str = f"""services: + langgraph-redis: + image: redis:6 + healthcheck: + test: redis-cli ping + interval: 5s + timeout: 1s + retries: 5 langgraph-api: ports: - "{port}:8000" + depends_on: + langgraph-redis: + condition: service_healthy environment: + REDIS_URI: redis://langgraph-redis:6379 POSTGRES_URI: {custom_postgres_uri}""" assert clean_empty_lines(actual_compose_str) == expected_compose_str @@ -37,10 +48,21 @@ def test_compose_with_no_debugger_and_custom_db_with_healthcheck(): postgres_uri=custom_postgres_uri, ) expected_compose_str = f"""services: + langgraph-redis: + image: redis:6 + healthcheck: + test: redis-cli ping + interval: 5s + timeout: 1s + retries: 5 langgraph-api: ports: - "{port}:8000" + depends_on: + langgraph-redis: + condition: service_healthy environment: + REDIS_URI: redis://langgraph-redis:6379 POSTGRES_URI: {custom_postgres_uri} healthcheck: test: python /api/healthcheck.py @@ -59,10 +81,21 @@ def test_compose_with_debugger_and_custom_db(): postgres_uri=custom_postgres_uri, ) expected_compose_str = f"""services: + langgraph-redis: + image: redis:6 + healthcheck: + test: redis-cli ping + interval: 5s + timeout: 1s + retries: 5 langgraph-api: ports: - "{port}:8000" + depends_on: + langgraph-redis: + condition: service_healthy environment: + REDIS_URI: redis://langgraph-redis:6379 POSTGRES_URI: {custom_postgres_uri}""" assert clean_empty_lines(actual_compose_str) == expected_compose_str @@ -74,6 +107,13 @@ def test_compose_with_debugger_and_default_db(): langgraph-data: driver: local services: + langgraph-redis: + image: redis:6 + healthcheck: + test: redis-cli ping + interval: 5s + timeout: 1s + retries: 5 langgraph-postgres: image: postgres:16 ports: @@ -94,8 +134,11 @@ services: ports: - "{port}:8000" depends_on: + langgraph-redis: + condition: service_healthy langgraph-postgres: condition: service_healthy environment: + REDIS_URI: redis://langgraph-redis:6379 POSTGRES_URI: {DEFAULT_POSTGRES_URI}""" assert clean_empty_lines(actual_compose_str) == expected_compose_str