Delete
LICENCE.markdown
before you start doing anything.
- 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
- After the function has been successfully deployed,
call
doctl sbx fn get namespace/function --url
to get the URL of your function. - Use
wget <link>
to activate a simple function. - Use
doctl sls activations get
to get the results of the most recent activation.
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 the build scripts executable if you haven't already. Run
git update-index --chmod=+x path/to/build.ext
for each of the builds scripts.
- 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 scripts will lose their 755 property. Run See Deploying to an App