> ## 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
)
```

**Constructor Parameter Reference**

**name** `string`

The name of the app to deploy.

**port** `integer`

The port the app listens on when deployed.

**description** `string`

A description of the app.

**app\_type** `string`

A user-defined type for the app, used for bookkeeping purposes.

**image** `string`

The Docker image to deploy the app with.

**tags** `string[]`

Tags to apply to the app.

**secrets** `string[]`

Platform integrations to attach to the app. Use the value you set in the `@secrets` decorator in your code.

**compute\_pools** `string[]`

A list of compute pools to deploy the app to.

**environment** `object`

Environment variables to set on the app.

**commands** `string[]`

The commands used to launch the app.

**resources** `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.

**auth** `object`

Auth configuration for the app.

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

**replicas** `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.

**code\_package** `object`

Pre-packaged code from `package_code()`. A `PackagedCode` named tuple containing `url` and `key`.

**force\_upgrade** `boolean`

Force an upgrade even if the app is currently being upgraded.

**use\_base\_image\_command** `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.

**skip\_code\_package** `boolean`

When true, skip code packaging and rely on the container's embedded source code. When set, you cannot pass `code_package`.

**persistence** `string`

The persistence mode for the app. Experimental; might change in the future.

**project** `string`

The project to deploy the app to. Experimental; might change in the future.

**branch** `string`

The branch to deploy the app to. Experimental; might change in the future.

**models** `string[]`

Experimental; might change in the future.

**data** `string[]`

Experimental; might change in the future.

**generate\_static\_url** `boolean`

Generate a static URL for the app based on its project, branch, and name.

**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()
```
