> ## Documentation Index
> Fetch the complete documentation index at: https://anaconda.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# AppDeployer

```python expandable theme={null}
AppDeployer(
    name: Optional[str] = None,
    port: Optional[int] = None,
    description: Optional[str] = None,
    app_type: Optional[str] = None,
    image: Optional[str] = None,
    tags: Optional[list] = None,
    secrets: Optional[list] = None,
    compute_pools: Optional[list] = None,
    environment: Optional[dict] = None,
    commands: Optional[list] = None,
    resources: Optional[ResourceConfigDict] = None,
    auth: Optional[AuthConfigDict] = None,
    replicas: Optional[ReplicaConfigDict] = None,
    code_package: Optional[tuple] = None,
    force_upgrade: Optional[bool] = None,
    use_base_image_command: Optional[bool] = None,
    skip_code_package: Optional[bool] = None,
    persistence: Optional[str] = None,
    project: Optional[str] = None,
    branch: Optional[str] = None,
    models: Optional[list] = None,
    data: Optional[list] = None,
    generate_static_url: Optional[bool] = None,
    **kwargs
)
```

<Expandable title="Constructor Parameter Reference" defaultOpen={true}>
  <ParamField path="name" type="string">
    The name of the app to deploy.
  </ParamField>

  <ParamField path="port" type="integer">
    The port the app listens on when deployed.
  </ParamField>

  <ParamField path="description" type="string">
    A description of the app.
  </ParamField>

  <ParamField path="app_type" type="string">
    A user-defined type for the app, used for bookkeeping purposes.
  </ParamField>

  <ParamField path="image" type="string">
    The Docker image to deploy the app with.
  </ParamField>

  <ParamField path="tags" type="string[]">
    Tags to apply to the app.
  </ParamField>

  <ParamField path="secrets" type="string[]">
    Platform integrations to attach to the app. Use the value you set in the `@secrets` decorator in your code.
  </ParamField>

  <ParamField path="compute_pools" type="string[]">
    A list of compute pools to deploy the app to.
  </ParamField>

  <ParamField path="environment" type="object">
    Environment variables to set on the app.
  </ParamField>

  <ParamField path="commands" type="string[]">
    The commands used to launch the app.
  </ParamField>

  <ParamField path="resources" type="object">
    Resource configuration for the app.

    * `cpu` (str): CPU requests.
    * `memory` (str): Memory requests.
    * `gpu` (str): GPU requests.
    * `disk` (str): Storage disk size.
    * `shared_memory` (str): Shared memory.
  </ParamField>

  <ParamField path="auth" type="object">
    Auth configuration for the app.

    * `type` (str): The type of authentication to use for the app.
    * `public` (bool): Whether the app is public.
  </ParamField>

  <ParamField path="replicas" type="object">
    The number of replicas to deploy the app with.

    * `fixed` (int): A fixed number of replicas. Cannot be combined with `min` and `max`.
    * `min` (int): The minimum number of replicas.
    * `max` (int): The maximum number of replicas.
    * `scaling_policy` (object): The metric the replicas scale on. Applied when `min` and `max` are set and are not the same. The default is 60 requests per minute.
      * `rpm` (int): Scale up replicas when requests per minute cross this threshold.
  </ParamField>

  <ParamField path="code_package" type="object">
    Pre-packaged code from `package_code()`. A `PackagedCode` named tuple containing `url` and `key`.
  </ParamField>

  <ParamField path="force_upgrade" type="boolean">
    Force an upgrade even if the app is currently being upgraded.
  </ParamField>

  <ParamField path="use_base_image_command" type="boolean">
    When true, skip providing startup commands and rely on the container's entrypoint/CMD. Only available in the programmatic API. In CLI mode, use `--no-deps` without passing a command to enable this behavior.
  </ParamField>

  <ParamField path="skip_code_package" type="boolean">
    When true, skip code packaging and rely on the container's embedded source code. When set, you cannot pass `code_package`.
  </ParamField>

  <ParamField path="persistence" type="string">
    The persistence mode for the app. Experimental; might change in the future.
  </ParamField>

  <ParamField path="project" type="string">
    The project to deploy the app to. Experimental; might change in the future.
  </ParamField>

  <ParamField path="branch" type="string">
    The branch to deploy the app to. Experimental; might change in the future.
  </ParamField>

  <ParamField path="models" type="string[]">
    Experimental; might change in the future.
  </ParamField>

  <ParamField path="data" type="string[]">
    Experimental; might change in the future.
  </ParamField>

  <ParamField path="generate_static_url" type="boolean">
    Generate a static URL for the app based on its project, branch, and name.
  </ParamField>
</Expandable>

**Examples:**

**Basic deployment with `bake_image` and `package_code`:**

```python expandable theme={null}
from metaflow.apps import bake_image, package_code, AppDeployer

# Step 1: Bake dependencies into an image
baked = bake_image(pypi={"flask": ">=2.0", "requests": ""})

# Step 2: Package your application code
pkg = package_code(src_paths=["./src"])

# Step 3: Create deployer and deploy
deployer = AppDeployer(
    name="my-flask-app",
    port=8000,
    image=baked.image,
    code_package=pkg,
    commands=["python server.py"],
    replicas={"min": 1, "max": 3},
    resources={"cpu": "1", "memory": "2048Mi"},
)
deployed = deployer.deploy()
print(deployed.public_url)
```

**Deployment with API authentication:**

```python theme={null}
deployer = AppDeployer(
    name="my-api",
    port=8000,
    image=baked.image,
    code_package=pkg,
    commands=["python api.py"],
    auth={"type": "API"},
)
deployed = deployer.deploy()
```

**Deployment with environment variables and secrets:**

```python expandable theme={null}
deployer = AppDeployer(
    name="my-app",
    port=8000,
    image=baked.image,
    code_package=pkg,
    commands=["python app.py"],
    environment={"DEBUG": "false", "LOG_LEVEL": "info"},
    secrets=["my-api-keys"],
)
deployed = deployer.deploy()
```

**Interacting with a deployed app:**

```python expandable theme={null}
# Get app info
info = deployed.info()

# Get logs from all workers
logs = deployed.logs()

# Scale to zero workers
deployed.scale_to_zero()

# Delete the app
deployed.delete()
```
