Merge remote-tracking branch 'origin/v2' into v2

# Conflicts:
#	packages/ui/certd-server/src/plugins/plugin-other/plugins/index.ts
pull/189/head
xiaojunnuo 2024-09-16 15:52:35 +08:00
commit 4c37ec3222
59 changed files with 618 additions and 179 deletions

View File

@ -64,10 +64,10 @@ jobs:
username: ${{ secrets.dockerhub_username }}
password: ${{ secrets.dockerhub_password }}
- name: Build and push
- name: Build default platforms
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: linux/amd64,linux/arm64
push: true
context: ./packages/ui/
tags: |
@ -75,3 +75,15 @@ jobs:
registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${{steps.get_certd_version.outputs.result}}
greper/certd:latest
greper/certd:${{steps.get_certd_version.outputs.result}}
- name: Build armv7
uses: docker/build-push-action@v6
with:
platforms: linux/arm/v7
push: true
context: ./packages/ui/
tags: |
registry.cn-shenzhen.aliyuncs.com/handsfree/certd:armv7
registry.cn-shenzhen.aliyuncs.com/handsfree/certd:${{steps.get_certd_version.outputs.result}}-armv7
greper/certd:armv7
greper/certd:${{steps.get_certd_version.outputs.result}}-armv7

View File

