modal app

Manage deployed and running apps.

Usage:

Options:

  • --help: Show this message and exit.

Commands:

  • list: List Modal apps that are currently deployed/running or recently stopped.
  • logs: Fetch or stream App logs.
  • rollback: Redeploy a previous version of an App.
  • stop: Stop an app.
  • history: Show App deployment history, for a currently deployed app
  • dashboard: Open an App’s dashboard page in your web browser.

List Modal apps that are currently deployed/running or recently stopped.

Usage:

Options:

  • -e, --env TEXT: Environment to interact with.

If not specified, Modal will use the default environment of your current profile, or the MODAL_ENVIRONMENT variable. Otherwise, raises an error if the workspace has multiple environments.

  • --json / --no-json: [default: no-json]
  • --help: Show this message and exit.

Fetch or stream App logs.

By default, this command fetches the last 100 log entries and exits. Use -f to live-stream logs from a running App instead. Fetch and follow are mutually exclusive.

Examples:

Get recent logs based on an app ID:

Get recent logs for a currently deployed App based on its name:

Follow (stream) logs from a running App:

Fetch the last 1000 entries:

Fetch logs from the last 2 hours:

Fetch logs in a specific time range:

Filter the logs by source and function:

Include timestamps along with Function and Container IDs on each line:

Usage:

Arguments:

  • [APP_IDENTIFIER]: App name or ID

Options:

  • -f, --follow: Stream log output until App stops
  • --since TEXT: Start of time range. Accepts ISO 8601 datetime or relative time, e.g. ‘1d’ (1 day ago), ‘2h’, ‘30m’, etc.
  • --until TEXT: End of time range; accepts same argument types as —since
  • -n, --tail INTEGER: Show only the last N log entries
  • --search TEXT: Filter by search text
  • --function TEXT: Filter by Function ID (fu-*)
  • --function-call TEXT: Filter by FunctionCall ID (fc-*)
  • --container TEXT: Filter by Container ID (ta-*)
  • -s, --source TEXT: Filter by source: ‘stdout’, ‘stderr’, or ‘system’
  • --timestamps: Prefix each line with its timestamp
  • --show-function-id: Prefix each line with its Function ID
  • --show-function-call-id: Prefix each line with its FunctionCall ID
  • --show-container-id: Prefix each line with its Container ID
  • -e, --env TEXT: Environment to interact with.

If not specified, Modal will use the default environment of your current profile, or the MODAL_ENVIRONMENT variable. Otherwise, raises an error if the workspace has multiple environments.

  • --help: Show this message and exit.

Redeploy a previous version of an App.

Note that the App must currently be in a “deployed” state. Rollbacks will appear as a new deployment in the App history, although the App state will be reset to the state at the time of the previous deployment.

Examples:

Rollback an App to its previous version:

Rollback an App to a specific version:

Rollback an App using its App ID instead of its name:

Usage:

Arguments:

  • [APP_IDENTIFIER]: App name or ID
  • [VERSION]: Target version for rollback.

Options:

  • -e, --env TEXT: Environment to interact with.

If not specified, Modal will use the default environment of your current profile, or the MODAL_ENVIRONMENT variable. Otherwise, raises an error if the workspace has multiple environments.

  • --help: Show this message and exit.

Stop an app.

Usage:

Arguments:

  • [APP_IDENTIFIER]: App name or ID

Options:

  • -e, --env TEXT: Environment to interact with.

If not specified, Modal will use the default environment of your current profile, or the MODAL_ENVIRONMENT variable. Otherwise, raises an error if the workspace has multiple environments.

  • --help: Show this message and exit.

Show App deployment history, for a currently deployed app

Examples:

Get the history based on an app ID:

Get the history for a currently deployed App based on its name:

Usage:

Arguments:

  • [APP_IDENTIFIER]: App name or ID

Options:

  • -e, --env TEXT: Environment to interact with.

If not specified, Modal will use the default environment of your current profile, or the MODAL_ENVIRONMENT variable. Otherwise, raises an error if the workspace has multiple environments.

  • --json / --no-json: [default: no-json]
  • --help: Show this message and exit.

Open an App’s dashboard page in your web browser.

Examples:

Open dashboard for an app by name:

Use a specified environment:

Usage:

Arguments:

  • [APP_IDENTIFIER]: App name or ID

Options:

  • -e, --env TEXT: Environment to interact with.

If not specified, Modal will use the default environment of your current profile, or the MODAL_ENVIRONMENT variable. Otherwise, raises an error if the workspace has multiple environments.

  • --help: Show this message and exit.