2021-01-14 15:04:47 +00:00
|
|
|
|
import _ from 'lodash-es'
|
2020-12-25 17:37:53 +00:00
|
|
|
|
import optionsPrivate from './options.private.js'
|
2020-12-15 16:35:05 +00:00
|
|
|
|
const defaultOptions = {
|
2020-12-20 16:32:17 +00:00
|
|
|
|
args: {
|
|
|
|
|
forceCert: false, // 强制更新证书
|
|
|
|
|
skipCert: false, // 是否跳过证书申请环节
|
2021-01-08 08:59:53 +00:00
|
|
|
|
forceDeploy: true,
|
2021-01-14 15:04:47 +00:00
|
|
|
|
test: false
|
2020-12-20 16:32:17 +00:00
|
|
|
|
},
|
2020-12-18 17:57:52 +00:00
|
|
|
|
accessProviders: {
|
2020-12-15 16:35:05 +00:00
|
|
|
|
aliyun: {
|
|
|
|
|
providerType: 'aliyun',
|
|
|
|
|
accessKeyId: '',
|
|
|
|
|
accessKeySecret: ''
|
|
|
|
|
},
|
2020-12-25 17:37:53 +00:00
|
|
|
|
dnspod: {
|
|
|
|
|
providerType: 'dnspod',
|
|
|
|
|
id: '',
|
|
|
|
|
token: ''
|
|
|
|
|
},
|
|
|
|
|
tencent: {
|
|
|
|
|
providerType: 'tencent',
|
|
|
|
|
secretId: '',
|
|
|
|
|
secretKey: ''
|
|
|
|
|
},
|
2020-12-15 16:35:05 +00:00
|
|
|
|
myLinux: {
|
|
|
|
|
providerType: 'SSH',
|
|
|
|
|
username: 'xxx',
|
|
|
|
|
password: 'xxx',
|
|
|
|
|
host: '1111.com',
|
|
|
|
|
port: 22,
|
|
|
|
|
publicKey: ''
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
cert: {
|
2020-12-20 16:32:17 +00:00
|
|
|
|
domains: ['*.docmirror.cn'],
|
2020-12-15 16:35:05 +00:00
|
|
|
|
email: 'xiaojunnuo@qq.com',
|
2021-02-04 10:44:16 +00:00
|
|
|
|
dnsProvider: {
|
|
|
|
|
type:'aliyun',
|
|
|
|
|
accessProvider:'aliyun'
|
|
|
|
|
},
|
2020-12-15 16:35:05 +00:00
|
|
|
|
csrInfo: {
|
|
|
|
|
country: 'CN',
|
|
|
|
|
state: 'GuangDong',
|
|
|
|
|
locality: 'ShengZhen',
|
|
|
|
|
organization: 'CertD Org.',
|
|
|
|
|
organizationUnit: 'IT Department',
|
|
|
|
|
emailAddress: 'xiaojunnuo@qq.com'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
deploy: [
|
|
|
|
|
{
|
2021-01-01 18:47:58 +00:00
|
|
|
|
deployName: '流程1-部署到阿里云系列产品',
|
2021-02-04 03:17:54 +00:00
|
|
|
|
disabled: false,
|
2020-12-15 16:35:05 +00:00
|
|
|
|
tasks: [
|
|
|
|
|
{
|
2021-01-01 18:47:58 +00:00
|
|
|
|
taskName: '上传证书到云',
|
2020-12-18 17:57:52 +00:00
|
|
|
|
type: 'uploadCertToAliyun',
|
2021-01-01 18:47:58 +00:00
|
|
|
|
props:{
|
|
|
|
|
accessProvider: 'aliyun'
|
|
|
|
|
}
|
2020-12-15 16:35:05 +00:00
|
|
|
|
},
|
2020-12-18 17:57:52 +00:00
|
|
|
|
{ // CDN、SCDN、DCDN和负载均衡(SLB)
|
2021-01-01 18:47:58 +00:00
|
|
|
|
taskName: '部署证书到CDN',
|
2020-12-20 16:32:17 +00:00
|
|
|
|
type: 'deployCertToAliyunCDN',
|
2021-01-01 18:47:58 +00:00
|
|
|
|
props:{
|
|
|
|
|
domainName: 'certd-cdn-upload.docmirror.cn',
|
|
|
|
|
certName: 'certd部署测试(upload)',
|
2021-02-08 06:00:28 +00:00
|
|
|
|
from: 'upload',
|
2021-01-01 18:47:58 +00:00
|
|
|
|
accessProvider: 'aliyun'
|
|
|
|
|
}
|
2020-12-15 16:35:05 +00:00
|
|
|
|
}
|
2020-12-20 16:32:17 +00:00
|
|
|
|
// {
|
|
|
|
|
// name: '部署证书到阿里云集群Ingress',
|
|
|
|
|
// type: 'deployCertToAliyunK8sIngress',
|
|
|
|
|
// accessProvider: 'aliyun'
|
|
|
|
|
// }
|
2020-12-15 16:35:05 +00:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
2021-01-01 18:47:58 +00:00
|
|
|
|
deployName: '流程2-部署到nginx服务器',
|
2021-02-08 07:46:03 +00:00
|
|
|
|
disabled: false,
|
2020-12-15 16:35:05 +00:00
|
|
|
|
tasks: [
|
|
|
|
|
{
|
2021-02-08 06:00:28 +00:00
|
|
|
|
taskName: '上传证书到服务器',
|
|
|
|
|
type: 'uploadCertToHost',
|
2021-01-01 18:47:58 +00:00
|
|
|
|
props:{
|
2021-02-08 07:46:03 +00:00
|
|
|
|
accessProvider: 'aliyun-ssh',
|
|
|
|
|
crtPath: '/root/certd-test/cert.pem',
|
|
|
|
|
keyPath: '/root/certd-test/cert.key'
|
2021-01-01 18:47:58 +00:00
|
|
|
|
}
|
2021-02-08 06:00:28 +00:00
|
|
|
|
},
|
2020-12-15 16:35:05 +00:00
|
|
|
|
{
|
2021-02-08 06:00:28 +00:00
|
|
|
|
taskName: '重启linux',
|
|
|
|
|
type: 'hostShellExecute',
|
2021-01-01 18:47:58 +00:00
|
|
|
|
props:{
|
2021-02-08 07:46:03 +00:00
|
|
|
|
accessProvider: 'aliyun-ssh',
|
2021-02-08 06:00:28 +00:00
|
|
|
|
script: ['ls']
|
2021-01-01 18:47:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
deployName: '流程4-部署到腾讯云ingress',
|
2021-02-04 03:17:54 +00:00
|
|
|
|
disabled: true,
|
2021-01-01 18:47:58 +00:00
|
|
|
|
tasks: [
|
|
|
|
|
{
|
|
|
|
|
taskName: '上传到腾讯云',
|
|
|
|
|
type: 'uploadCertToTencent',
|
|
|
|
|
props:{
|
|
|
|
|
accessProvider: 'tencent-yonsz'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
taskName: '部署到TKE-ingress',
|
|
|
|
|
type: 'deployCertToTencentTKEIngress',
|
|
|
|
|
props:{
|
|
|
|
|
clusterId:'cls-6lbj1vee',
|
|
|
|
|
ingressName:'ingress-base',
|
|
|
|
|
secretName:'certd-base-yonsz-net-hnuzjrzf',
|
|
|
|
|
accessProvider: 'tencent-yonsz'
|
|
|
|
|
}
|
2020-12-15 16:35:05 +00:00
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_.merge(defaultOptions, optionsPrivate)
|
|
|
|
|
|
2020-12-25 17:37:53 +00:00
|
|
|
|
export function createOptions(){
|
2021-02-08 05:40:28 +00:00
|
|
|
|
return _.cloneDeep(defaultOptions)
|
2020-12-25 17:37:53 +00:00
|
|
|
|
}
|
2021-02-08 05:40:28 +00:00
|
|
|
|
|
|
|
|
|
export function getDnsProviderOptions (options) {
|
|
|
|
|
if(!options){
|
|
|
|
|
options = createOptions()
|
|
|
|
|
}
|
|
|
|
|
return { accessProviders: options.accessProviders, props: options.cert.dnsProvider }
|
|
|
|
|
}
|