npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tencentcloud-edgeone-migration-nodejs

v0.0.9

Published

tencentcloud cdn config copy to edgeone

Downloads

50

Readme

概述

本工具支持将腾讯云内容分发网络 CDN 服务内已接入的域名配置批量迁移至腾讯云边缘安全加速平台 EO 服务内,支持包括 CDN/ECDN/SCDN 域名。

前提条件

  1. 已安装 Nodejs 10.0.0 版本及以上
  2. 已在腾讯云控制台内创建云 API 秘钥,获取相应的 SecretId、SecretKey。可前往云 API 控制台内获取。
  3. 参考 从零开始快速接入 EdgeOne 创建完成需迁移的域名站点。

使用指南

场景示例

当前在腾讯云 CDN 内已接入加速域名 www.example.com、test.example.com 和 vod.example.com,在腾讯云 EdgeOne 服务内已创建站点 example.com,计划将 CDN 内的这三个域名服务及相关配置迁移到 EdgeOne 控制台内的对应站点下。

操作步骤

步骤1:安装依赖环境及配置迁移工具

  1. 安装 nodejs,建议下载并安装18.18.2版本。
  2. 安装完毕之后,打开命令行工具;
  3. 执行指令:node -v,用于检查node安装情况,如下所示,返回版本号,则说明安装成功
$ node -v
v18.18.2
  1. 执行指令:npm -v,检查 npm 安装情况,如下所示,返回版本号,则说明安装成功
$ npm -v
v9.6.7
  1. 执行指令:npm install tencentcloud-edgeone-migration-nodejs,下载并安装本工具包
npm install tencentcloud-edgeone-migration-nodejs
  1. 执行指令:cd ./node_modules/tencentcloud-edgeone-migration-nodejs,进入工具安装目录
$ cd ./node_modules/tencentcloud-edgeone-migration-nodejs 

步骤2:迁移配置

  1. 安装完成后,在文件的安装根目录下,可以找到配置文件 config.json,打开改配置文件并修改相关迁移配置,各参数配置说明如下:
  • SecretId,SecretKey:为当前需迁移的腾讯云账号云API密钥,可以上控制台查询:https://console.cloud.tencent.com/cam/capi
  • Domains:数组格式,为CDN待迁移域名,可以上控制台查询:https://console.cloud.tencent.com/cdn/domains
  • ZoneId:字符串格式,详情可以上控制台查询:https://console.cloud.tencent.com/edgeone/zones
  • NeedCreateDomain:布尔值,是否需要创建域名,默认为 true,传 false 则只迁移配置,不创建域名,便于多次操作同一个域名
  • 配置示例:
{
  "SecretId": "xxx",
  "SecretKey": "xxx",  
  "List": [{
    "Domains": [ 
      "1.test.com", 
      "2.test.com" 
    ],
    "ZoneId": "xxx"
  }], 
  "NeedCreateDomain": true
}

说明:

使用此工具前,需要现在EdgeOne控制台上创建好对应的站点,否则无法迁移,此工具无法创建站点,只能在站点下创建域名。

  1. 执行指令,开始进行配置迁移。
  • 迁移 CDN 配置
$ npm run task
  • 检查域名部署状态
$ npm run checkTask
  • 迁移 SCDN 配置
$ npm run scdnTask
  • 迁移 CDN 访问控制配置
$ npm run accessTask

注意:

  1. task.js 文件需要跟 config.json 在同一目录下,如果离开本目录执行指令,请修改相对路径。
  2. SCDN 配置迁移前需检查域名部署状态,未完成部署则无法迁移 SCDN 配置

步骤3:迁移后验证

说明:

使用本工具完成域名迁移后,请人工进行验证配置项是否正确,配置验证完成后,再将相关域名的加速服务切换至腾讯云 EdgeOne。

  • 当迁移工具运行完毕后,如果迁移中出现异常,在迁移工具本地目录下会生成一个csv文件(report-${timespamp}.csv),记录了运行中遇到的错误,您可以参考该文件查看迁移结果及遇到的问题。

  • 当工具上显示迁移完成后,您需要前往腾讯云 EdgeOne 控制台内,查看该域名的站点加速配置及规则引擎配置、安全防护配置是否符合预期。

说明:

当前域名配置的源站相关配置将迁移至源站组配置中,

建议您通过以下步骤来验证域名迁移后访问是否符合预期。

  1. 前往 边缘安全加速平台 EO 控制台,在控制台内,点击站点列表,进入当前已迁移域名的站点;

  2. 点击 域名服务 > 域名管理,找到已迁移域名,查看 EdgeOne 为该域名分配的 Cname 信息。例如:www.example.com.eo.dnse3.com

  3. 获取 EdgeOne 平台为该域名分配的节点 IP 信息,可通过在命令行工具中输入 ping www.example.com.eo.dnse3.com,查看返回的对应节点 IP。

  4. 将步骤3获取的节点IP(43.152.53.230)和加速域名(www.example.com)绑定到电脑本地 hosts 文件中,如下所示:

说明:

Windows 系统 Hosts 文件路径位置为 C:\Windows\System32\drivers\etc\hosts。

Mac 系统 Hosts 文件路径为/etc/hosts。

  1. 访问该域名下的热门 URL 内容,验证对应域名服务是否符合预期。

不支持迁移的配置

  1. 源站配置内,如果该源站为第三方对象存储,不支持批量迁移,需手动迁移配置,参考:源站组配置

  2. EdgeOne 智能压缩暂不支持按照文件后缀或者 Content-Type 配置,如果在 CDN 域名内配置有该类规则,本工具不会进行迁移。建议您迁移后在规则引擎内使用其它条件进行匹配。

  3. 以下 HTTPS 相关配置需依赖当前在腾讯云 SSL 控制台内已上传对应的域名托管证书,如果您还未上传证书则无法完成自动迁移,需要您上传 HTTPS 证书到腾讯云 SSL 控制台后手动配置。

  1. 加速类型为 ECDN 动态加速或者 ECDN 动静加速的域名,迁移完成后,需手动开启智能加速,为域名开启动态加速。该功能为增值服务能力,相关计费标准参考:增值服务用量单元费用(后付费)