Template for IBM Cloud Functions with TypeScript and webpack.
- Register IBM Cloud Lite
- Get API Key on https://cloud.ibm.com/iam/apikeys.
- Install
ibmcloudcli & loginbrew install ibm-cloud-cli # it conflicts with /Application/Docker.app that not installed by brew cask ibmcloud plugin install cloud-functions ibmcloud login --apikey <APIKEY> ibmcloud resource groups ibmcloud target -g <default group id> ibmcloud fn namespace list ibmcloud fn namespace target <namespace which u want to use>
- Use this template and clone a repository
git clone <your generated repo> cd reponame
- Build & deploy
yarn yarn build
- Install direnv and make
.envrcand applybrew install direnv # follow intro like add a line to .zshrc touch .envrc.envrc:export WEBHOOK_URL='your discord webhook url' export TARGET_ACTION_NAME='/1111-2222-3333/test/webhook'
direnv allow . - Deploy
yarn deploy # $ ibmcloud fn deploy --manifest manifest.yaml # Success: Deployment completed successfully.
- Enjoy!
After deploying, check the name of the action with the following command:
ibmcloud fn package list # packages # /aaaa-bbbb-dddd-8226-aaaa/test private # ^ test's project name ibmcloud fn action list /aaaa-bbbb-dddd-8226-aaaa/test # actions # /aaaa-bbbb-dddd-8226-aaaa/test/test private nodejs:12 # ^ action's name
In this case, /aaaa-bbbb-dddd-8226-aaaa/test/test is action's name.
To deploy, rewrite .envrc as
export TARGET_ACTION_NAME="/aaaa-bbbb-dddd-8226-aaaa/test/test"
And,
direnv allow .
yarn deployRead https://github.com/apache/openwhisk-wskdeploy/tree/master/specification/html.
- (Japanese) IBM Cloud Functions の Action/Trigger/Rule を yaml ファイル一発でデプロイする - Qiita
- Hands on IBM Cloud Functions with CLI | inDev. Journal
ibmcloud iam service ids=>ibmcloud iam service-ids
- (Japanese) IBM Cloud Functions でバックグラウンド処理をする 2021 年 8 月版