diff --git a/.computenest/README.md b/.computenest/README.md new file mode 100644 index 0000000..8c6fc6b --- /dev/null +++ b/.computenest/README.md @@ -0,0 +1,21 @@ +# 代码仓库结构 + +## 文档目录说明: +``` +. +├── README.md - README +├── docs - 服务文档相关文件 +│ └── index.md +├── resources - 服务资源文件 +│ ├── icons +│ │ └── service_logo.png - 服务logo +│ └── artifact_resources - 部署物相关资源文件 +├── ros_templates - 服务ROS模板目录,支持多模板 +│ └── template.yaml - ROS模板,ROS模板引擎根据该模板会自动创建出所有的资源 +├── config.yaml - 服务配置文件,服务构建过程中会使用计算巢命令行工具computenest-cli,computenest-cli会基于该配置文件构建服务 +├── preset_parameters.yaml - (该文件只有托管版有)服务商预设参数,如VpcId,VSwitchId等,该ros模板内容会渲染为表单方便服务商填写 +``` + +## 其他 +关于ROS模板,请参见 [资源编排](https://help.aliyun.com/zh/ros)。 +关于computenest-cli请参见 [computenest-cli](https://pypi.org/project/computenest-cli/)。 diff --git a/.computenest/config.yaml b/.computenest/config.yaml new file mode 100644 index 0000000..f8694b5 --- /dev/null +++ b/.computenest/config.yaml @@ -0,0 +1,130 @@ +Service: + RegionId: cn-hangzhou + DeployType: ros + DeployMetadata: + ServiceInstanceNameRule: + Prefix: docker + SupplierDeployMetadata: + ArtifactRelation: + 'centos_7_9_x64_20G_alibase_20240403.vhd': + ArtifactId: ${Artifact.EcsImage.ArtifactId} + ArtifactVersion: ${Artifact.EcsImage.ArtifactVersion} + TemplateConfigs: + - Name: 选择ECS实例(仅Linux) + Url: 'ros_templates/template-select-ecs.yaml' + AllowedRegions: + - cn-qingdao + - cn-beijing + - cn-zhangjiakou + - cn-huhehaote + - cn-wulanchabu + - cn-hangzhou + - cn-shanghai + - cn-nanjing + - cn-shenzhen + - cn-heyuan + - cn-guangzhou + - cn-fuzhou + - cn-wuhan-lr + - cn-chengdu + - cn-hongkong + - ap-northeast-1 + - ap-northeast-2 + - ap-southeast-1 + - ap-southeast-3 + - ap-southeast-6 + - ap-southeast-5 + - ap-southeast-7 + - us-east-1 + - us-west-1 + - eu-west-1 + - me-east-1 + - eu-central-1 + - Name: 新建ECS实例 + Url: 'ros_templates/template-create-ecs.yaml' + AllowedRegions: + - cn-qingdao + - cn-beijing + - cn-zhangjiakou + - cn-huhehaote + - cn-wulanchabu + - cn-hangzhou + - cn-shanghai + - cn-nanjing + - cn-shenzhen + - cn-heyuan + - cn-guangzhou + - cn-fuzhou + - cn-wuhan-lr + - cn-chengdu + - cn-hongkong + - ap-northeast-1 + - ap-northeast-2 + - ap-southeast-1 + - ap-southeast-3 + - ap-southeast-6 + - ap-southeast-5 + - ap-southeast-7 + - us-east-1 + - us-west-1 + - eu-west-1 + - me-east-1 + - eu-central-1 + ServiceType: private + ServiceInfo: + Locale: zh-CN + ShortDescription: docker deploy + Image: 'resources/icons/service_logo.png' +Artifact: + EcsImage: + ArtifactType: EcsImage + ArtifactName: docker + Description: docker + ArtifactProperty: + RegionId: ${ImageBuilder.EcsImage.RegionId} + ImageId: ${ImageBuilder.EcsImage.SourceImageId} + SupportRegionIds: + - cn-qingdao + - cn-beijing + - cn-zhangjiakou + - cn-huhehaote + - cn-wulanchabu + - cn-hangzhou + - cn-shanghai + - cn-nanjing + - cn-shenzhen + - cn-heyuan + - cn-guangzhou + - cn-fuzhou + - cn-wuhan-lr + - cn-chengdu + - cn-hongkong + - ap-northeast-1 + - ap-northeast-2 + - ap-southeast-1 + - ap-southeast-3 + - ap-southeast-6 + - ap-southeast-5 + - ap-southeast-7 + - us-east-1 + - us-west-1 + - eu-west-1 + - me-east-1 + - eu-central-1 +ImageBuilder: + EcsImage: + RegionId: ap-southeast-1 + SourceImageId: centos_7_9_x64_20G_alibase_20240403.vhd + InstanceType: ecs.c6.large + InternetMaxBandwidthOut: 5 + CommandType: RunShellScript + Timeout: 10800 + Tags: [ ] + CommandContent: |- + #!/bin/bash + yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo + yum makecache fast + yum install -y git + yum -y install docker-ce jq + systemctl enable docker + systemctl start docker \ No newline at end of file diff --git a/.computenest/docs/architecture_ecs_single.png b/.computenest/docs/architecture_ecs_single.png new file mode 100644 index 0000000..087d61f Binary files /dev/null and b/.computenest/docs/architecture_ecs_single.png differ diff --git a/.computenest/docs/index_ecs_single.md b/.computenest/docs/index_ecs_single.md new file mode 100644 index 0000000..3f829f8 --- /dev/null +++ b/.computenest/docs/index_ecs_single.md @@ -0,0 +1,70 @@ +# 服务模板说明文档 + +## 服务说明 + +**简单描述服务的功能和用途。** +例如: +_(服务功能描述,如“WordPress 是一款免费开源的 CMS,适用于创建和管理各种类型的网站。”)_ + +_(服务快速上手链接或文档,如果有的话)_ + +## 服务架构 + +此服务模板构建出的服务的部署架构为单机ecs部署。 + + + +## 计费说明 +通过此服务模板构建服务不产生费用。 +用户部署构建出的服务时,资源费用主要涉及: +- 所选ECS实例规格 +- 磁盘容量 +- 公网带宽 + +计费方式包括: +- 按量付费(小时) +- 包年包月 + +预估费用在部署前可实时看到。 + +## RAM账号所需权限 + +此服务模板构建出的服务需要对ECS、VPC等资源进行访问和创建操作,若使用RAM用户创建服务实例,需要在创建服务实例前,对使用的RAM用户的账号添加相应资源的权限。添加RAM权限的详细操作,请参见[为RAM用户授权](https://help.aliyun.com/document_detail/121945.html)。所需权限如下表所示: + +| 权限策略名称 | 备注 | +|-------------------------------------|-------------------------------| +| AliyunECSFullAccess | 管理云服务器服务(ECS)的权限 | +| AliyunVPCFullAccess | 管理专有网络(VPC)的权限 | +| AliyunROSFullAccess | 管理资源编排服务(ROS)的权限 | +| AliyunComputeNestUserFullAccess | 管理计算巢服务(ComputeNest)的用户侧权限 | +| AliyunComputeNestSupplierFullAccess | 管理计算巢服务(ComputeNest)的服务商侧权限 | | + +## 服务实例计费说明 + +**详细说明服务实例的计费方式。** +_(描述费用构成,例如所选 vCPU 和内存规格,系统盘类型和容量等)_ + +_(列出计费方式,例如按量付费或包年包月)_ + +## 服务实例部署流程 + +### 部署参数说明 + +| 参数组 | 参数项 | 说明 | +|---------------------------------|--------|-------------------------------------------------------------------------| +| 服务实例 | 服务实例名称 | 长度不超过64个字符,必须以英文字母开头,可包含数字、英文字母、短划线(-)和下划线(_)。 | +| | 地域 | 服务实例部署的地域。 | +| | 付费类型 | 资源的计费类型:按量付费和包年包月。 | +| ECS实例配置 | 实例类型 | ECS实例规格配置。 | +| | 实例密码 | 长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*-+=|{}[]:;'<>,.?/ 中的特殊符号)。 | +| 网络配置 | 可用区 | ECS实例所在可用区。 | + +### 部署步骤 + +**简述如何一步步部署服务实例。** + +1. _(步骤1描述和相关链接或图片,如果有的话)_ +2. _(步骤2描述和相关链接或图片,如果有的话)_ +... + +[部署链接](部署链接地址) \ No newline at end of file diff --git a/.computenest/resources/artifact_resources/docker_compose/docker-compose.yaml b/.computenest/resources/artifact_resources/docker_compose/docker-compose.yaml new file mode 100644 index 0000000..7e9e666 --- /dev/null +++ b/.computenest/resources/artifact_resources/docker_compose/docker-compose.yaml @@ -0,0 +1,49 @@ +version: "3" + +services: + halo: + image: registry.fit2cloud.com/halo/halo:2.17 + restart: on-failure:3 + depends_on: + halodb: + condition: service_healthy + networks: + halo_network: + volumes: + - ./halo2:/root/.halo2 + ports: + - "8090:8090" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8090/actuator/health/readiness"] + interval: 30s + timeout: 5s + retries: 5 + start_period: 30s + command: + - --spring.r2dbc.url=r2dbc:pool:postgresql://halodb/halo + - --spring.r2dbc.username=halo + # PostgreSQL 的密码,请保证与下方 POSTGRES_PASSWORD 的变量值一致。 + - --spring.r2dbc.password=openpostgresql + - --spring.sql.init.platform=postgresql + # 外部访问地址,请根据实际需要修改 + - --halo.external-url=http://localhost:8090/ + halodb: + image: postgres:15.4 + restart: on-failure:3 + networks: + halo_network: + volumes: + - ./db:/var/lib/postgresql/data + healthcheck: + test: [ "CMD", "pg_isready" ] + interval: 10s + timeout: 5s + retries: 5 + environment: + - POSTGRES_PASSWORD=openpostgresql + - POSTGRES_USER=halo + - POSTGRES_DB=halo + - PGUSER=halo + +networks: + halo_network: diff --git a/.computenest/resources/icons/service_logo.png b/.computenest/resources/icons/service_logo.png new file mode 100644 index 0000000..6c37525 Binary files /dev/null and b/.computenest/resources/icons/service_logo.png differ diff --git a/.computenest/ros_templates/template-create-ecs.yaml b/.computenest/ros_templates/template-create-ecs.yaml new file mode 100644 index 0000000..5e0d252 --- /dev/null +++ b/.computenest/ros_templates/template-create-ecs.yaml @@ -0,0 +1,271 @@ +ROSTemplateFormatVersion: '2015-09-01' +Description: + en: Deploy docker CE + zh-cn: 部署docker社区版 +Parameters: + ZoneId: + Type: String + AssociationProperty: ALIYUN::ECS::Instance::ZoneId + Label: + en: VSwitch Availability Zone + zh-cn: 交换机可用区 + WhetherCreateVpc: + Type: Boolean + Label: + en: WhetherCreateVpc + zh-cn: 是否新建VPC + Default: false + VpcId: + Type: String + Label: + en: VPC ID + zh-cn: 专有网络VPC实例ID + Default: '' + AssociationProperty: ALIYUN::ECS::VPC::VPCId + AssociationPropertyMetadata: + Visible: + Condition: + Fn::Equals: + - ${WhetherCreateVpc} + - false + VSwitchId: + Type: String + Label: + en: VSwitch ID + zh-cn: 交换机实例ID + Default: '' + AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId + AssociationPropertyMetadata: + VpcId: ${VpcId} + ZoneId: ${ZoneId} + Visible: + Condition: + Fn::Equals: + - ${WhetherCreateVpc} + - false + VpcCidrBlock: + Type: String + Label: + en: VPC CIDR IPv4 Block + zh-cn: 专有网络IPv4网段 + Description: + zh-cn: VPC的ip地址段范围,
您可以使用以下的ip地址段或其子网:
[10.0.0.0/8]
[172.16.0.0/12]
[192.168.0.0/16] + en: 'The ip address range of the VPC in the CidrBlock form;
You can use the following ip address ranges and their subnets:
[10.0.0.0/8]
[172.16.0.0/12]
[192.168.0.0/16]' + Default: 192.168.0.0/16 + AssociationProperty: ALIYUN::VPC::VPC::CidrBlock + AssociationPropertyMetadata: + Visible: + Condition: + Fn::Equals: + - ${WhetherCreateVpc} + - true + VSwitchCidrBlock: + Type: String + Label: + en: VSwitch CIDR Block + zh-cn: 交换机子网网段 + Description: + zh-cn: 必须属于VPC的子网段。 + en: Must belong to the subnet segment of VPC. + Default: 192.168.1.0/24 + AssociationProperty: ALIYUN::VPC::VSwitch::CidrBlock + AssociationPropertyMetadata: + VpcCidrBlock: VpcCidrBlock + Visible: + Condition: + Fn::Equals: + - ${WhetherCreateVpc} + - true + EcsInstanceType: + Type: String + Label: + en: Instance Type + zh-cn: 实例类型 + AssociationProperty: ALIYUN::ECS::Instance::InstanceType + AssociationPropertyMetadata: + ZoneId: ${ZoneId} + InstanceChargeType: ${InstanceChargeType} + InstancePassword: + NoEcho: true + Type: String + AllowedPattern: '[0-9A-Za-z\_\-\&:;''<>,=%`~!@#\(\)\$\^\*\+\|\{\}\[\]\.\?\/]+$' + Label: + en: Instance Password + zh-cn: 实例密码 + ConstraintDescription: + en: Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in) + zh-cn: 长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号) + MinLength: 8 + MaxLength: 30 + AssociationProperty: ALIYUN::ECS::Instance::Password + PayType: + Type: String + Label: + en: ECS Instance Charge Type + zh-cn: 付费类型 + Default: PostPaid + AllowedValues: + - PostPaid + - PrePaid + AssociationProperty: ChargeType + AssociationPropertyMetadata: + LocaleKey: InstanceChargeType + PayPeriodUnit: + Type: String + Description: + en: The long cycle of purchasing resources.
Week is a Week and Month is a Month.
The default value is month.
When ECS instance types are PrePaid valid + zh-cn: 购买资源时长的周期。
Week为周,Month为月
默认值为月
当ECS实例类型为PrePaid有效 + Label: + en: Pay Period Unit + zh-cn: 购买资源时长周期 + Default: Month + AllowedValues: + - Month + - Year + AssociationProperty: PayPeriodUnit + AssociationPropertyMetadata: + Visible: + Condition: + Fn::Not: + Fn::Equals: + - ${PayType} + - PostPaid + PayPeriod: + Type: Number + Label: + en: Period + zh-cn: 购买资源时长 + Default: 1 + AllowedValues: + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + - 8 + - 9 + AssociationProperty: PayPeriod + AssociationPropertyMetadata: + Visible: + Condition: + Fn::Not: + Fn::Equals: + - ${PayType} + - PostPaid +Mappings: {} +Conditions: + CreateVpcConditions: + Fn::Equals: + - true + - Ref: WhetherCreateVpc +Resources: + EcsVpc: + Type: ALIYUN::ECS::VPC + Condition: CreateVpcConditions + Properties: + CidrBlock: + Ref: VpcCidrBlock + VpcName: + Ref: ALIYUN::StackName + EcsVSwitch: + Type: ALIYUN::ECS::VSwitch + Condition: CreateVpcConditions + Properties: + VpcId: + Ref: EcsVpc + ZoneId: + Ref: ZoneId + CidrBlock: + Ref: VSwitchCidrBlock + EcsSecurityGroup: + Type: ALIYUN::ECS::SecurityGroup + Properties: + VpcId: + Fn::If: + - CreateVpcConditions + - Ref: EcsVpc + - Ref: VpcId + SecurityGroupIngress: + - Priority: 1 + PortRange: 22/22 + SourceCidrIp: 0.0.0.0/0 + IpProtocol: tcp + EcsInstanceGroup: + Type: ALIYUN::ECS::InstanceGroup + Properties: + ZoneId: + Ref: ZoneId + IoOptimized: optimized + InstanceChargeType: + Ref: PayType + PeriodUnit: + Ref: PayPeriodUnit + Period: + Ref: PayPeriod + VpcId: + Fn::If: + - CreateVpcConditions + - Ref: EcsVpc + - Ref: VpcId + VSwitchId: + Fn::If: + - CreateVpcConditions + - Ref: EcsVSwitch + - Ref: VSwitchId + SecurityGroupId: + Ref: EcsSecurityGroup + SystemDiskCategory: cloud_essd + # 系统盘大小可以根据需要调整 + SystemDiskSize: 100 + # 数据盘配置 + MaxAmount: 1 + ImageId: centos_7 + InstanceType: + Ref: EcsInstanceType + Password: + Ref: InstancePassword + # 公网带宽, 为0代表不开公网 + InternetMaxBandwidthOut: 5 + InstanceName: + Fn::Join: + - '-' + - - Ref: ALIYUN::StackName + - '[1,4]' +Metadata: + ALIYUN::ROS::Interface: + ParameterGroups: + - Parameters: + - PayType + - PayPeriodUnit + - PayPeriod + Label: + default: + en: PayType Configuration + zh-cn: 付费类型配置 + - Parameters: + - EcsInstanceType + - SystemDiskCategory + - SystemDiskSize + - InstancePassword + Label: + default: + zh-cn: ECS实例配置 + en: ECS Instance Configuration + - Parameters: + - ZoneId + Label: + default: + zh-cn: 可用区配置 + en: Zone Configuration + - Parameters: + - WhetherCreateVpc + - VpcCidrBlock + - VSwitchCidrBlock + - VpcId + - VSwitchId + Label: + default: + zh-cn: 选择已有基础资源配置 + en: Choose existing Infrastructure Configuration \ No newline at end of file diff --git a/.computenest/ros_templates/template-select-ecs.yaml b/.computenest/ros_templates/template-select-ecs.yaml new file mode 100644 index 0000000..9d1f779 --- /dev/null +++ b/.computenest/ros_templates/template-select-ecs.yaml @@ -0,0 +1,50 @@ +ROSTemplateFormatVersion: '2015-09-01' +Description: + en: Deploy docker CE + zh-cn: 部署docker社区版 +Parameters: + InstanceId: + Type: String + Label: + en: Select Running Linux ECS Instance with public network access enabled + zh-cn: 选择公网Linux实例 + Description: + en: