The DroneDeploy provider implementaion for the Serverless Framework.
Create a DroneDeploy account
Become a DroneDeploy developer (see account settings on the DroneDeploy site)
Obtain a DroneDeploy developer API key
Contact firstname.lastname@example.org and ask for a developer API key
Take a look at our example apps
Install the Serverless Framework
npm install -g serverless
Create new service with the
serverless create --name test-service --template-url "https://github.com/dronedeploy/app-examples/tree/master/IFTTT"
If you have the template repository already cloned locally use this command to create service
serverless create --name test-service --template-path "<path to app-examples>/IFTTT"
cd test-service npm install
Sign in to DroneDeploy with your api key
serverless config credentials --provider=dronedeploy --key=<YOUR API KEY>
serverless.ymlwith your app's id or create new app with
serverless deploy app --name "my app name"
This will automatically insert new app id into the configuration file.
index.jsaccording to your needs.
Deploy all your functions
or deploy a single selected function
serverless deploy --function <function name>
Functions deployment via DroneDeploy provider requires additional fields in
serverless.yml file. Typical structure of
functions block should look like
app: my-app-id functions: helloWorld: handler: helloWorld
where the top level
app field should point to your DroneDeploy app's id and
key mapping for the function should be a unique string among your deployed
functions for the app.
Additionally, you can pass a
540s) field. By
timeout = 60s.
Configuration with functions sub-folders
Often, it is useful to organize multiple functions into sub-folders to keep
the directory structure clean. The configuration can support this, while still
serverless.yml at the top-level folder. When this is done, a path
to the function(s) must be specified in
Extending the snippet above, if the
helloWorld function were located in a
functions/hello, the function configuration would look like this:
app: my-app-id functions: helloWorld: handlerPath: functions/hello handler: helloWorld
DroneDeploy functions can make use of SQL style tables via the Datastore API.
These tables can be defined in
serverless.yml to make setup and configuration
This is done by adding a
resources section to a function definition and then
For example, and OAuth function might want to store the token data in order to determine access without making a new authorization request every time.
app: my-app-id functions: oauth: handlerPath: function/oauth handler: oauth resources: tables: token-table: description: table to store token data columns: - name: accessToken type: Text encrypted: true length: 255 description: Holds the OAuth access token - name: expiresAt type: DateTime description: The date and time that the token expires - name: refreshToken type: Text encrypted: true length: 255 description: Holds the OAuth refresh token
Tables common to all defined functions can be defined by placing the
property with the table definitions at the root level in
level as the
app: my-app-id functions: ... resources: tables: table-1-name: ... table-2-name: ...
Valid Datastore column types include:
Text column types, two additional properties are available:
encrypted: Encrypts if the column data if true
length: Length of text allowed in the column, defaults to 255
DroneDeploy Functions can take action based on different events that occur in the DroneDeploy platform. These are called Triggers. For example, if you want a function to run once an Export operation has finished, a Trigger can be configured for Export Complete.
The following is an example of how to configure a trigger for a particular function:
app: my-app-id functions: my-example: handlerPath: functions/example handler: exportComplete events: - trigger: object-type: Export type: complete
Multiple triggers may also be configured for a single function if desired. This can be done with the following syntax:
app: my-app-id functions: my-example: handlerPath: functions/example handler: processComplete events: - trigger: object-type: Export type: complete - trigger: object-type: MapPlan type: complete
The following Event Object Types and Event Types are currently supported by the DroneDeploy platform:
Event Object Type (Event Type):
- Export (complete)
- MapPlan (complete)
How to use DroneDeploy Triggers
As we are currently in Beta release and things are subject to change, for now, in order to have your function execute on the defined trigger, you MUST define a handler in your function code.
The handler is for the
__ddfunctiontrigger route, and when called by the
DroneDeploy platform, should execute the desired code in response to the event.
DroneDeploy help commands
Get help for all available commands:
Get help for specific command:
sls <command> --help
Contributions are welcome! Please make a pull request on this repository.