- Install doctl manually, or via choco.
choco install doctl
- Authorize doctl.
doctl auth init --context customname
- Switch to the new identity context.
doctl auth switch --context customname
- Install the DigitalOcean sandbox:
doctl sls install
- Connect to your sandbox:
doctl sandbox connect
- Modify
.do/deploy.template.yaml
- Edit
functions/github/repo
to your desired repouser/repo
. - Edit
functions/name
to your desired function name. - Edit
name
to your desired do function name.
- Edit
For more details see App Specification Reference and How To - Manage Functions
- In order to have the unmodified body be passed to your function, be sure to set the following in project.yml.
packages:
- name: test-serverless
actions:
- name: test
runtime: 'python:default'
web: raw
If you have dependencies in any of the actions,
you will need to implement build.<sh|cmd>
scripts for your platform.
doctl sls deploy . --incremental
If you'd rather just implement different platform build scripts, then use the following command to keep to one.
doctl sls deploy . --remote-build
If you have environment variables, add this flag to the deploy command.
--env .env
You may also use incremental directory watching to avoid having to run deployment automatically.
doctl sls watch .
Error: While deploying action 'some-service/action': Action is named in the config but does not exist in the project
This means that you've forgotten to rename the folder structures that your function lives in. Ex. packagtes/digitalocean-serverless/test
.
- Before you deploy to an app you'll need to make
build.sh
executable if you haven't already. Rungit update-index --chmod=+x path/to/build.sh
- Rename the function folder.
packages/myservice/function
->packages/newservice/newfuncname
- Update
project.yml
name fields. - Update
.do/deploy.template.yaml
name fields.
- If you rename the app, the
build.sh
folder will lose its 755 property. Run See Deploying to an App