Skip to content

Commit

Permalink
Merge pull request #1 from workhardliuzheng/main
Browse files Browse the repository at this point in the history
参数管结合docker compose
  • Loading branch information
workhardliuzheng authored Dec 19, 2024
2 parents a196ca1 + cf55113 commit e041074
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 184 deletions.
28 changes: 14 additions & 14 deletions .computenest/.computenest_parameters.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
ServiceType: private
AllowedRegions:
- ap-southeast-1
RoleName: ComputeNestDeploy
ZoneId: ap-southeast-1a
VpcId: vpc-t4nqpdxw25u2i6eidt6yo
ServiceType: managed
VSwitchId: vsw-t4nr1hmvcmvknt43ebmhw
ArtifactSourceType: DockerCompose
RepoName: aliyun-computenest/mongodb
ServiceBuildRegion: ap-southeast-1
RepoName: workhardliuzheng/mongodb
DockerComposeEnvPath: .env.example
RegionId: cn-hangzhou
CustomParameters:
- NoEcho: false
Type: String
AllowedValues:
- root
- master
- main
AllowedPattern: ''
Label: UserName
Label: 用户名
ConstraintDescription: ''
Default: admin
Default: root
Name: MONGO_INITDB_ROOT_USERNAME
- NoEcho: true
Type: String
AssociationProperty: ALIYUN::ECS::Instance::Password
AllowedPattern: ''
Label: Password
ConstraintDescription: ''
Name: MONGO_INITDB_ROOT_PASSWORD
DockerComposeYamlPath: docker-compose.yaml
Owner: Alicloud-ComputeNest
Owner: workhardliuzheng
Branch: main
Platform: github
77 changes: 63 additions & 14 deletions .computenest/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ Service:
DeployType: ros
OperationMetadata:
StatusOperationConfigs:
- TemplateName: 'ECS单机版'
- TemplateName: 'Template'
SupportOperations:
- Start
- Stop
- Restart
SupportBackup: true
ModifyParametersConfig:
- TemplateName: ECS单机版
- TemplateName: 'Template'
Operation:
- Name: 变更ECS实例规格
Description: 变更ECS实例规格
Expand All @@ -22,21 +22,69 @@ Service:
Type: Custom
Parameters:
- InstancePassword

ParameterConfigs:
- TemplateName: 'Template'
Parameters:

Default.MONGO_INITDB_ROOT_USERNAME:
Type: String
Default: root
Description: 用户名





AllowedValues:

- root
- master
- main

Metadata:
ParameterGroups:
- Parameters:
- MONGO_INITDB_ROOT_USERNAME

DefaultValue: |-
MONGO_INITDB_ROOT_USERNAME=root
MONGO_INITDB_ROOT_PASSWORD=pleaseChangeMe
Formatter: env
Name: Default

DeployMetadata:
ServiceInstanceNameRule:
Prefix: mongo
SupplierDeployMetadata:
RoleName: ComputeNestDeploy
UserType: Aliyun
SupplierTemplateConfigs:
- Name: 'Template'
Url: 'ros_templates/template.yaml'
AllowedRegions:
- ap-southeast-1
PredefinedParameters: []
HiddenParameterKeys:
- VpcId
- VSwitchId
- ZoneId
ParameterMappings:
- ParameterKey: RegionId
ParameterMappingKeys:
- VpcId
- ZoneId
- VSwitchId
ParameterValueMapping:
ap-southeast-1:
Parameters:
VpcId: vpc-t4nqpdxw25u2i6eidt6yo
ZoneId: ap-southeast-1a
VSwitchId: vsw-t4nr1hmvcmvknt43ebmhw
ArtifactRelation:
ecs_image_mongodb:
ArtifactId: ${Artifact.EcsImage.ArtifactId}
ArtifactVersion: draft
TemplateConfigs:
- Name: ECS单机版
Url: 'ros_templates/template.yaml'
# 未选择部署地域则采用 []
AllowedRegions:
- ap-southeast-1
ServiceType: private
ServiceType: managed
ServiceInfo:
Locale: zh-CN
ShortDescription: demo
Expand All @@ -46,13 +94,13 @@ Artifact:
ArtifactType: EcsImage
ArtifactName: ecs_image_mongodb
Description: mongodb EcsImage
SupportRegionIds:
SupportRegionIds:
- ap-southeast-1
ArtifactBuildProperty:
CodeRepo:
Platform: github
Owner: Alicloud-ComputeNest
RepoName: aliyun-computenest/mongodb
Owner: workhardliuzheng
RepoName: workhardliuzheng/mongodb
Branch: main
RegionId: ap-southeast-1
CommandType: RunShellScript
Expand All @@ -63,5 +111,6 @@ Artifact:
if [ -e "/root/code/mongodata" ]; then cp -r "/root/code/mongodata" "/root/application/"; fi
cd /root/application
cp .env.example ./.env
sed -i 's/pull_policy: always/pull_policy: if_not_present/g' docker-compose.yaml
docker compose -f docker-compose.yaml build
docker compose -f docker-compose.yaml pull || true;
54 changes: 54 additions & 0 deletions .computenest/preset_parameters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
ROSTemplateFormatVersion: '2015-09-01'
# 定义参数
Parameters:
RoleName:
Type: String
Label:
en: Role Name
zh-cn: 角色名
AssociationProperty: ALIYUN::RAM::Service::Role
AssociationPropertyMetadata:
Service: supplier.computenest.aliyuncs.com
APIProduct: resourcegroup
IsServiceLinedRole: false
Description: 请前往RAM控制台创建角色,角色需拥有上述模板定义的资源所需的创建权限。<a href='https://help.aliyun.com/zh/compute-nest/create-a-compute-nest-ram-role-and-grant-permissions-to-the-role' target='_blank'><b> 查看文档</b><font color='blue'></a>
# 可用区
ZoneId:
Type: String
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
Label:
en: VSwitch Available Zone
zh-cn: 可用区
# VPC实例ID
VpcId:
AssociationProperty: ALIYUN::ECS::VPC::VPCId
Type: String
Label:
en: VPC ID
zh-cn: 专有网络VPC实例ID
# 交换机实例ID
VSwitchId:
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
AssociationPropertyMetadata:
VpcId: ${VpcId}
ZoneId: ${ZoneId}
Type: String
Label:
en: VSwitch ID
zh-cn: 交换机实例ID
Metadata:
ALIYUN::ROS::Interface:
# 定义资源分组,创建服务实例时,同一分组的参数分布在一起
ParameterGroups:
- Parameters:
- RoleName
Label:
en: Basic Configuration
zh-cn: 基础配置
- Parameters:
- ZoneId
- VpcId
- VSwitchId
Label:
en: Network Configuration
zh-cn: 网络配置
Loading

0 comments on commit e041074

Please sign in to comment.