Skip to content

Commit

Permalink
commit by Serverless devs docs 1-19-2024 10:10:25
Browse files Browse the repository at this point in the history
  • Loading branch information
serverless-devs committed Jan 19, 2024
1 parent bf702f8 commit 39f1f3a
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 49 deletions.
60 changes: 38 additions & 22 deletions content/en/serverless-devs/command/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,31 @@ position: 2
category: 'Commands'
---
# Command Operation Documentation

- [Preface](#preface)
- [Global Parameters](#global-parameters)
- [Command Details](#command-details)
- [config: Key Configuration](./config.md)
- [init: Project Initialization](./init.md)
- [cli: Pure Command Line Mode](./cli.md)
- [clean: Tool Cleanup](./clean.md)
- [component: Component Information](./component.md)
- [set: Tool Configuration](./set.md)
- [custom: Custom Commands](./custom.md)
- [registry: Template Management](./registry.md)
- [preview: Preview Render Results](./preview.md)
- [config: Key Configuration](./config.md)
- [init: Project Initialization](./init.md)
- [cli: Pure Command Line Mode](./cli.md)
- [clean: Tool Cleanup](./clean.md)
- [component: Component Information](./component.md)
- [set: Tool Configuration](./set.md)
- [custom: Custom Commands](./custom.md)
- [registry: Template Management](./registry.md)
- [preview: Preview Render Results](./preview.md)
- [verify: Verify Yaml Content](./verify.md)

## Preface

Serverless Devs can invoke the corresponding help documentation for commands using `-h`. For example, to view help information for the `s` command, you can use: `s -h`

```shell script
$ s -h
😃 Welcome to the Serverless Devs

Usage: s [options] [command]

Options:
--debug Open debug model
--skip-actions Skip the extends section
Expand All @@ -35,37 +42,45 @@ Options:
--silent Silent mode
-v, --version Output the version number
-h, --help Display help for command

Commands:
config 👤 Configure vendors account
config 👤 Configure venders account
env 🌱 Environment operation
set 🔧 Settings for the tool
registry 🚢 Serverless registry platform
preview [options] 👀 Preview Yaml render results
preview 👀 Preview Yaml render results
component 🔌 Installed component information
clean [options] 💥 Clean up the environment
init [options] 💞 Initializing a serverless project
verify 🔭 Verify Yaml content
<custom> 🧭 Custom Commands


🙌 Quick Start: https://docs.serverless-devs.com/quick-start
🌟 Github Repo: https://github.com/Serverless-Devs/Serverless-Devs
💡 Documentation: https://docs.serverless-devs.com
🚀 Example Projects: https://registry.serverless-devs.com
📝 Feedback: https://github.com/Serverless-Devs/Serverless-Devs/issues
```

## Global Parameters

| Full Parameter | Abbreviation | Default Value | Meaning | Notes |
|-----|-----|-----|-----|-----|
| template | t | `s.yaml`/`s.yml` | Specify the resource description file | |
| access | a | Specified in `yaml` or `default` | Specify the key information for the deployment | Can use keys configured via [config command](./command/config.md#config-add-command), as well as [keys configured in environment variables](./command/config.md#setting-keys-via-environment-variables) |
| skip-actions | - | - | Skip the `actions` module set in `yaml` | - |
| debug | - | - | Enable `Debug` mode | Enabling `Debug` mode allows viewing more information about tool execution |
| output | o | `default` | Specify the data output format | Supports `default`, `json`, `yaml`, `raw` formats |
| version | v | - | View version information | - |
| help | h | - | View help information | - |
| silent | - | - | Silent mode | Will only output component execution results |
| env | - | - | Specify the environment | Used in multi-environment scenarios |
| output-file | - | - | Specify the output file path | - |
| no-verify | - | - | Do not verify `yaml` file | - |
| template | t | `s.yaml`/`s.yml` | Specify the resource description file | |
| access | a | Specified in `yaml` or `default` | Specify the key information for the deployment | Can use keys configured via [config command](./command/config.md#config-add-command), as well as [keys configured in environment variables](./command/config.md#setting-keys-via-environment-variables) |
| skip-actions | - | - | Skip the `actions` module set in `yaml` | - |
| debug | - | - | Enable `Debug` mode | Enabling `Debug` mode allows viewing more information about tool execution |
| output | o | `default` | Specify the data output format | Supports `default`, `json`, `yaml`, `raw` formats |
| version | v | - | View version information | - |
| help | h | - | View help information | - |
| silent | - | - | Silent mode | Will only output component execution results |
| env | - | - | Specify the environment | Used in multi-environment scenarios |
| output-file | - | - | Specify the output file path | - |
| no-verify | - | - | Do not verify `yaml` file | - |

## Command Details

- [config: Key Configuration](./config.md)
- [init: Project Initialization](./init.md)
- [cli: Pure Command Line Mode](./cli.md)
Expand All @@ -75,3 +90,4 @@ Commands:
- [custom: Custom Commands](./custom.md)
- [registry: Template Management](./registry.md)
- [preview: Preview Render Results](./preview.md)
- [verify: Verify Yaml Content](./verify.md)
18 changes: 9 additions & 9 deletions content/en/serverless-devs/quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ After downloading locally, unzip it and use it directly.

#### Windows Platform

1. Find a latest release version (Release) and download the `s-*-win.exe.zip` file (where * represents the version number, such as 2.1.9).
1. Find a latest release version (Release) and download the `s-*-win.exe.zip` file (where * represents the version number, such as v3.0.0).
2. Unzip the file `s-*-win.exe.zip` to get `s-*.win.exe` file, rename it to `s.exe`.
3. Just copy the s.exe file to the system PATH directory, for example: `C:\WINDOWS\System32`
4. Open the command terminal, execute `s.exe --version`, and check the returned version number to verify whether the installation is successful.


#### Linux platform
1. Find a latest release version (Release) and download the `s-*-linux.zip` file (where * represents the version number, such as 2.1.9).
1. Find a latest release version (Release) and download the `s-*-linux.zip` file (where * represents the version number, such as v3.0.0).
2. Extract the zip file
```
$ unzip s-linux.zip
Archive: s-2.1.9-linux.zip
inflating: s-2.1.9-linux
Archive: s-v3.0.0-linux.zip
inflating: s-v3.0.0-linux
```
3. Move to PATH directory
```
Expand All @@ -66,17 +66,17 @@ $ mv s-*-linux /usr/local/bin/s
4. Verify version
```
$ s -v
@serverless-devs/s: 2.1.9
@serverless-devs/s: 3.0.0
```


#### MacOS platform
1. Find the latest release version (Release) and download the `s-*-macos.zip` file (where * represents the version number, such as 2.1.9).
1. Find the latest release version (Release) and download the `s-*-macos.zip` file (where * represents the version number, such as v3.0.0).
2. Extract the zip file
```
$ unzip s-macos.zip
Archive: s-2.1.9-macos.zip
inflating: s-2.1.9-macos
Archive: s-v3.0.0-macos.zip
inflating: s-v3.0.0-macos
```

3. Move to PATH directory
Expand All @@ -87,7 +87,7 @@ $ mv s-*-macos /usr/local/bin/s
4. Verify version
```
$ s -v
@serverless-devs/s: 2.1.9
@serverless-devs/s: 3.0.0
```

### Install via script
Expand Down
2 changes: 1 addition & 1 deletion content/zh/fc3/command/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ PATH=/code/apt-archives/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bi

## apt-get.list

此文件顾名思义,就是声明可以使用 apt-get 命令安装但是函数计算没有系统包
此文件顾名思义,就是声明可以使用 apt-get 命令安装函数计算 runtime 环境没有的系统包

使用方式是在 code 目录的根目录下,创建一个 apt-get.list 的文件,文件内容如下所示。然后部署之前执行 `s build` 即可。

Expand Down
11 changes: 6 additions & 5 deletions content/zh/serverless-devs/cicd.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,30 +209,31 @@ jenkins-alicloud-access-key-secret : 阿里云 accessKeySecret
- 在自定义命令中,输入以下内容即可:
<img src="https://img.alicdn.com/imgextra/i1/O1CN01GhYPXD22biGZOvM1X_!!6000000007139-2-tps-2872-1576.png" />

```
```shell script
# input your command here
s config add --AccessKeyID ${ACCESSKEYID} --AccessKeySecret ${ACCESSKEYSECRET} -a default -f
s deploy -y --use-local
s deploy -y --use-local -a default
```

这里主要包括两个部分:

- `s config add --AccessKeyID ${ACCESSKEYID} --AccessKeySecret ${ACCESSKEYSECRET} -a default -f`
通过`config`命令进行密钥等信息的配置;
- `s deploy -y --use-local`
- `s deploy -y --use-local -a default`
执行某些命令,例如通过`deploy`进行项目的部署,或者`build`等命令进行构建等;

效果如下:

![image](https://user-images.githubusercontent.com/21079031/144697943-2ce9ea56-7af8-4c3b-945b-6897e6d744b5.png)
![image](https://github.com/Serverless-Devs/Serverless-Devs/assets/43384183/f6df38d1-65c7-4251-b1e8-2538998b8655)

由于在命令中,引用了两个重要的环境变量:`ACCESSKEYID`, `ACCESSKEYSECRET`,所以还需要在环境变量中,增加类似的内容:

![image](https://user-images.githubusercontent.com/21079031/144699074-3dad63d7-835f-4eb8-bd95-662de683dbbc.png)

## 注意事项

- 在配置密钥的时候,使用了`s config add --AccessKeyID ${ACCESSKEYID} --AccessKeySecret ${ACCESSKEYSECRET} -a default -f`命令,此时`-a default`代表的是给该密钥一个叫`default`的别名,这个别名要和项目所设定的使用密钥保持一致,例如在`s.yaml`中的`access`字段;`-f` 是指如果存在同别名的密钥则强制替换,防止使用配置不生效
- 在配置密钥的时候,使用了`s config add --AccessKeyID ${ACCESSKEYID} --AccessKeySecret ${ACCESSKEYSECRET} -a default -f`命令,此时`-a default`代表的是给该密钥一个叫`default`的别名,这个别名要和项目所设定的使用密钥保持一致,例如在`s.yaml`中的`access`字段;`-f` 是指如果存在同别名的密钥则强制替换,防止使用配置不生效。
- 如果用户在`s.yaml``access`属性中使用了不同于`default`的别名,那么可能会导致配置的密钥不生效。因此,在`s deploy`中,需要使用`-a`指定使用上文配置的`default`密钥,这样就可以无视`s.yaml``access`指定的密钥信息,强制使用`default`的密钥信息。
- 如果在当前应用在,涉及到了配置部署到不同的平台或者账号下,可能会涉及到配置多个密钥信息,此时需要给不同的密钥不同的别名,并且在`s.yaml`中进行使用;
- 如果想要配置更为灵活的密钥信息,可以考虑通过`-il``-kl`参数获取,例如同时配置两对密钥,并且使用自定义 Key :
```yaml
Expand Down
9 changes: 6 additions & 3 deletions content/zh/serverless-devs/command/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ category: '命令'
- [custom: 自定义命令](./custom.md)
- [registry: 模板管理](./registry.md)
- [preview: 预览渲染结果](./preview.md)
- [verify: 校验Yaml内容](./verify.md)


## 前言
Expand All @@ -45,14 +46,15 @@ Options:
-h, --help Display help for command

Commands:
config 👤 Configure vendors account
config 👤 Configure venders account
env 🌱 Environment operation
set 🔧 Settings for the tool
registry 🚢 Serverless registry platform
preview [options] 👀 Preview Yaml render results
preview 👀 Preview Yaml render results
component 🔌 Installed component information
clean [options] 💥 Clean up the environment
init [options] 💞 Initializing a serverless project
verify 🔭 Verify Yaml content
<custom> 🧭 Custom Commands


Expand Down Expand Up @@ -89,4 +91,5 @@ Commands:
- [component: 组件信息](./component.md)
- [custom: 自定义命令](./custom.md)
- [registry: 模板管理](./registry.md)
- [preview: 预览渲染结果](./preview.md)
- [preview: 预览渲染结果](./preview.md)
- [verify: 校验Yaml内容](./verify.md)
18 changes: 9 additions & 9 deletions content/zh/serverless-devs/quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ $ yarn global add @serverless-devs/s

#### Windows 平台

1. 找到一个最新的发布版本(Release),下载 `s-*-win.exe.zip` 文件(其中 * 表示版本号,如 2.1.9)。
1. 找到一个最新的发布版本(Release),下载 `s-*-win.exe.zip` 文件(其中 * 表示版本号,如 v3.0.0)。
2. 解压文件 `s-*-win.exe.zip` 得到 `s-*.win.exe` 文件,重名为 `s.exe`
3.`s.exe` 文件拷贝到系统 PATH 目录即可,比如:`C:\WINDOWS\System32`
4. 打开命令终端,执行 `s.exe --version`,查看返回版本号以验证是否安装成功。


#### Linux 平台
1. 找到一个最新的发布版本(Release),下载 `s-*-linux.zip` 文件(其中 * 表示版本号,如 2.1.9)。
1. 找到一个最新的发布版本(Release),下载 `s-*-linux.zip` 文件(其中 * 表示版本号,如 v3.0.0)。
2. 解压 zip 文件
```
$ unzip s-linux.zip
Archive: s-2.1.9-linux.zip
inflating: s-2.1.9-linux
Archive: s-v3.0.0-linux.zip
inflating: s-v3.0.0-linux
```
3. 移到 PATH 目录
```
Expand All @@ -67,17 +67,17 @@ $ mv s-*-linux /usr/local/bin/s
4. 验证版本
```
$ s -v
@serverless-devs/s: 0.0.13
@serverless-devs/s: 3.0.0
```


#### MacOS 平台
1. 找到一个最新的发布版本(Release),下载 `s-*-macos.zip` 文件(其中 * 表示版本号,如 2.1.9)。
1. 找到一个最新的发布版本(Release),下载 `s-*-macos.zip` 文件(其中 * 表示版本号,如 v3.0.0)。
2. 解压 zip 文件
```
$ unzip s-macos.zip
Archive: s-2.1.9-macos.zip
inflating: s-2.1.9-macos
Archive: s-v3.0.0-macos.zip
inflating: s-v3.0.0-macos
```

3. 移到 PATH 目录
Expand All @@ -88,7 +88,7 @@ $ mv s-*-macos /usr/local/bin/s
4. 验证版本
```
$ s -v
@serverless-devs/s: 0.0.13
@serverless-devs/s: 3.0.0
```

### 通过脚本安装
Expand Down

0 comments on commit 39f1f3a

Please sign in to comment.