Repository: mlflow/mlflow

Issue:
[BUG] Positive DISABLE_NGINX env variable value should equal "true"
### Issues Policy acknowledgement

- [X] I have read and agree to submit bug reports in accordance with the [issues policy](https://www.github.com/mlflow/mlflow/blob/master/ISSUE_POLICY.md)

### Willingness to contribute

Yes. I would be willing to contribute a fix for this bug with guidance from the MLflow community.

### MLflow version

- Client: 2.2.1
- Tracking server: N/A


### System information

- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**: macOS Ventura 13.2.1 (22D68)
- **Python version**: 3.8.13
- **yarn version, if running the dev UI**: N/A


### Describe the problem

A positive value of the `DISABLE_NGINX` environment variable is expected to be equal to `"true"` (see [mlflow/models/container/\_\_init\_\_.py#L150](https://github.com/mlflow/mlflow/blob/ffe005c58dd45e4f200bfb5a77aa5273a57ca39d/mlflow/models/container/__init__.py#L150)) whereas in some docstrings in [mlflow/sagemaker/\_\_init\_\_.py](https://github.com/mlflow/mlflow/blob/v2.2.1/mlflow/sagemaker/__init__.py) and in tests in [tests/sagemaker/test_sagemaker_deployment_client.py](https://github.com/mlflow/mlflow/blob/v2.2.1/tests/sagemaker/test_sagemaker_deployment_client.py) (although, apparently, the tests _do not_ fail) it equals `"1"`.

### Tracking information

_No response_

### Code to reproduce issue

```python
import os


DISABLE_NGINX = "DISABLE_NGINX"

os.environ["DISABLE_NGINX"] = "1"
disable_nginx = os.getenv(DISABLE_NGINX, "false").lower() == "true"
print(disable_nginx)
>>> False

os.environ["DISABLE_NGINX"] = "true"
disable_nginx = os.getenv(DISABLE_NGINX, "false").lower() == "true"
print(disable_nginx)
>>> True
```

### Stack trace

N/A

### Other info / logs

N/A

### What component(s) does this bug affect?

- [ ] `area/artifacts`: Artifact stores and artifact logging
- [ ] `area/build`: Build and test infrastructure for MLflow
- [X] `area/docs`: MLflow documentation pages
- [ ] `area/examples`: Example code
- [ ] `area/model-registry`: Model Registry service, APIs, and the fluent client calls for Model Registry
- [ ] `area/models`: MLmodel format, model serialization/deserialization, flavors
- [ ] `area/recipes`: Recipes, Recipe APIs, Recipe configs, Recipe Templates
- [ ] `area/projects`: MLproject format, project running backends
- [X] `area/scoring`: MLflow Model server, model deployment tools, Spark UDFs
- [ ] `area/server-infra`: MLflow Tracking server backend
- [ ] `area/tracking`: Tracking Service, tracking client APIs, autologging

### What interface(s) does this bug affect?

- [ ] `area/uiux`: Front-end, user experience, plotting, JavaScript, JavaScript dev server
- [ ] `area/docker`: Docker use across MLflow's components, such as MLflow Projects and MLflow Models
- [ ] `area/sqlalchemy`: Use of SQLAlchemy in the Tracking Service or Model Registry
- [ ] `area/windows`: Windows support

### What language(s) does this bug affect?

- [ ] `language/r`: R APIs and clients
- [ ] `language/java`: Java APIs and clients
- [ ] `language/new`: Proposals for new client languages

### What integration(s) does this bug affect?

- [ ] `integrations/azure`: Azure and Azure ML integrations
- [ ] `integrations/sagemaker`: SageMaker integrations
- [ ] `integrations/databricks`: Databricks integrations


Discussion:
Thanks for catching this! 
Thank you for this issue.

Can I ask a question?

You mentioned as 

> A positive value of the DISABLE_NGINX environment variable is expected to be equal to "true"  

However,  the link you mentioned has the comment line saying 

```py
# option to disable manually nginx. The default behavior is to enable nginx.
```

https://github.com/mlflow/mlflow/blob/ffe005c58dd45e4f200bfb5a77aa5273a57ca39d/mlflow/models/container/__init__.py#L149

So from the code, any other text value than `true` or its variants(like `True` or `TRUE`), will give `disable_nginx` the value `False`, which is the default value that the comments above intends to have. I wonder if I am missing some points from your explanation. 
Hey @UponTheSky !

You are correct. The default behavior is `disable_nginx = False` which leads to running an `nginx` server as a proxy. On the other hand, the intended behavior in docstring examples and tests is to disable `nginx` (`disable_nginx = True`; why else would you assign `"1"` and not `"0"` in that case? Or just avoid passing the env var at all to eventually get `nginx` enabled?). So my point is to change `"1"` to `"true"`; otherwise, the intention might be misleading for the newcomers or people who look through the codebase. Moreover, the tests _may_ operate a bit differently (that also needs to be verified).

 Hope, it's become clearer for you now.
It may also be confusing since negative variable names are present here. As a best practice, we should avoid using such variable names
Thank you for the clear explanation!
Yes, for a newcomer like me, just reading the code doesn't tell me much about test settings. It should be helpful for more readable code. I appreciate your effort. Thank you!
<!-- assign-maintainer -->
@BenWilson2 @dbczumar @harupy @WeichenXu123 Please assign a maintainer and start triaging this issue.

Resolving patch:
diff --git a/mlflow/sagemaker/__init__.py b/mlflow/sagemaker/__init__.py
--- a/mlflow/sagemaker/__init__.py
+++ b/mlflow/sagemaker/__init__.py
@@ -2168,7 +2168,7 @@ def create_deployment(self, name, model_uri, flavor=None, config=None, endpoint=
                 timeout_seconds=300,
                 vpc_config=vpc_config,
                 variant_name="prod-variant-1",
-                env={"DISABLE_NGINX": "1", "GUNICORN_CMD_ARGS": '"--timeout 60"'},
+                env={"DISABLE_NGINX": "true", "GUNICORN_CMD_ARGS": '"--timeout 60"'},
                 tags={"training_timestamp": "2022-11-01T05:12:26"},
             )
             client = get_deploy_client("sagemaker")
@@ -2200,7 +2200,7 @@ def create_deployment(self, name, model_uri, flavor=None, config=None, endpoint=
                     -C data_capture_config='{"EnableCapture": True, \\
                     'InitalSamplingPercentage': 100, 'DestinationS3Uri": 's3://my-bucket/path', \\
                     'CaptureOptions': [{'CaptureMode': 'Output'}]}'
-                    -C env='{"DISABLE_NGINX": "1", "GUNICORN_CMD_ARGS": "\"--timeout 60\""}' \\
+                    -C env='{"DISABLE_NGINX": "true", "GUNICORN_CMD_ARGS": "\"--timeout 60\""}' \\
                     -C tags='{"training_timestamp": "2022-11-01T05:12:26"}' \\
         """
         final_config = self._default_deployment_config()
@@ -2412,7 +2412,7 @@ def update_deployment(
                 variant_name="prod-variant-1",
                 vpc_config=vpc_config,
                 data_capture_config=data_capture_config,
-                env={"DISABLE_NGINX": "1", "GUNICORN_CMD_ARGS": '"--timeout 60"'},
+                env={"DISABLE_NGINX": "true", "GUNICORN_CMD_ARGS": '"--timeout 60"'},
                 tags={"training_timestamp": "2022-11-01T05:12:26"},
             )
             client = get_deploy_client("sagemaker")
@@ -2445,7 +2445,7 @@ def update_deployment(
                     -C data_capture_config='{"EnableCapture": True, \\
                     "InitalSamplingPercentage": 100, "DestinationS3Uri": "s3://my-bucket/path", \\
                     "CaptureOptions": [{"CaptureMode": "Output"}]}'
-                    -C env='{"DISABLE_NGINX": "1", "GUNICORN_CMD_ARGS": "\"--timeout 60\""}' \\
+                    -C env='{"DISABLE_NGINX": "true", "GUNICORN_CMD_ARGS": "\"--timeout 60\""}' \\
                     -C tags='{"training_timestamp": "2022-11-01T05:12:26"}' \\
         """
         final_config = self._default_deployment_config(create_mode=False)


Test patch:
diff --git a/tests/sagemaker/test_sagemaker_deployment_client.py b/tests/sagemaker/test_sagemaker_deployment_client.py
--- a/tests/sagemaker/test_sagemaker_deployment_client.py
+++ b/tests/sagemaker/test_sagemaker_deployment_client.py
@@ -459,7 +459,7 @@ def test_create_deployment_create_sagemaker_and_s3_resources_with_expected_names
         "MLFLOW_DEPLOYMENT_FLAVOR_NAME": "python_function",
         "SERVING_ENVIRONMENT": "SageMaker",
         "GUNCORN_CMD_ARGS": '"--timeout 60"',
-        "DISABLE_NGINX": "1",
+        "DISABLE_NGINX": "true",
     }
 
     if proxies_enabled:
@@ -475,7 +475,7 @@ def test_create_deployment_create_sagemaker_and_s3_resources_with_expected_names
                 name=name,
                 model_uri=pretrained_model.model_uri,
                 config=dict(
-                    env={"DISABLE_NGINX": "1", "GUNCORN_CMD_ARGS": '"--timeout 60"'},
+                    env={"DISABLE_NGINX": "true", "GUNCORN_CMD_ARGS": '"--timeout 60"'},
                 ),
             )
     else:
@@ -485,7 +485,7 @@ def test_create_deployment_create_sagemaker_and_s3_resources_with_expected_names
                 name=name,
                 model_uri=pretrained_model.model_uri,
                 config=dict(
-                    env={"DISABLE_NGINX": "1", "GUNCORN_CMD_ARGS": '"--timeout 60"'},
+                    env={"DISABLE_NGINX": "true", "GUNCORN_CMD_ARGS": '"--timeout 60"'},
                 ),
             )
 
@@ -522,12 +522,12 @@ def test_deploy_cli_creates_sagemaker_and_s3_resources_with_expected_names_and_e
 ):
     region_name = sagemaker_client.meta.region_name
     environment_variables = {"LC_ALL": "en_US.UTF-8", "LANG": "en_US.UTF-8"}
-    override_environment_variables = {"DISABLE_NGINX": "1", "GUNCORN_CMD_ARGS": '"--timeout 60"'}
+    override_environment_variables = {"DISABLE_NGINX": "true", "GUNCORN_CMD_ARGS": '"--timeout 60"'}
     expected_model_environment = {
         "MLFLOW_DEPLOYMENT_FLAVOR_NAME": "python_function",
         "SERVING_ENVIRONMENT": "SageMaker",
         "GUNCORN_CMD_ARGS": '"--timeout 60"',
-        "DISABLE_NGINX": "1",
+        "DISABLE_NGINX": "true",
     }
 
     if proxies_enabled: