certd/step.md

111 lines
4.2 KiB
Markdown
Raw Normal View History

2023-07-04 05:06:37 +00:00
# Certd演示示例
本示例演示从创建证书申请任务到自动部署证书全流程
2024-07-08 02:59:19 +00:00
> 申请证书->部署证书->设置定时执行->设置邮件通知
2023-07-04 05:06:37 +00:00
## 准备工作
2024-11-08 17:40:41 +00:00
1. 已部署CertD服务可官方Demo自助注册体验 https://certd.handfree.work/
2023-07-04 05:06:37 +00:00
2. 注册一个域名支持阿里云万网、腾讯云DnsPod、华为云
3. 准备好以上DNS解析服务商的AccessKey 和 AccessSecret
4. 证书要部署的目标(可选,单纯当成证书申请工具用也不错)
## 自动化流水线创建
### 1. 创建证书申请部署流水线
2024-10-10 16:48:24 +00:00
![创建证书申请任务](packages/ui/certd-client/public/static/doc/images/1-add.png)
2023-07-04 05:06:37 +00:00
需要添加域名的DNS解析服务商的授权
2024-10-10 16:48:24 +00:00
![添加域名的DNS解析服务商的授权](packages/ui/certd-client/public/static/doc/images/2-access-provider.png)
2023-07-04 05:06:37 +00:00
填写accessKey和accessSecret
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/3-add-access.png)
2023-07-04 05:06:37 +00:00
流水线创建成功
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/4-add-success.png)
2023-07-04 05:06:37 +00:00
2024-11-02 14:26:35 +00:00
### 2. 流水线详情界面
2023-07-04 05:06:37 +00:00
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/5-view.png)
2023-07-04 05:06:37 +00:00
2023-07-04 05:57:31 +00:00
到这一步申请证书就已经配置完成了。
点击手动触发,就可以申请证书了。
接下来演示如何添加部署任务
2023-07-04 05:06:37 +00:00
### 3. 添加部署到阿里云CDN任务
2023-07-04 05:57:31 +00:00
点击添加任务
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/6-1-add-task.png)
2023-07-04 05:06:37 +00:00
选择任务类型
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/6-2-add-task.png)
2023-07-04 05:06:37 +00:00
填写任务参数
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/6-3-add-task.png)
2023-07-04 05:06:37 +00:00
点击确定部署到CDN任务配置成功
### 4. 添加部署到服务器主机任务
点击新任务,弹出添加任务界面
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/7-1-add-host-task.png)
2023-07-04 05:06:37 +00:00
先选择上传到主机任务
填写任务参数,比如证书保存路径
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/7-2-add-host-task.png)
2023-07-04 05:06:37 +00:00
需要添加主机ip、用户名、密码只需添加一次后续其他任务可以复用
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/7-3-add-host-task.png)
2023-07-04 05:06:37 +00:00
然后添加第二个任务,执行主机命令,部署证书
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/8-1-add-host-task.png)
2023-07-04 05:06:37 +00:00
选择执行脚本命令任务
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/8-2-add-host-task.png)
2023-07-04 05:06:37 +00:00
编写脚本,选择之前添加的主机
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/8-4-add-host-task.png)
2023-07-04 05:06:37 +00:00
点击确定,部署到主机任务配置成功
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/8-5-add-host-task.png)
2023-07-04 05:06:37 +00:00
### 5. 手动触发执行任务,测试一下
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/9-start.png)
2023-07-04 05:06:37 +00:00
点击任务可以查看状态和日志
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/10-1-log.png)
2023-07-04 05:06:37 +00:00
这里执行失败,可以查看错误日志
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/11-1-error.png)
![](packages/ui/certd-client/public/static/doc/images/11-2-error.png)
2023-07-04 05:06:37 +00:00
修改正确后,重新执行
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/12-1-log-success.png)
2023-07-04 05:06:37 +00:00
可以看到前面执行过的就会跳过,不会重复执行
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/12-2-skip-log.png)
2023-07-04 05:06:37 +00:00
### 6. 查看证书部署效果
可以看到证书已经部署到CDN成功
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/13-1-result.png)
![](packages/ui/certd-client/public/static/doc/images/13-2-result.png)
2023-07-04 05:06:37 +00:00
也可以手动下载证书
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/13-3-download.png)
2023-07-04 05:06:37 +00:00
### 7. 定时触发
2023-07-06 07:18:41 +00:00
配置定时触发,以后每天定时执行
cron格式例如 `0 0 3 * * *` 表示每天凌晨3点执行
到期前20天会自动申请新证书并部署没到期前不会重复申请
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/14-timer.png)
2023-07-04 05:06:37 +00:00
### 8. 邮件通知
可以接收邮件通知(支持时机:开始、成功、失败、失败转成功)
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/15-1-email.png)
2023-07-04 05:06:37 +00:00
需要配置邮件服务器
2024-10-10 16:48:24 +00:00
![](packages/ui/certd-client/public/static/doc/images/15-2-email.png)
2023-07-04 05:06:37 +00:00
2023-07-04 06:14:31 +00:00
2023-07-04 06:11:43 +00:00
以上,演示了从创建证书申请任务到自动部署证书全流程。
2024-10-26 04:10:28 +00:00
如有任何疑问,[欢迎联系我们](https://certd.docmirror.cn/guide/contact/)
2023-07-04 06:11:43 +00:00