serverless-leo version 3 is compatible with serverless@2 and serverless@3
serverless@1 is not supported
serverless create --template-url https://github.com/LeoPlatform/serverless-leo/tree/master/templates/microservice -p my-microservice
cd my-microservice
npm install
serverless create bot --name my-bot-name --type load --language node --destination my-write-queue
At this point, you will have a new project with a bots
directory including your new bot. There are two things to setup before your service can be deployed.
- Set the name and deploymentBucket of your service in the root
serverless.yml
file - Update the
leo_config.js
file to include the leo bus values your service will use
- In order to register this lambda in your workspace, you need to add the relative path to the newly created folder in your root cargo.toml workspace members.
- Update the bus_config() of the main.rs in your newly created bot template to have the correct provider information.
Once you've made these changes, you can run serverless deploy
which will use your default AWS_PROFILE.
- Clone project locally
- Run
npm link
in this project's/src
directory. - In a test project, run
npm link serverless-leo
.- At this point, any
serverless
commands will use your localserverless-leo
plugin
- At this point, any
Additionally, if you are making bot template changes, you can temporarily add this to the bottom of create:bot:copy-template
hook in order to use local path files instead of the repo url.
this.options['template-path'] = path.resolve(`${__dirname}/../templates/bot/${language}/${type}`)
delete this.options['template-url']