Deploy manually

Appwrite Functions are mini-applications in Appwrite with their own endpoints. Each function can have many deployments, which can be thought of as versions of the mini-application.

While we recommend you create deployments through automatic Git deployments, you can also create deployments manually or through the Appwrite CLI.

CLI

CLI setup

Before you can deploy with the Appwrite CLI, make sure you've installed and initialized the CLI.

To deploy with the Appwrite CLI, your function must be added to appwrite.json. Use the appwrite init function method to create a starter function, then paste in your function code.

Bash
appwrite init function

Edit the generated code, add dependencies, and deploy the function using the following command:

Bash
appwrite deploy function

Overwrite warning

If you made changes in the Appwrite Console that are different from your appwrite.json, using the CLI deploy command will overwrite your console changes. Update your appwrite.json manually before deploying.

Configure CLI deployments

If you need to target a different project, API endpoint, change the path or entry point of your function, or update any of the other configuration options, you can do so by editing the appwrite.json file.

Learn more about appwrite.json

Manual Deployment

You can upload your functions to be deployed using the Appwrite Console. The example below shows a simple Node.js function.

Text
.
├── package.json
└── index.js

First, navigate inside the folder that contains your dependency file. Package your code files into the .tar.gz format:

tar --exclude code.tar.gz -czf code.tar.gz .

Next, navigate to your Appwrite Console and upload the function.

  1. Navigate to the function you want to deploy.

  2. Click Create deployment.

  3. Select the Manual tab.

  4. Input the entry point of your function under Entrypoint. For the example above, it would be index.js.

  5. Upload code.tar.gz.

  6. Select Activate deployment after build.

  7. Click Create.

Debugging

  • If you updated your function's configuration but the deployment is not working as expected, you may need to first redeploy your function before the changes take effect.

  • If you notice your function is missing dependencies during build or at runtimes, update it's build settings. Navigate to Functions > your function > Settings > Configuration > Build settings. These commands will be ran before the function is built and can be used to install dependencies.

  • If you're missing some code files at build time, make sure they are included in the Root directory. Only files in the root directory folder will be copied to the executor.