$ npm install -g serverless
┌───────────────────────────────────────────────────┐
│ │
│ Serverless Framework successfully installed! │
│ │
│ To start your first project run 'serverless'. │
│ │
└───────────────────────────────────────────────────┘
$ serverless -v
Framework Core: 1.64.0
Plugin: 3.4.1
SDK: 2.3.0
Components Core: 1.1.2
Components CLI: 1.4.0
from ${GOPATH}/src
directory
$ serverless create -t aws-go-mod -u https://github.com/kichion/ -p mischievous-slack-bot
Serverless: Generating boilerplate...
Serverless: Generating boilerplate in "/mischievous-slack-bot"
_______ __
| _ .-----.----.--.--.-----.----| .-----.-----.-----.
| |___| -__| _| | | -__| _| | -__|__ --|__ --|
|____ |_____|__| \___/|_____|__| |__|_____|_____|_____|
| | | The Serverless Application Framework
| | serverless.com, v1.64.0
-------'
Serverless: Successfully generated boilerplate for template: "aws-go-mod"
rewrite serverless.yml
(profile use ME)
provider:
name: aws
runtime: go1.x
# add start
region: ap-northeast-1
profile: me
# add end
....
functions:
events:
handler: bin/events
events:
# add start
- http:
path: events
method: get
- http:
path: events
method: post
# add end
command execute
$ make deploy
rm -rf ./bin ./vendor Gopkg.lock
chmod u+x gomod.sh
./gomod.sh
export GO111MODULE=on
....
Serverless: Run the "serverless" command to setup monitoring, troubleshooting and testing.
select Bots
(Basic Information > Add features and functionality > Bots).
setup Events API (need Request URI from Event Subscriptions page).
install bot to Workspace.
getting app auth token(Install App > Bot User OAuth Access Token).
arrangement mischievous-slack-bot.json
in S3
mischievous-slack-bot.json
is secret of google project service_account