The Appwrite CLI can be used in a non-interactive and headless manner, without saving configuration or sessions. This is especially useful when you want to automate tasks on a CI server.
You can enable CI mode for the Appwrite CLI by setting the project ID, endpoint, and API Key:
appwrite client \ --endpoint https://[HOSTNAME_OR_IP]/v1 \ --projectId [YOUR_PROJECT_ID] \ --key YOUR_API_KEY
When you set the global configuration parameters using the
appwrite client command, they take precedence over the local configuration parameters in your
appwrite.json thereby switching the CLI to non-interactive mode.
In this mode, the CLI can only interact with one project at a time.
In CI mode, the CLI uses an API key to authenticate. Your API key must have sufficient permissions to execute the commands you plan to use. Learn more about API Keys.
Appwrite's deploy commands can also be executed in a non-interactive mode. This applies to both function and collection deployment.
You can deploy a function non-interactively by using the
--yes option to skip all warnings and specifying which functions you want to deploy.
Deploy a single function by ID:
appwrite deploy function --functionId [FUNCTION ID] --yes
Deploy all functions:
appwrite deploy function --all --yes
You can deploy collections and teams non-interactively in a similar way by using the
Deploy all collections:
appwrite deploy collection --all --yes
Deploy all teams:
appwrite deploy team --all --yes