@ -3,6 +3,20 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.24.4](https://github.com/certd/certd/compare/v1.24.3...v1.24.4) (2024-09-09)
### Bug Fixes
* 修复腾讯云cdn证书部署后会自动关闭hstshttp2.0等配置的bug ([7908ab7](https://github.com/certd/certd/commit/7908ab79da624c94fa05849925b15e480e3317c4))
* 修复腾讯云tke证书部署报错的bug ([653f409](https://github.com/certd/certd/commit/653f409d91a441850d6381f89a8dd390831f0d5e))
### Performance Improvements
* 插件选择支持搜索 ([d1498a7](https://github.com/certd/certd/commit/d1498a71601b74d38343b1d070eadd03705dd9d5))
* 前置任务步骤增加错误提示 ([ae3daa9](https://github.com/certd/certd/commit/ae3daa9bcf4fc363825aad9b77f5d3879aeeff70))
* 群晖部署教程 ([0f0af2f](https://github.com/certd/certd/commit/0f0af2f309390f388e7a272cea3a1dd30c01977d))
* 支持群晖 ([5c270b6](https://github.com/certd/certd/commit/5c270b6b9d45a2152f9fdb3c07bd98b7c803cb8e))
## [1.24.3](https://github.com/certd/certd/compare/v1.24.2...v1.24.3) (2024-09-06)
### Performance Improvements

View File

@ -13,7 +13,7 @@ https://afdian.com/a/greper
1. 可加入发电专属群,可以获得作者一对一技术支持
2. 您的需求我们将优先实现,并且将作为专业版功能提供
3. 一年期专业版激活码
4. 赠送国外免费服务器部署方案0成本使用Certd不过该服务器需要翻墙
4. 赠送国外免费服务器部署方案0成本使用Certd可能需要翻墙,不过现在性能越来越差了
专业版特权
1. 证书流水线条数无限制免费版限制10条
@ -101,9 +101,11 @@ docker compose up -d
#### 镜像说明:
* 国内镜像地址:
* `registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest`
* `registry.cn-shenzhen.aliyuncs.com/handsfree/certd:armv7`、`[version]-armv7`
* DockerHub地址
* `https://hub.docker.com/r/greper/certd`
* `docker pull greper/certd:latest`
* `greper/certd:latest`
* `greper/certd:armv7`、`greper/certd:[version]-armv7`
* 镜像构建通过`Actions`自动执行,过程公开透明,请放心使用
* [点我查看镜像构建日志](https://github.com/certd/certd/actions/workflows/build-image.yml)
@ -157,6 +159,7 @@ docker compose up -d
* [腾讯云](./doc/tencent/tencent.md)
* [windows主机](./doc/host/host.md)
* [google证书](./doc/google/google.md)
* [群晖部署certd及证书更新教程](./doc/synology/index.md)
## 八、问题处理

View File

@ -1 +1 @@
7
1

0
doc/deploy/koyeb.md Normal file
View File

BIN
doc/synology/images/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

BIN
doc/synology/images/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

BIN
doc/synology/images/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
doc/synology/images/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

BIN
doc/synology/images/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
doc/synology/images/6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

41
doc/synology/index.md Normal file
View File

@ -0,0 +1,41 @@
# 群晖部署和证书更新
## 一、群晖系统上部署Certd教程
### 1. 打开Container Manager
![](./images/1.png)
### 2. 新增项目
![](./images/2.png)
### 3. 配置Certd项目
![](./images/3.png)
### 4. 外网访问设置
![](./images/4.png)
### 5. 确认项目信息
![](./images/5.png)
点击完成安装等待certd启动完成即可
### 6. 门户配置向导【可选】
![](./images/6.png)
## 二、更新群晖证书
## 1. 前提条件
* 已经部署了certd
* 群晖上已经设置好了证书(证书建议设置好描述,插件需要根据描述查找证书)
## 2. 在certd上配置自动更新群晖证书插件
![](./images/deploy.png)

View File

@ -1,38 +1,40 @@
version: '3.3'
#version: '3.3'
services:
certd:
# 镜像 # ↓↓↓↓↓ --- 镜像版本号,建议改成固定版本号【可选】
# 镜像 # ↓↓↓↓↓ --- 镜像版本号,建议改成固定版本号
image: registry.cn-shenzhen.aliyuncs.com/handsfree/certd:latest
container_name: certd # 容器名
restart: unless-stopped # 自动重启
volumes:
# ↓↓↓↓↓ -------------------------------------------------------- 数据库以及证书存储路径,默认存在宿主机的/data/certd/目录下【可选
# ↓↓↓↓↓ -------------------------------------------------------- 数据库以及证书存储路径,默认存在宿主机的/data/certd/目录下,【您需要定时备份此目录,以保障数据容灾
- /data/certd:/app/data
ports: # 端口映射
# ↓↓↓↓ ---------------------------------------------------------- 如果端口有冲突可以修改第一个7001为其他不冲突的端口号【可选】
# ↓↓↓↓ ---------------------------------------------------------- 如果端口有冲突可以修改第一个7001为其他不冲突的端口号
- "7001:7001"
dns:
# 如果出现getaddrinfo ENOTFOUND等错误可以尝试修改或注释dns配置
# ↓↓↓↓ ---------------------------------------------------------- 如果出现getaddrinfo ENOTFOUND等错误可以尝试修改或注释dns配置
- 223.5.5.5
- 223.6.6.6
# ↓↓↓↓ ---------------------------------------------------------- 如果你服务器部署在国外可以用8.8.8.8替换上面的dns【可选】
# ↓↓↓↓ ---------------------------------------------------------- 如果你服务器部署在国外可以用8.8.8.8替换上面的dns
# - 8.8.8.8
# - 8.8.4.4
# extra_hosts:
# ↓↓↓↓ ---------------------------------------------------------- 这里可以配置自定义hosts外网域名可以指向本地局域网ip地址
# - "localdomain.comm:192.168.1.3"
environment: # 环境变量
- TZ=Asia/Shanghai
#- HTTPS_PROXY=http://xxxxxx:xx
#- HTTP_PROXY=http://xxxxxx:xx
# ↑↑↑↑↑ ------------------------------------- 这里可以设置http代理【可选】
# ↑↑↑↑↑ ------------------------------------- 这里可以设置http代理
- certd_system_resetAdminPasswd=false
# ↑↑↑↑↑--------------------------- 如果忘记管理员密码可以设置为true重启之后管理员密码将改成123456然后请及时修改回false【可选】
# ↑↑↑↑↑--------------------------- 如果忘记管理员密码可以设置为true重启之后管理员密码将改成123456然后请及时修改回false
- certd_cron_immediateTriggerOnce=false
# ↑↑↑↑↑--------------------------- 如果设置为true启动后所有配置了cron的流水线任务都将被立即触发一次【可选】
# ↑↑↑↑↑--------------------------- 如果设置为true启动后所有配置了cron的流水线任务都将被立即触发一次
- VITE_APP_ICP_NO=
# ↑↑↑↑↑ ----------------------------------------- 这里可以设置备案号【可选】
# ↑↑↑↑↑ ----------------------------------------- 这里可以设置备案号
#- certd_koa_key=./data/ssl/cert.key
#- certd_koa_cert=./data/ssl/cert.crt
# ↑↑↑↑↑ ----------------------------------------- 配置证书和key则表示https方式启动访问网址要使用 https://your.domain:7001【可选】
# ↑↑↑↑↑ ----------------------------------------- 配置证书和key则表示https方式启动使用https协议访问https://your.domain:7001
# 设置环境变量即可自定义certd配置
# 服务端配置项见: packages/ui/certd-server/src/config/config.default.ts
# 服务端配置规则: certd_ + 配置项, 点号用_代替

View File

@ -9,5 +9,5 @@
}
},
"npmClient": "pnpm",
"version": "1.24.3"
"version": "1.24.4"
}

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.24.4](https://github.com/publishlab/node-acme-client/compare/v1.24.3...v1.24.4) (2024-09-09)
**Note:** Version bump only for package @certd/acme-client
## [1.24.3](https://github.com/publishlab/node-acme-client/compare/v1.24.2...v1.24.3) (2024-09-06)
**Note:** Version bump only for package @certd/acme-client

View File

@ -3,7 +3,7 @@
"description": "Simple and unopinionated ACME client",
"private": false,
"author": "nmorsman",
"version": "1.24.3",
"version": "1.24.4",
"main": "src/index.js",
"types": "types/index.d.ts",
"license": "MIT",
@ -59,5 +59,5 @@
"bugs": {
"url": "https://github.com/publishlab/node-acme-client/issues"
},
"gitHead": "c49ccbde93dbad7062ac39d4f18eca7d561f573f"
"gitHead": "6fe2d2c3288b698e9cbdc91725abcbb072278fab"
}

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.24.4](https://github.com/certd/certd/compare/v1.24.3...v1.24.4) (2024-09-09)
### Performance Improvements
* 前置任务步骤增加错误提示 ([ae3daa9](https://github.com/certd/certd/commit/ae3daa9bcf4fc363825aad9b77f5d3879aeeff70))
* 群晖部署教程 ([0f0af2f](https://github.com/certd/certd/commit/0f0af2f309390f388e7a272cea3a1dd30c01977d))
* 支持群晖 ([5c270b6](https://github.com/certd/certd/commit/5c270b6b9d45a2152f9fdb3c07bd98b7c803cb8e))
## [1.24.3](https://github.com/certd/certd/compare/v1.24.2...v1.24.3) (2024-09-06)
### Performance Improvements

View File

@ -1 +1 @@
23:19
17:29

View File

@ -1,7 +1,7 @@
{
"name": "@certd/pipeline",
"private": false,
"version": "1.24.3",
"version": "1.24.4",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@ -20,6 +20,7 @@
"lodash-es": "^4.17.21",
"node-forge": "^1.3.1",
"nodemailer": "^6.9.3",
"proxy-agent": "^6.4.0",
"qs": "^6.11.2"
},
"devDependencies": {
@ -57,5 +58,5 @@
"vite": "^4.3.8",
"vue-tsc": "^1.6.5"
},
"gitHead": "c49ccbde93dbad7062ac39d4f18eca7d561f573f"
"gitHead": "6fe2d2c3288b698e9cbdc91725abcbb072278fab"
}

View File

@ -1,6 +1,4 @@
import { AxiosInstance } from "axios";
import { IContext } from "../core/index.js";
export type HttpClient = AxiosInstance;
export type UserContext = IContext;
export type PipelineContext = IContext;

View File

@ -12,7 +12,7 @@ import { RegistryItem } from "../registry/index.js";
import { Decorator } from "../decorator/index.js";
import { IEmailService } from "../service/index.js";
import { FileStore } from "./file-store.js";
import { hashUtils } from "../utils/index.js";
import { hashUtils, utils } from "../utils/index.js";
// import { TimeoutPromise } from "../utils/util.promise.js";
export type ExecutorOptions = {
@ -93,7 +93,7 @@ export class Executor {
await this.notification("success");
} catch (e: any) {
await this.notification("error", e);
this.logger.error("pipeline 执行失败", e.stack);
this.logger.error("pipeline 执行失败", e);
} finally {
clearInterval(intervalFlushLogId);
await this.onChanged(this.runtime);
@ -104,11 +104,18 @@ export class Executor {
async runWithHistory(runnable: Runnable, runnableType: string, run: () => Promise<ResultType | void>) {
runnable.runnableType = runnableType;
this.runtime.start(runnable);
// const timeout = runnable.timeout ?? 20 * 60 * 1000;
await this.onChanged(this.runtime);
try {
if (runnable.disabled) {
//该任务被禁用
this.runtime.disabled(runnable);
return ResultType.disabled;
}
await this.onChanged(this.runtime);
if (this.abort.signal.aborted) {
this.runtime.cancel(runnable);
return ResultType.canceled;
@ -217,11 +224,17 @@ export class Executor {
if (item.component?.name === "pi-output-selector") {
const contextKey = input[key];
if (contextKey != null) {
if (typeof contextKey !== "string") {
throw new Error(`步骤${step.title}${item.title}属性必须为String类型请重新配置该属性`);
}
// "cert": "step.-BNFVPMKPu2O-i9NiOQxP.cert",
const arr = contextKey.split(".");
const id = arr[1];
const outputKey = arr[2];
input[key] = this.currentStatusMap.get(id)?.status?.output[outputKey] ?? this.lastStatusMap.get(id)?.status?.output[outputKey];
if (input[key] == null) {
this.logger.warn(`${item.title}的配置未找到对应的输出值,请确认对应的前置任务是否存在或者是否执行正确`);
}
}
}
});
@ -231,14 +244,13 @@ export class Executor {
//判断是否需要跳过
const lastNode = this.lastStatusMap.get(step.id);
const lastResult = lastNode?.status?.status;
let inputChanged = true;
const lastInputHash = lastNode?.status?.inputHash;
if (lastInputHash && newInputHash && lastInputHash === newInputHash) {
//参数有变化
inputChanged = false;
}
if (step.strategy?.runStrategy === RunStrategy.SkipWhenSucceed) {
//如果是成功后跳过策略
let inputChanged = true;
const lastInputHash = lastNode?.status?.inputHash;
if (lastInputHash && newInputHash && lastInputHash === newInputHash) {
//参数有变化
inputChanged = false;
}
if (lastResult != null && lastResult === ResultType.success && !inputChanged) {
step.status!.output = lastNode?.status?.output;
step.status!.files = lastNode?.status?.files;
@ -253,6 +265,7 @@ export class Executor {
lastStatus,
http,
logger: currentLogger,
inputChanged,
accessService: this.options.accessService,
emailService: this.options.emailService,
pipelineContext: this.pipelineContext,
@ -263,6 +276,7 @@ export class Executor {
rootDir: this.options.fileRootDir,
}),
signal: this.abort.signal,
utils,
};
instance.setCtx(taskCtx);

View File

@ -74,6 +74,17 @@ export class RunHistory {
this.log(runnable, `跳过`);
}
disabled(runnable: Runnable) {
const now = new Date().getTime();
const status = runnable.status;
_.merge(status, {
status: "canceled",
endTime: now,
result: "disabled",
});
this.log(runnable, `禁用`);
}
error(runnable: Runnable, e: Error) {
const now = new Date().getTime();
const status = runnable.status;
@ -107,8 +118,8 @@ export class RunHistory {
logError(runnable: Runnable, e: Error) {
// @ts-ignore
const errorInfo = runnable.runnableType == "step" ? e.stack : e.message;
this._loggers[runnable.id].error(`[${runnable.runnableType}] [${runnable.title}]<id:${runnable.id}> ${errorInfo}`);
const errorInfo = runnable.runnableType === "step" ? e : e.message;
this._loggers[runnable.id].error(`[${runnable.runnableType}] [${runnable.title}]<id:${runnable.id}> `, errorInfo);
}
finally(runnable: Runnable) {

View File

@ -70,6 +70,7 @@ export type Runnable = {
default?: {
[key: string]: any;
};
disabled?: boolean;
};
export type EmailOptions = {
@ -108,6 +109,7 @@ export enum ResultType {
error = "error",
canceled = "canceled",
skip = "skip",
disabled = "disabled",
none = "none",
}

View File

@ -5,9 +5,9 @@ import { Logger } from "log4js";
import { IAccessService } from "../access/index.js";
import { IEmailService } from "../service/index.js";
import { IContext } from "../core/index.js";
import { AxiosInstance } from "axios";
import { ILogger, logger } from "../utils/index.js";
import { HttpClient } from "../utils/util.request";
import { utils } from "../utils/index.js";
export enum ContextScope {
global,
pipeline,
@ -57,17 +57,32 @@ export type TaskResult = {
pipelineVars: Record<string, any>;
};
export type TaskInstanceContext = {
//流水线定义
pipeline: Pipeline;
//步骤定义
step: Step;
//日志
logger: Logger;
//当前步骤输入参数跟上一次执行比较是否有变化
inputChanged: boolean;
//授权获取服务
accessService: IAccessService;
//邮件服务
emailService: IEmailService;
//流水线上下文
pipelineContext: IContext;
//用户上下文
userContext: IContext;
http: AxiosInstance;
//http请求客户端
http: HttpClient;
//文件存储
fileStore: FileStore;
//上一次执行结果状态
lastStatus?: Runnable;
//用户取消信号
signal: AbortSignal;
//工具类
utils: typeof utils;
};
export abstract class AbstractTaskPlugin implements ITaskPlugin {

View File

@ -1,11 +1,22 @@
import sleep from "./util.sleep.js";
import { request } from "./util.request.js";
import { http } from "./util.request.js";
export * from "./util.request.js";
export * from "./util.log.js";
export * from "./util.file.js";
export * from "./util.sp.js";
export * as promises from "./util.promise.js";
export * from "./util.promise.js";
export * from "./util.hash.js";
import { sp } from "./util.sp.js";
import { hashUtils } from "./util.hash.js";
import { promises } from "./util.promise.js";
import { fileUtils } from "./util.file.js";
import _ from "lodash-es";
export const utils = {
sleep,
http: request,
http,
sp,
hash: hashUtils,
promises,
file: fileUtils,
_,
};

View File

@ -24,3 +24,8 @@ export function safePromise<T>(callback: (resolve: (ret: T) => void, reject: (re
}
});
}
export const promises = {
TimeoutPromise,
safePromise,
};

View File

@ -1,29 +1,39 @@
import axios from "axios";
import axios, { AxiosRequestConfig } from "axios";
import { logger } from "./util.log.js";
import { Logger } from "log4js";
import { ProxyAgent, ProxyAgentOptions } from "proxy-agent";
export class HttpError extends Error {
request?: { url: string; method: string; data?: any };
response?: { data: any };
status?: number;
statusText?: string;
code?: string;
request?: { url: string; method: string; params?: any; data?: any };
response?: { data: any };
cause?: any;
constructor(error: any) {
if (!error) {
return;
}
super(error.message);
this.name = error.name;
this.stack = error.stack;
this.status = error?.response?.status;
this.statusText = error?.response?.statusText;
this.code = error.code;
this.cause = error.cause;
this.status = error.response?.status;
this.statusText = error.response?.statusText;
this.request = {
url: error?.response?.config?.url,
method: error?.response?.config?.method,
data: error?.response?.config?.data,
url: error.config?.url,
method: error.config?.method,
params: error.config?.params,
data: error.config?.data,
};
this.response = {
data: error?.response?.data,
data: error.response?.data,
};
delete error.response;
delete error.config;
delete error.request;
logger.error(error);
}
}
/**
@ -32,10 +42,23 @@ export class HttpError extends Error {
export function createAxiosService({ logger }: { logger: Logger }) {
// 创建一个 axios 实例
const service = axios.create();
const defaultAgents = createAgent();
// 请求拦截
service.interceptors.request.use(
(config: any) => {
logger.info(`http request:${config.url}method:${config.method}`);
logger.info(`http request:${config.url}method:${config.method}params:${JSON.stringify(config.params)}`);
if (config.timeout == null) {
config.timeout = 15000;
}
let agents = defaultAgents;
if (config.skipSslVerify) {
agents = createAgent({ rejectUnauthorized: config.rejectUnauthorized });
}
config.httpsAgent = agents.httpsAgent;
config.httpAgent = agents.httpAgent;
return config;
},
(error: Error) => {
@ -51,25 +74,52 @@ export function createAxiosService({ logger }: { logger: Logger }) {
return response.data;
},
(error: any) => {
// const status = _.get(error, 'response.status')
// switch (status) {
// case 400: error.message = '请求错误'; break
// case 401: error.message = '未授权,请登录'; break
// case 403: error.message = '拒绝访问'; break
// case 404: error.message = `请求地址出错: ${error.response.config.url}`; break
// case 408: error.message = '请求超时'; break
// case 500: error.message = '服务器内部错误'; break
// case 501: error.message = '服务未实现'; break
// case 502: error.message = '网关错误'; break
// case 503: error.message = '服务不可用'; break
// case 504: error.message = '网关超时'; break
// case 505: error.message = 'HTTP版本不受支持'; break
// default: break
// }
const status = error.response?.status;
switch (status) {
case 400:
error.message = "请求错误";
break;
case 401:
error.message = "未授权,请登录";
break;
case 403:
error.message = "拒绝访问";
break;
case 404:
error.message = `请求地址出错: ${error.response.config.url}`;
break;
case 408:
error.message = "请求超时";
break;
case 500:
error.message = "服务器内部错误";
break;
case 501:
error.message = "服务未实现";
break;
case 502:
error.message = "网关错误";
break;
case 503:
error.message = "服务不可用";
break;
case 504:
error.message = "网关超时";
break;
case 505:
error.message = "HTTP版本不受支持";
break;
default:
break;
}
logger.error(
`请求出错status:${error?.response?.status},statusText:${error?.response?.statusText},url:${error?.config?.url},method:${error?.config?.method}`
`请求出错status:${error.response?.status},statusText:${error.response?.statusText},url:${error.config?.url},method:${error.config?.method}`
);
logger.error("返回数据:", JSON.stringify(error?.response?.data));
logger.error("返回数据:", JSON.stringify(error.response?.data));
if (error instanceof AggregateError) {
logger.error(error);
}
const err = new HttpError(error);
return Promise.reject(err);
}
@ -77,4 +127,19 @@ export function createAxiosService({ logger }: { logger: Logger }) {
return service;
}
export const request = createAxiosService({ logger });
export const http = createAxiosService({ logger }) as HttpClient;
export type HttpClientResponse<R> = any;
export type HttpRequestConfig<D> = {
skipSslVerify?: boolean;
} & AxiosRequestConfig<D>;
export type HttpClient = {
request<D = any, R = any>(config: HttpRequestConfig<D>): Promise<HttpClientResponse<R>>;
};
export function createAgent(opts: ProxyAgentOptions = {}) {
const httpAgent = new ProxyAgent(opts);
return {
httpAgent,
httpsAgent: httpAgent,
};
}

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.24.4](https://github.com/certd/certd/compare/v1.24.3...v1.24.4) (2024-09-09)
**Note:** Version bump only for package @certd/lib-k8s
## [1.24.3](https://github.com/certd/certd/compare/v1.24.2...v1.24.3) (2024-09-06)
**Note:** Version bump only for package @certd/lib-k8s

View File

@ -1,7 +1,7 @@
{
"name": "@certd/lib-k8s",
"private": false,
"version": "1.24.3",
"version": "1.24.4",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@ -16,7 +16,7 @@
"@kubernetes/client-node": "0.21.0"
},
"devDependencies": {
"@certd/pipeline": "^1.24.3",
"@certd/pipeline": "^1.24.4",
"@rollup/plugin-commonjs": "^23.0.4",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
@ -37,5 +37,5 @@
"tslib": "^2.5.2",
"typescript": "^4.8.4"
},
"gitHead": "c49ccbde93dbad7062ac39d4f18eca7d561f573f"
"gitHead": "6fe2d2c3288b698e9cbdc91725abcbb072278fab"
}

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.24.4](https://github.com/certd/certd/compare/v1.24.3...v1.24.4) (2024-09-09)
**Note:** Version bump only for package @certd/midway-flyway-js
## [1.22.6](https://github.com/certd/certd/compare/v1.22.5...v1.22.6) (2024-08-03)
**Note:** Version bump only for package @certd/midway-flyway-js

View File

@ -1,6 +1,6 @@
{
"name": "@certd/midway-flyway-js",
"version": "1.22.6",
"version": "1.24.4",
"description": "midway with flyway, sql upgrade way ",
"private": false,
"type": "module",
@ -53,5 +53,5 @@
"typeorm": "^0.3.11",
"typescript": "~5.1.0"
},
"gitHead": "e5da46cfc31b2e30a4903bcb2251b1851265ef41"
"gitHead": "6fe2d2c3288b698e9cbdc91725abcbb072278fab"
}

View File

@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.24.4](https://github.com/certd/certd/compare/v1.24.3...v1.24.4) (2024-09-09)
### Performance Improvements
* 支持群晖 ([5c270b6](https://github.com/certd/certd/commit/5c270b6b9d45a2152f9fdb3c07bd98b7c803cb8e))
## [1.24.3](https://github.com/certd/certd/compare/v1.24.2...v1.24.3) (2024-09-06)
**Note:** Version bump only for package @certd/plugin-cert

View File

@ -1,7 +1,7 @@
{
"name": "@certd/plugin-cert",
"private": false,
"version": "1.24.3",
"version": "1.24.4",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@ -13,8 +13,8 @@
"preview": "vite preview"
},
"dependencies": {
"@certd/acme-client": "^1.24.3",
"@certd/pipeline": "^1.24.3",
"@certd/acme-client": "^1.24.4",
"@certd/pipeline": "^1.24.4",
"jszip": "^3.10.1",
"node-forge": "^0.10.0",
"psl": "^1.9.0"
@ -53,5 +53,5 @@
"vite": "^3.1.0",
"vue-tsc": "^0.38.9"
},
"gitHead": "c49ccbde93dbad7062ac39d4f18eca7d561f573f"
"gitHead": "6fe2d2c3288b698e9cbdc91725abcbb072278fab"
}

View File

@ -311,7 +311,7 @@ export class AcmeService {
private async testDirectory(directoryUrl: string) {
try {
await utils.http({
await utils.http.request({
url: directoryUrl,
method: "GET",
timeout: 10000,

View File

@ -45,7 +45,7 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
email!: string;
@TaskInput({
title: "PFX密码",
title: "PFX证书密码",
component: {
name: "a-input-password",
vModel: "value",
@ -191,14 +191,14 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
*/
async condition() {
if (this.forceUpdate) {
this.logger.info("强制更新证书选项已勾选,准备申请新证书");
return null;
}
let inputChanged = false;
const oldInput = JSON.stringify(this.lastStatus?.input?.domains);
const thisInput = JSON.stringify(this.domains);
if (oldInput !== thisInput) {
inputChanged = true;
const inputChanged = this.ctx.inputChanged;
if (inputChanged) {
this.logger.info("输入参数变更,准备申请新证书");
return null;
}
let oldCert: CertReader | undefined = undefined;
@ -212,11 +212,6 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
return null;
}
if (inputChanged) {
this.logger.info("输入参数变更,申请新证书");
return null;
}
const ret = this.isWillExpire(oldCert.expires, this.renewDays);
if (!ret.isWillExpire) {
this.logger.info(`证书还未过期:过期时间${dayjs(oldCert.expires).format("YYYY-MM-DD HH:mm:ss")},剩余${ret.leftDays}`);

View File

@ -69,13 +69,15 @@ export class CertReader {
const tmpDerPath = this.saveToFile("der");
logger.info("本地文件写入成功");
try {
await opts.handle({
return await opts.handle({
reader: this,
tmpCrtPath: tmpCrtPath,
tmpKeyPath: tmpKeyPath,
tmpPfxPath: tmpPfxPath,
tmpDerPath: tmpDerPath,
});
} catch (err) {
throw err;
} finally {
//删除临时文件
logger.info("删除临时文件");

View File

@ -8,7 +8,7 @@ RUN npm install -g pnpm@8.15.7
#RUN cd /workspace/certd-client && pnpm install && npm run build
RUN cp /workspace/certd-client/dist/* /workspace/certd-server/public/ -rf
RUN cd /workspace/certd-server && yarn install && npm run build-on-docker
RUN cd /workspace/certd-server && pnpm install && npm run build-on-docker
FROM node:18-alpine

View File

@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.24.4](https://github.com/certd/certd/compare/v1.24.3...v1.24.4) (2024-09-09)
### Performance Improvements
* 插件选择支持搜索 ([d1498a7](https://github.com/certd/certd/commit/d1498a71601b74d38343b1d070eadd03705dd9d5))
## [1.24.3](https://github.com/certd/certd/compare/v1.24.2...v1.24.3) (2024-09-06)
**Note:** Version bump only for package @certd/ui-client

View File

@ -1,6 +1,6 @@
{
"name": "@certd/ui-client",
"version": "1.24.3",
"version": "1.24.4",
"private": true,
"scripts": {
"dev": "vite --open",
@ -58,7 +58,7 @@
"vuedraggable": "^4.1.0"
},
"devDependencies": {
"@certd/pipeline": "^1.24.3",
"@certd/pipeline": "^1.24.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.3.12",

View File

@ -143,6 +143,7 @@ function openUpgrade() {
<div class="flex-o w-100">
<span>站点ID</span>
<fs-copyable class="flex-1" v-model={computedSiteId.value}></fs-copyable>
<div>注意保存好数据库暂不支持换绑默认数据库路径/data/certd/db.sqlite</div>
</div>
<a-input class="mt-10" v-model:value={formState.code} placeholder={placeholder} />
</div>

View File

@ -68,6 +68,17 @@ h1, h2, h3, h4, h5, h6 {
flex: 1;
}
.flex-col{
display: flex;
flex-direction: column;
}
.scroll-y{
overflow-y: auto;
}
.mb-2 {
margin-bottom: 2px;
}
@ -137,6 +148,13 @@ h1, h2, h3, h4, h5, h6 {
.w-100 {
width: 100%;
}
.h-100 {
height: 100%;
}
.overflow-hidden {
overflow: hidden;
}
.block-header {
margin: 3px;
@ -166,3 +184,17 @@ h1, h2, h3, h4, h5, h6 {
.need-plus {
color: #c5913f !important;
}
.deleted{
color: #c7c7c7;
//删除线
text-decoration: line-through;
}
.cursor-move{
cursor: move !important;
}
.cursor-pointer{
cursor: pointer;
}

View File

@ -8,43 +8,61 @@
</template>
<template v-if="currentStep">
<pi-container v-if="currentStep._isAdd" class="pi-step-form">
<a-tabs tab-position="left">
<a-tab-pane v-for="group of pluginGroups.groups" :key="group.key" :tab="group.title">
<a-row :gutter="10">
<a-col v-for="item of group.plugins" :key="item.key" class="step-plugin" :span="12">
<a-card
hoverable
:class="{ current: item.name === currentStep.type }"
@click="stepTypeSelected(item)"
@dblclick="
stepTypeSelected(item);
stepTypeSave();
"
>
<a-card-meta>
<template #title>
<a-avatar :src="item.icon || '/images/plugin.png'" />
<span class="title">{{ item.title }}</span>
<vip-button v-if="item.needPlus" mode="icon" />
</template>
<template #description>
<span :title="item.desc">{{ item.desc }}</span>
</template>
</a-card-meta>
</a-card>
</a-col>
</a-row>
</a-tab-pane>
</a-tabs>
<div style="padding: 20px; margin-left: 100px">
<a-button v-if="editMode" type="primary" @click="stepTypeSave"> </a-button>
<template #header>
<a-row :gutter="10" class="mb-10">
<a-col :span="24" style="padding-left: 20px">
<a-input-search v-model:value="pluginSearch.keyword" placeholder="搜索插件" :allow-clear="true" :show-search="true"></a-input-search>
</a-col>
</a-row>
</template>
<div class="flex-col h-100 w-100 overflow-hidden">
<a-tabs v-model:active-key="pluginGroupActive" tab-position="left" class="flex-1 overflow-hidden">
<a-tab-pane v-for="group of computedPluginGroups" :key="group.key" :tab="group.title" class="scroll-y">
<a-row v-if="!group.plugins || group.plugins.length === 0" :gutter="10">
<a-col class="flex-o">
<div class="flex-o m-10">没有找到插件</div>
</a-col>
</a-row>
<a-row v-else :gutter="10">
<a-col v-for="item of group.plugins" :key="item.key" class="step-plugin" :span="12">
<a-card
hoverable
:class="{ current: item.name === currentStep.type }"
@click="stepTypeSelected(item)"
@dblclick="
stepTypeSelected(item);
stepTypeSave();
"
>
<a-card-meta>
<template #title>
<a-avatar :src="item.icon || '/images/plugin.png'" />
<span class="title">{{ item.title }}</span>
<vip-button v-if="item.needPlus" mode="icon" />
</template>
<template #description>
<span :title="item.desc">{{ item.desc }}</span>
</template>
</a-card-meta>
</a-card>
</a-col>
</a-row>
</a-tab-pane>
</a-tabs>
</div>
<template #footer>
<div style="padding: 20px; margin-left: 100px">
<a-button v-if="editMode" type="primary" @click="stepTypeSave"> </a-button>
</div>
</template>
</pi-container>
<pi-container v-else class="pi-step-form">
<a-form ref="stepFormRef" class="step-form" :model="currentStep" :label-col="labelCol" :wrapper-col="wrapperCol">
<template #header>
<div class="mb-10">
<a-alert type="info" :message="currentPlugin.title" :description="currentPlugin.desc"> </a-alert>
</div>
</template>
<a-form ref="stepFormRef" class="step-form" :model="currentStep" :label-col="labelCol" :wrapper-col="wrapperCol">
<fs-form-item
v-model="currentStep.title"
:item="{
@ -66,9 +84,9 @@
</a-form>
<template #footer>
<a-form-item v-if="editMode" :wrapper-col="{ span: 14, offset: 4 }">
<div v-if="editMode" class="bottom-button">
<a-button type="primary" @click="stepSave"> </a-button>
</a-form-item>
</div>
</template>
</pi-container>
</template>
@ -77,7 +95,7 @@
<script lang="tsx">
import { message, Modal } from "ant-design-vue";
import { computed, inject, Ref, ref } from "vue";
import { computed, inject, Ref, ref, watch } from "vue";
import _ from "lodash-es";
import { nanoid } from "nanoid";
import { CopyOutlined } from "@ant-design/icons-vue";
@ -263,7 +281,45 @@ export default {
const blankFn = () => {
return {};
};
const pluginSearch = ref({
keyword: "",
result: []
});
const pluginGroupActive = ref("all");
const computedPluginGroups: any = computed(() => {
const groups = pluginGroups.groups;
if (pluginSearch.value.keyword) {
const keyword = pluginSearch.value.keyword.toLowerCase();
const list = groups.all.plugins.filter((plugin) => {
return (
plugin.title?.toLowerCase().includes(keyword) || plugin.desc?.toLowerCase().includes(keyword) || plugin.name?.toLowerCase().includes(keyword)
);
});
return {
search: { key: "search", title: "搜索结果", plugins: list }
};
} else {
return groups;
}
});
watch(
() => {
return pluginSearch.value.keyword;
},
(val: any) => {
if (val) {
pluginGroupActive.value = "search";
} else {
pluginGroupActive.value = "all";
}
}
);
return {
pluginGroupActive,
computedPluginGroups,
pluginSearch,
stepTypeSelected,
stepTypeSave,
pluginGroups,
@ -321,8 +377,23 @@ export default {
<style lang="less">
.pi-step-form {
.bottom-button {
padding: 20px;
padding-bottom: 5px;
margin-left: 100px;
}
.body {
padding: 10px;
padding: 0px;
.ant-tabs-content {
height: 100%;
}
.ant-tabs-tabpane {
padding-right: 10px;
overflow-y: auto;
overflow-x: hidden;
}
.ant-card {
margin-bottom: 10px;

View File

@ -48,13 +48,14 @@
<div class="step-row">
<div class="text">
<fs-icon icon="ion:flash"></fs-icon>
<h4 class="title">{{ element.title }}</h4>
<h4 class="title" :class="{ disabled: element.disabled, deleted: element.disabled }">{{ element.title }}</h4>
</div>
<div class="action">
<a key="edit" @click="stepEdit(currentTask, element, index)">编辑</a>
<a key="edit" @click="stepCopy(currentTask, element, index)">复制</a>
<a key="remove" @click="stepDelete(currentTask, index)">删除</a>
<fs-icon v-plus class="icon-button handle" title="拖动排序" icon="ion:move-outline"></fs-icon>
<a key="disabled" @click="element.disabled = !!!element.disabled">{{ element.disabled ? "启用" : "禁用" }}</a>
<fs-icon v-plus class="icon-button handle cursor-move" title="拖动排序" icon="ion:move-outline"></fs-icon>
</div>
</div>
</template>

View File

@ -94,7 +94,9 @@
<!-- :open="true"-->
<template #content>
<div v-for="(item, index) of task.steps" class="flex-o w-100">
<span class="ellipsis flex-1">{{ index + 1 }}. {{ item.title }} </span>
<span class="ellipsis flex-1 step-title" :class="{ disabled: item.disabled, deleted: item.disabled }">
{{ index + 1 }}. {{ item.title }}
</span>
<pi-status-show v-if="!editMode" :status="item.status?.result"></pi-status-show>
<fs-icon
v-if="!editMode"
@ -346,14 +348,23 @@ export default defineComponent({
}
const intervalLoadHistoryRef = ref();
function watchNewHistoryList() {
intervalLoadHistoryRef.value = setInterval(async () => {
if (currentHistory.value == null) {
await loadHistoryList();
} else if (currentHistory.value.pipeline?.status?.status === "start") {
await loadCurrentHistoryDetail();
} else {
clearInterval(intervalLoadHistoryRef.value);
intervalLoadHistoryRef.value = setTimeout(async () => {
try {
if (currentHistory.value == null) {
await loadHistoryList();
}
if (currentHistory.value != null) {
if (currentHistory.value.pipeline?.status?.status === "start") {
await loadCurrentHistoryDetail();
} else {
return;
}
}
} catch (e) {
console.error(e);
}
watchNewHistoryList();
}, 3000);
}
@ -603,6 +614,9 @@ export default defineComponent({
saveLoading.value = true;
try {
if (props.options.doSave) {
if (pipeline.value.version == null) {
pipeline.value.version = 0;
}
pipeline.value.version++;
currentPipeline.value = pipeline.value;
await props.options.doSave(pipeline.value);

View File

@ -48,6 +48,12 @@ const StatusEnum: StatusEnumType = {
label: "未运行",
color: "blue",
icon: "ant-design:minus-circle-twotone"
},
disabled: {
value: "disabled",
label: "禁用",
color: "gray",
icon: "ant-design:stop-outlined"
}
};
export const statusUtil = {

View File

@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.24.4](https://github.com/certd/certd/compare/v1.24.3...v1.24.4) (2024-09-09)
### Bug Fixes
* 修复腾讯云cdn证书部署后会自动关闭hstshttp2.0等配置的bug ([7908ab7](https://github.com/certd/certd/commit/7908ab79da624c94fa05849925b15e480e3317c4))
* 修复腾讯云tke证书部署报错的bug ([653f409](https://github.com/certd/certd/commit/653f409d91a441850d6381f89a8dd390831f0d5e))
### Performance Improvements
* 支持群晖 ([5c270b6](https://github.com/certd/certd/commit/5c270b6b9d45a2152f9fdb3c07bd98b7c803cb8e))
## [1.24.3](https://github.com/certd/certd/compare/v1.24.2...v1.24.3) (2024-09-06)
### Performance Improvements

View File

@ -1,6 +1,6 @@
{
"name": "@certd/ui-server",
"version": "1.24.3",
"version": "1.24.4",
"description": "fast-server base midway",
"private": true,
"type": "module",
@ -16,18 +16,20 @@
"build": "mwtsc --cleanOutDir --skipLibCheck",
"build-on-docker": "node ./before-build.js && npm run build",
"up-mw-deps": "npx midway-version -u -w",
"clinic": "clinic heapprofiler -- node ./bootstrap.js"
"heap": "clinic heapprofiler -- node ./bootstrap.js",
"flame": "clinic flame -- node ./bootstrap.js"
},
"dependencies": {
"@alicloud/cs20151215": "^3.0.3",
"@alicloud/pop-core": "^1.7.10",
"@certd/acme-client": "^1.24.3",
"@certd/acme-client": "^1.24.4",
"@certd/lib-huawei": "^1.24.3",
"@certd/lib-k8s": "^1.24.3",
"@certd/midway-flyway-js": "^1.22.6",
"@certd/pipeline": "^1.24.3",
"@certd/plugin-cert": "^1.24.3",
"@certd/plugin-plus": "^1.24.3",
"@certd/lib-k8s": "^1.24.4",
"@certd/midway-flyway-js": "^1.24.4",
"@certd/pipeline": "^1.24.4",
"@certd/plugin-cert": "^1.24.4",
"@certd/plugin-plus": "^1.24.4",
"@koa/cors": "^5.0.0",
"@midwayjs/bootstrap": "^3.16.2",
"@midwayjs/cache": "^3.14.0",
@ -47,6 +49,7 @@
"cache-manager": "^3.6.3",
"cron-parser": "^4.9.0",
"dayjs": "^1.11.7",
"form-data": "^4.0.0",
"glob": "^10.4.5",
"https-proxy-agent": "^7.0.5",
"iconv-lite": "^0.6.3",
@ -67,6 +70,7 @@
"ssh2": "^1.15.0",
"strip-ansi": "^7.1.0",
"svg-captcha": "^1.4.0",
"syno": "^2.2.0",
"tencentcloud-sdk-nodejs": "^4.0.44",
"typeorm": "^0.3.20"
},

View File

@ -1,19 +1,19 @@
import crypto from 'crypto';
import querystring from 'querystring';
import { DogeCloudAccess } from '../access.js';
import { AxiosInstance } from 'axios';
import { HttpClient } from '@certd/pipeline';
export class DogeClient {
accessKey: string;
secretKey: string;
http: AxiosInstance;
constructor(access: DogeCloudAccess, http: AxiosInstance) {
http: HttpClient;
constructor(access: DogeCloudAccess, http: HttpClient) {
this.accessKey = access.accessKey;
this.secretKey = access.secretKey;
this.http = http;
}
async request(apiPath: string, data: any = {}, jsonMode = false) {
async request(apiPath: string, data: any = {}, jsonMode = false, ignoreResNullCode = false) {
// 这里替换为你的多吉云永久 AccessKey 和 SecretKey可在用户中心 - 密钥管理中查看
// 请勿在客户端暴露 AccessKey 和 SecretKey那样恶意用户将获得账号完全控制权
@ -34,7 +34,9 @@ export class DogeClient {
},
});
if (res.code !== 200) {
if (res.code == null && ignoreResNullCode) {
//ignore
} else if (res.code !== 200) {
throw new Error('API Error: ' + res.msg);
}
return res.data;

View File

@ -44,6 +44,17 @@ export class DogeCloudDeployToCDNPlugin extends AbstractTaskPlugin {
})
accessId!: string;
@TaskInput({
title: '忽略部署接口报错',
helper: '当该域名部署后报错,但是实际上已经部署成功时,可以勾选',
value: false,
component: {
name: 'a-switch',
type: 'checked',
},
})
ignoreDeployNullCode = false;
dogeClient!: DogeClient;
async onInstance() {
@ -66,10 +77,14 @@ export class DogeCloudDeployToCDNPlugin extends AbstractTaskPlugin {
}
async bindCert(certId: number) {
await this.dogeClient.request('/cdn/cert/bind.json', {
id: certId,
domain: this.domain,
});
await this.dogeClient.request(
'/cdn/cert/bind.json',
{
id: certId,
domain: this.domain,
},
this.ignoreDeployNullCode
);
}
}
new DogeCloudDeployToCDNPlugin();

View File

@ -1,2 +1,3 @@
export * from './plugin-k8s.js';
export * from './plugin-restart.js';
export * from './plugin-script.js';

View File

@ -6,6 +6,7 @@ import { appendTimeSuffix } from '../../plugin-aliyun/utils/index.js';
@IsTaskPlugin({
name: 'DeployToK8SIngress',
title: 'K8S Ingress证书部署',
desc: '暂不可用',
group: pluginGroups.other.key,
default: {
strategy: {

View File

@ -0,0 +1,58 @@
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, TaskInstanceContext } from '@certd/pipeline';
import { CertInfo, CertReader } from '@certd/plugin-cert';
export type CustomScriptContext = {
CertReader: typeof CertReader;
self: CustomScriptPlugin;
} & TaskInstanceContext;
@IsTaskPlugin({
name: 'CustomScript',
title: '自定义js脚本',
desc: '测试',
group: pluginGroups.other.key,
default: {
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed,
},
},
})
export class CustomScriptPlugin extends AbstractTaskPlugin {
@TaskInput({
title: '脚本',
helper: '自定义js脚本',
component: {
name: 'a-textarea',
vModel: 'value',
rows: 10,
style: 'background-color: #000c17;color: #fafafa;',
},
required: true,
})
script!: string;
@TaskInput({
title: '域名证书',
helper: '请选择前置任务输出的域名证书',
component: {
name: 'pi-output-selector',
from: 'CertApply',
},
required: true,
})
cert!: CertInfo;
async onInstance() {}
async execute(): Promise<void> {
this.logger.info('执行自定义脚本:\n', this.script);
const ctx: CustomScriptContext = {
CertReader,
self: this,
...this.ctx,
};
const AsyncFunction = Object.getPrototypeOf(async () => {}).constructor;
const func = new AsyncFunction('ctx', this.script);
return await func(ctx);
}
}
new CustomScriptPlugin();

View File

@ -93,20 +93,20 @@ export class DeployToCdnPlugin extends AbstractTaskPlugin {
buildParams() {
return {
Https: {
Switch: 'on',
CertInfo: {
Domain: this.domainName,
Route: 'Https.CertInfo',
Value: JSON.stringify({
update: {
Certificate: this.cert.crt,
PrivateKey: this.cert.key,
},
},
Domain: this.domainName,
}),
};
}
async doRequest(params: any) {
const client = await this.getClient();
const ret = await client.UpdateDomainConfig(params);
const ret = await client.ModifyDomainConfig(params);
this.checkRet(ret);
this.logger.info('设置腾讯云CDN证书成功:', ret.RequestId);
return ret.RequestId;

View File

@ -6,7 +6,7 @@ import dayjs from 'dayjs';
name: 'DeployCertToTencentCLB',
title: '部署到腾讯云CLB',
group: pluginGroups.tencent.key,
desc: '暂时只支持单向认证证书,暂时只支持通用负载均衡',
desc: '暂时只支持单向认证证书,暂时只支持通用负载均衡必须开启sni',
default: {
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed,
@ -93,14 +93,13 @@ export class DeployToClbPlugin extends AbstractTaskPlugin {
accessId!: string;
client: any;
ClbClient: any;
async onInstance() {
this.client = await this.getClient();
}
async getClient() {
const sdk = await import('tencentcloud-sdk-nodejs/tencentcloud/services/clb/v20180317/index.js');
this.ClbClient = sdk.v20180317.Client;
const ClbClient = sdk.v20180317.Client;
const accessProvider = (await this.accessService.getById(this.accessId)) as TencentAccess;
@ -118,7 +117,7 @@ export class DeployToClbPlugin extends AbstractTaskPlugin {
},
};
return new this.ClbClient(clientConfig);
return new ClbClient(clientConfig);
}
async execute(): Promise<void> {

View File

@ -38,6 +38,7 @@ export class DeployToEOPlugin extends AbstractTaskPlugin {
@TaskInput({
title: '站点ID',
helper: '类似于zone-xxxx的字符串在站点概览页面左上角或者站点列表页面站点名称下方',
required: true,
})
zoneId!: string;

View File

@ -89,19 +89,16 @@ export class DeployCertToTencentTKEIngressPlugin extends AbstractTaskPlugin {
})
cert!: any;
TkeClient: any;
K8sClient: any;
async onInstance() {
// const TkeClient = this.tencentcloud.tke.v20180525.Client;
const sdk = await import('tencentcloud-sdk-nodejs/tencentcloud/services/tke/v20220501/index.js');
this.TkeClient = sdk.v20220501.Client;
const k8sSdk = await import('@certd/lib-k8s');
this.K8sClient = k8sSdk.K8sClient;
}
async execute(): Promise<void> {
const accessProvider = await this.accessService.getById(this.accessId);
const tkeClient = this.getTkeClient(accessProvider, this.region);
const tkeClient = await this.getTkeClient(accessProvider, this.region);
const kubeConfigStr = await this.getTkeKubeConfig(tkeClient, this.clusterId);
this.logger.info('kubeconfig已成功获取');
@ -127,7 +124,9 @@ export class DeployCertToTencentTKEIngressPlugin extends AbstractTaskPlugin {
await this.restartIngress({ k8sClient });
}
getTkeClient(accessProvider: any, region = 'ap-guangzhou') {
async getTkeClient(accessProvider: any, region = 'ap-guangzhou') {
const sdk = await import('tencentcloud-sdk-nodejs/tencentcloud/services/tke/v20180525/index.js');
const TkeClient = sdk.v20180525.Client;
const clientConfig = {
credential: {
secretId: accessProvider.secretId,
@ -141,7 +140,7 @@ export class DeployCertToTencentTKEIngressPlugin extends AbstractTaskPlugin {
},
};
return new this.TkeClient(clientConfig);
return new TkeClient(clientConfig);
}
async getTkeKubeConfig(client: any, clusterId: string) {

View File

@ -2,7 +2,7 @@ import { utils } from '@certd/pipeline';
export async function request(config: any): Promise<any> {
try {
return await utils.http(config);
return await utils.http.request(config);
} catch (e) {
const data = e.data || e.response?.data;
if (data) {

View File

@ -9,4 +9,4 @@ log4js.configure({
},
categories: { default: { appenders: ['std'], level } },
});
export const logger = log4js.getLogger('fast');
export const logger = log4js.getLogger('server');