Skip to content

Commit

Permalink
feat: add dice yaml environments description and example (#266)
Browse files Browse the repository at this point in the history
* feat: add dice yaml environments description and example

* more precise description

* feat: update docs
  • Loading branch information
CeerDecy authored Jul 22, 2024
1 parent 8ea6d5f commit 2e03306
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 3 deletions.
53 changes: 52 additions & 1 deletion docs/2.4/manual/dop/guides/reference/dice-yaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,27 @@ envs: {}
services: {}

addons: {}

environments:
development:
envs: {}
services: {}
addons: {}
test:
envs: {}
services: {}
addons: {}
staging:
envs: {}
services: {}
addons: {}
production:
envs: {}
services: {}
addons: {}
```
dice.yml 文件的全局结构定义了 5 项全局配置,具体说明如下。
dice.yml 文件的全局结构定义了 6 项全局配置,具体说明如下。
### version
Expand Down Expand Up @@ -379,6 +397,39 @@ options:
create_dbs: blog,blog2
```

### environments 配置项
environments 配置项可分为 development、test、staging 以及 production 四个 workspace 名称,分别代表开发环境、测试环境、预发环境和生产环境。

针对于不同的运行环境可以单独配置[envs](#envs)、[services](#service-配置项)、[addons](#addon-配置项)。

示例如下:
```yaml
environments:
production:
envs:
EXAMPLE_ENV: prod
staging:
envs:
EXAMPLE_ENV: staging
test:
envs:
EXAMPLE_ENV: test
services:
example_demo:
image: registry.erda.cloud/erda/go-demo:1719970022481890617
resources:
cpu: 0.1
mem: 256
development:
envs:
EXAMPLE_ENV: dev
addons:
redis:
plan: redis:basic
options:
version: 6.2.10
```

## 变量引用
### 平台级变量
在 dice.yml 的 `.services[serviceName].endpoints[i].domain` 字段值中,可引用平台级变量,引用语法为 `${platform.Key}`。
Expand Down
53 changes: 52 additions & 1 deletion docs/en/next/manual/dop/guides/reference/dice-yaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,27 @@ envs: {}
services: {}

addons: {}

environments:
development:
envs: {}
services: {}
addons: {}
test:
envs: {}
services: {}
addons: {}
staging:
envs: {}
services: {}
addons: {}
production:
envs: {}
services: {}
addons: {}
```
The global structure of the dice.yml file defines 5 items of the global configuration, as described below.
The global structure of the dice.yml file defines 6 items of the global configuration, as described below.
### version
Expand Down Expand Up @@ -366,6 +384,39 @@ options:
create_dbs: blog,blog2
```

### environments
The environments configuration item can be categorized into four workspace names: development, test, staging, and production.

You can configure [envs](#envs), [services](#service), and [addons](#addon) for different workspace.

See the example below:
```yaml
environments:
production:
envs:
EXAMPLE_ENV: prod
staging:
envs:
EXAMPLE_ENV: staging
test:
envs:
EXAMPLE_ENV: test
services:
example_demo:
image: registry.erda.cloud/erda/go-demo:1719970022481890617
resources:
cpu: 0.1
mem: 256
development:
envs:
EXAMPLE_ENV: dev
addons:
redis:
plan: redis:basic
options:
version: 6.2.10
```

## Variable Reference
### Platform-Level Variable
Platform-level variables can be referenced in the field value of `.services[serviceName].endpoints[i].domain` in the dice.yml with the syntax `${platform.Key}`.
Expand Down
53 changes: 52 additions & 1 deletion docs/next/manual/dop/guides/reference/dice-yaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,27 @@ envs: {}
services: {}

addons: {}

environments:
development:
envs: {}
services: {}
addons: {}
test:
envs: {}
services: {}
addons: {}
staging:
envs: {}
services: {}
addons: {}
production:
envs: {}
services: {}
addons: {}
```
dice.yml 文件的全局结构定义了 5 项全局配置,具体说明如下。
dice.yml 文件的全局结构定义了 6 项全局配置,具体说明如下。
### version
Expand Down Expand Up @@ -379,6 +397,39 @@ options:
create_dbs: blog,blog2
```

### environments 配置项
environments 配置项可分为 development、test、staging 以及 production 四个 workspace 名称,分别代表开发环境、测试环境、预发环境和生产环境。

针对于不同的运行环境可以单独配置[envs](#envs)、[services](#service-配置项)、[addons](#addon-配置项)。

示例如下:
```yaml
environments:
production:
envs:
EXAMPLE_ENV: prod
staging:
envs:
EXAMPLE_ENV: staging
test:
envs:
EXAMPLE_ENV: test
services:
example_demo:
image: registry.erda.cloud/erda/go-demo:1719970022481890617
resources:
cpu: 0.1
mem: 256
development:
envs:
EXAMPLE_ENV: dev
addons:
redis:
plan: redis:basic
options:
version: 6.2.10
```

## 变量引用
### 平台级变量
在 dice.yml 的 `.services[serviceName].endpoints[i].domain` 字段值中,可引用平台级变量,引用语法为 `${platform.Key}`。
Expand Down

0 comments on commit 2e03306

Please sign in to comment.