Aliyun function compute demo service.
- What is aliyun function compute: documentation
- Get played with aliyun function compute console
Function compute is actually based on container technology, and if we want to simulate production environment, we need to install docker locally, fcli、fun & web ide also depends on docker.
Use your own aliyun docker registry to speed up image installation.
Install aliyun function compute command line tool: fcli.
Install aliyun function compute deploy and locally running tool: fun
Install aliyun function compute web ide: Web IDE
And install project dependencies:
$ npm i
$ npm run bootstrap
In fcli shell, we can do the same thing as on web console, e.g. create, update, delete services and functions, invoke functions... We can also simulate production environment locally, but can not test run functions locally.
We suggest use fcli to read and invoke. For creation, deploy and local test running, it's better to use fun. And web ide has better ui interface for function invoke, which does not support local test running yet.
fcli & fun use the same config file.
$ fcli config
$ npm start
Now we entered into fcli shell environment, here's the documentation of how to play.
Simulate production environment:
# In fcli shell
$ sbox -d ${YourFunctionDirectory} -t nodejs8
# e.g. hello-world function
$ sbox -d hello-world -t nodejs8
In fcli shell:
- Use
mks
command to create service, usemkf
command to create function - Use
ups
command to update service, useupf
command to update function
In fcli shell:
- Use
invk
command to run function
- How to use fun
template.yml
is the config of services and functions this project includes, which will be used by funevent.json
is the test event data for local running.funignore
indicates which files should be ignored while deploying
fcli & fun use the same config file. We suggest use fun to develop & deploy.
$ fun config
$ npm run dev
$ npm run release
Web ide does not support local running yet. We suggest use it to run on-line functions. Also config by fcli or fun is required.
$ ide start
$ ide stop