doctl-serverless
Manage DigitalOcean serverless functions and namespaces
TLDR
Connect local serverless support to a functions namespace
Deploy a functions project to your functions namespace
Obtain metadata of a functions project
Provide information about serverless support
SYNOPSIS
doctl serverless <command> [options]
Common usage patterns include:
doctl serverless deploy [path] [options]
doctl serverless functions get <function-name> [options]
doctl serverless invoke <function-name> [options>
doctl serverless logs <function-name|namespace-name> [options>
PARAMETERS
namespaces
A subcommand for managing serverless namespaces. It enables operations like creating, listing, getting details of, and deleting namespaces, which serve as logical groupings for functions.
functions
A subcommand for managing individual serverless functions within a namespace. It provides operations to list, get detailed information about, and delete functions.
triggers
A subcommand for managing serverless triggers, which define the events that invoke functions (e.g., web requests, cron schedules, or message queues).
deploy
Deploys a serverless project from a local directory to a specified DigitalOcean Functions namespace. This command handles the building, packaging, and uploading of your functions.
invoke
Invokes a deployed function, allowing you to pass an optional payload. It displays the function's response and the activation ID of the execution.
logs
Retrieves execution logs for a specific function or an entire namespace, which is crucial for debugging and monitoring the behavior of your serverless applications.
get
A versatile subcommand used to retrieve detailed information about various serverless resources, commonly used in conjunction with 'functions get' or 'namespaces get'.
delete
A versatile subcommand used to remove serverless resources, such as specific functions, entire namespaces, or triggers. Often used as 'functions delete' or 'namespaces delete'.
status
Checks the deployment status of a serverless project within a namespace, indicating if the deployment is pending, complete, or has encountered errors.
DESCRIPTION
The doctl-serverless command is a powerful plugin for the DigitalOcean CLI (doctl) specifically designed for interacting with and managing DigitalOcean Functions (serverless) deployments. It provides a comprehensive set of tools to streamline the entire serverless development lifecycle directly from the command line, enabling developers to efficiently manage their serverless applications. Users can leverage doctl-serverless to perform critical operations such as deploying function code from local project directories to specified namespaces, listing and retrieving detailed information about existing functions and namespaces, and managing triggers that automate function execution. Furthermore, it facilitates real-time interaction by allowing users to invoke deployed functions with custom payloads and retrieve execution logs for debugging and monitoring. This command significantly simplifies the workflow for developers building and operating serverless applications on the DigitalOcean platform, offering granular control over deployments, resource management, and providing real-time insights into function performance and status.
CAVEATS
The doctl-serverless command is implemented as a plugin and therefore requires the main doctl CLI tool to be installed and properly configured with a DigitalOcean API token. It is exclusively designed for the DigitalOcean Functions serverless platform and relies on a specific project directory structure, typically defined by a project.yml file, for successful deployments.
INSTALLATION
The doctl-serverless plugin is often bundled with recent installations of the doctl CLI. If not present or to ensure you have the latest version, it can be easily installed or updated using the command: doctl plugin install serverless or doctl plugin update serverless.
PROJECT CONFIGURATION
For deploying functions, doctl-serverless expects a specific project structure within your local directory. This typically includes a project.yml file at the root, which defines namespaces, functions, routes, and associated settings, guiding the deployment process and ensuring proper resource provisioning on DigitalOcean.
HISTORY
DigitalOcean Functions, the serverless platform managed by this command, was introduced in beta around late 2021 and became generally available in early 2022. The doctl-serverless plugin was developed concurrently to provide a robust command-line interface for developers to build, deploy, and manage their serverless applications. Its ongoing development focuses on integrating seamlessly with the broader DigitalOcean ecosystem and continually simplifying the serverless workflow, with new features added as the Functions platform evolves.


