作为一个RM (release manager,发布经理),需要完成如下事项:

(注意:本文是如何作为一个新RM的实践指导,因此并未对所有步骤进行“为什么需要这个步骤”的解释)

本文大量参考了如下教程:

  1. https://plc4x.apache.org/developers/release.html
  2. 进行gpg签名的教程


本文以IoTDB为例,介绍了IoTDB从0.11.0版本发布到0.11.1的流程,本文对于那些使用maven来管理的项目是直接适用的。

附:新增了对0.12的版本发布方法。


目录:

1. 创建一个 gpg KEY

对于第一次当RM的人来说,需要将进行这个步骤。


创建gpg key的要求是:使用RSA key,并且长度要大于4096 bits。

如何实现:


a. 安装gpg2软件 

MacOS: brew install gpg2

运行下述命令查看版本

$ gpg2 --version


注意:有些人电脑上安装的是gpg,他和gpg2是一致的。所以对于后续的所有命令,如果gpg2不存在,则改用gpg;如果gpg不存在,则可用gpg2;如果都不存在,请确认你至少安装了一个。。


b. 创建key

注意,在这个过程中,(1)输入名字时应该输入真实姓名;(2)使用邮箱时应该使用apache邮箱。(3) 注意名字要使用拼音或者英文否则会出现乱码

生成 gpg key
$ gpg2 --full-gen-key
gpg (GnuPG) 2.2.4; Copyright (C) 2017 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Please select what kind of key you want:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
Your selection? 1
注意:这里输入1
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 4096
注意:这里输入4096
Requested keysize is 4096 bits
Please specify how long the key should be valid.
         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years
Key is valid for? (0) 0
注意:这里输入0
Key does not expire at all
Is this correct? (y/N) y
注意:这里输入y
GnuPG needs to construct a user ID to identify your key.

Real name: your name
注意:这里输入你的名字
Email address: someone@apache.org
注意:这里输入你的邮箱
Comment: Apache IoTDB release signing key
注意:这里输入一些注释
You selected this USER-ID:
    "your name (Apache IoTDB release signing key) <someone@apache.org>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
注意:这里输入O
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.

然后会弹出对话框,要求你为这个gpg输入密钥。输入完毕后就创建好了。默认文件位于 ~/.gnupg目录下。

我的实践位于:~/.gnupg/openpgp-revocs.d/下的一个.rev文件

同时,终端上会输出:gpg: key 一串字符 marked as ultimately trusted

然后检查这个key是否是避免了SHA-1:

检查key
$ gpg2 --edit-key 刚才的一串数字
gpg (GnuPG) 2.2.4; Copyright (C) 2017 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Secret key is available.

gpg: checking the trustdb
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   2  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 2u
gpg: next trustdb check due at 2020-01-30
sec  rsa4096/2206EF8F64C35889
     created: 2019-09-25  expires: never       usage: SC
     trust: ultimate      validity: ultimate
ssb  rsa4096/2C8DBF57147E3901
     created: 2019-09-25  expires: never       usage: E
[ultimate] (1). your name (Apache IoTDB release signing key) <someone@apache.org>

gpg> showpref
这里输入showpref
[ultimate] (1). your name (Apache IoTDB release signing key) <someone@apache.org>
     Cipher: AES256, AES192, AES, 3DES
     Digest: SHA512, SHA384, SHA256, SHA224, SHA1
     Compression: ZLIB, BZIP2, ZIP, Uncompressed
     Features: MDC, Keyserver no-modify

如果顺序不同,可以调整
gpg> setpref SHA512 SHA384 SHA256 SHA224 SHA1 AES256 AES192 AES 3DES ZLIB BZIP2 ZIP Uncompressed
这里按序输入 Digest Cipher Compression 三项的值

注意,只要在倒数第三行,看到Digest中是SHA512在最前面,SHA1在最后面即可。(如果感兴趣这样修改的原因,可以参考:http://www.apache.org/dev/openpgp.html

务必牢记你的私钥密码,将来release时要用!


c. 上传你的key到公共服务器



$ gpg2 --keyserver keys.openpgp.org --send-keys <key id>


这个 <key id> 就是 ~/.gnupg/openpgp-revocs.d/下的一个.rev文件的文件名,打开可以看到以下信息


接下来在下边的链接通过邮箱查询上传成功没,大概需要一分钟才能查到

https://keys.openpgp.org/


查询时候把 advance 下边的 show full-key hashes 勾上


如果上传不成功,可以在网页上手动 Submit Key


首先导出 ASCII 码格式的公钥

gpg2 --armor --output public-key.gpg --export "qiaojialin@apache.org"

获得的 public-key.gpg 文件如下:

-----BEGIN PGP PUBLIC KEY BLOCK-----

mQINBF2LLTABEACRM0lzt9BMSsIg9cCfcEBRH6Fc2etS7vrOt8NPq2VTuHYHUMzA
...
-----END PGP PUBLIC KEY BLOCK-----


接下来手动上传上述内容,上传链接 https://pgp.mit.edu/  https://keys.openpgp.org/


到现在应该能查到了。。。


c.2 寻找你认识的Apache社区的Committer来给你的公钥认证 (这一步不是必须的,可以先往后走)

参考链接 https://gist.github.com/F21/b0e8c62c49dfab267ff1d0c6af39ab84 主要都是对方有事情要做,所以就不详细解释了。

可以找黄向东,刘大伟,乔嘉林帮你签名


d. 将你的gpg 公钥加入KEYS文件中

这个步骤需要使用SVN。MacOS已经默认安装了SVN。

本文以IoTDB从已有0.11.0的情况下发布0.11.1为例。

并新增了0.12的发版内容。


d.1 在dev分支中添加公钥到KEYS,用于发布RC版本

DEV分支的svn库是 https://dist.apache.org/repos/dist/dev/iotdb

Release分支的SVN库是 https://dist.apache.org/repos/dist/release/iotdb


命令如下:

$ svn co https://dist.apache.org/repos/dist/dev/iotdb iotdb-dist-dev

这个步骤比较慢,会把所有版本都考下来,如果网断了,用  svn cleanup 删掉锁,重新执行一下,会断点续传的。。。

$ cd iotdb-dist-dev

$ (gpg2 --list-sigs YOUR_NAME@apache.org && gpg2 --export --armor YOUR_NAME@apache.org) >> KEYS

$ svn ci -m "add gpg key for YOUR_NAME"

接下来会输用户名和密码,就用 apache的用户名和密码。


d.2 在release分支中添加公钥到KEYS,用于发布正式版本(只有PMC有release分支的写权限)

注意,以下命令又会建个 iotdb-dist-release的文件夹,最好 cd .. 到 iotdb-dist-dev 的上级目录

$ svn co https://dist.apache.org/repos/dist/release/iotdb iotdb-dist-release

$ cd iotdb-dist-release

$ (gpg2 --list-sigs YOUR_NAME@apache.org && gpg2 --export --armor YOUR_NAME@apache.org) >> KEYS

$ svn ci -m "add gpg key for YOUR_NAME"(如果不是PMC,可以将KEYS文件发给PMC,让PMC帮忙执行这一步)

这里注意检查一下你追加到 KEYS 里的东西千万不要有中文,出现下图这种文字的时候:

1.  [用户标识未找到],你需要下载给你签名人的key :

$ gpg --keyserver hkp://keys.gnupg.net --search-keys    xxxx@apache.org

2. [绝对],这种是因为国际化的原因,将系统改为英文,然后重启就可以得到英文了


e. 修改你的maven 设置

假设你的maven本地仓库地址是 ~/.m2。

如果已有~/.m2/settings.xml文件,则添加下面的<server>项,否则创建一个~/.m2/settings.xml文件:

~/.m2/settings.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <servers>
    <!-- Apache Repo Settings -->
    <server>
        <id>apache.snapshots.https</id>
        <username>{user-id}</username>
        <password>{user-pass}</password>
    </server>
    <server>
        <id>apache.releases.https</id>
        <username>{user-id}</username>
        <password>{user-pass}</password>
    </server>
  </servers>
  <profiles>
    <profile>
      <id>apache-release</id>
      <properties>
        <gpg.keyname>你的KEYID</gpg.keyname><!-- Your GPG Keyname here -->
        <!-- Use an agent: Prevents being asked for the password during the build -->
        <gpg.useagent>true</gpg.useagent>
        <gpg.passphrase>你的私钥的密码</gpg.passphrase>
      </properties>
    </profile>
  </profiles> 
</settings>


f. 上传GPG公钥到Github账户s

!!重要!! 许多教程中都没提及这一步,而如果不做这一步的话,你在做一些步骤的时候,maven会告诉你没有权限。。

方法:

进入 https://github.com/settings/keys ,添加GPG KEYS。

如果添加后你发现这个密钥后面写了“未经过验证” (unverified),记得去将GPG key中用到的邮箱绑定到你的github账户上 (https://github.com/settings/emails )。


g. 配置Github ssh模式访问

方法:

把自己的 ~/.ssh/id_rsa.pub 拷贝到github上

进入 https://github.com/settings/keys ,添加ssh KEYS。

2. 准备发布版本

(注意:不同的项目可能采用不同的分支管理方法,此处仅供参考)

这里有两个情况:

  • 我只是发一个小版本的改动,例如已经有了0.11.0版本,我需要发布0.11.1。特点是:代码仓库中已经有了rel/0.11这个分支。
  • 我要发一个大的版本,特点是:代码仓库中有rel/0.11,但是没有rel/0.12

对于第一种情况,只需要将本地分支切换到远程的这个分支上:

$git checkout -b rel/0.11 origin/rel/0.11 

对于第二种情况,需要创建一个新分支rel/0.12,并推送到github上:

$git checkout -b rel/0.12

$git push -u origin rel/0.12

2.1 准备发布的代码

我们以要发布0.11.1为例,假设当前本地工作分支已经切换到了rel/0.11下。

这是当前的分支图,rel/0.11创建后最后一次更新位置如图黄色所示,master则还在不断地前进中。

首先我们要确定哪些内容需要进入新的release中,例如我们要将1、2放入0.11.1中,那么就通过 `git cherry-pick`的方法逐一地将这两个PR的提交加入到rel/0.11分支中(你可能要解决大量冲突。。)。

然后,修改RELEASE_NOTES.md文件,写上本次发布都有什么更新。

  • 对于bug修复,如果有issue编号的话,一定写上编号。
  • 对于新feature,一句话/关键词简述,还可以考虑加上用法介绍链接。

然后目前为止,准备工作就做好了。

注意,目前为止,pom中的版本号为:0.11.1-SNAPSHOT

然后把本地的所有修改都提交到远端。

当你频繁切换分支时,会遗留一些垃圾文件在本地。例如,master分支中增加了一个文件夹session,而0.11中并没有,当你从master切换到rel/0.11时,session这个文件夹并不能被mvn clean清理掉。

建议先将这些文件夹都删除(根据PLC4X的文档介绍,不删除的话,这些文件都会被打包到source.zip中。。。。)


!然后!务必检查所有的版本是否正确。比如如果你是从0.11.0升级成0.11.1,那就:

  • 搜索 /0.11.0/ (包含左右两边的”/“),这样可以把所有文档中的链接替换成/0.11.1/
  • 搜索0.11.0,检查所有文档中出现的和0.11.0版本相关的功能描述是否正确,并修改为0.11.1
  • 搜索0.11.0,注意Java代码中的控制台输出是否需要修改(例如CLI会打印版本号)
  • 注意TsFile的magic number不一定要修改。这个需要讨论着来。
  • 所有 pom 里的 version 的 -SNAPSHOT 不要去掉,去掉之后下边的命令会报错。


2.2 检查release_note.md

release note可以从jira来筛选,也可以从github来筛选(推荐,确保修改全部都能找到)。github的搜索方法:在PR的filters输入框中输入: is:pr is:closed base:rel/0.11  其中base就是你希望查询合并到哪个分支的PR。

然后维护对应的release-note,在邮件列表发邮件通知下release note,看是否有人修改。


2.3 检查依赖的license是否兼容

可以通过以下命令:

a. 编译并生成第三方license集合:

mvn clean package  license:add-third-party license:aggregate-third-party-report -Dlicense.useMissingFile -DskipTests

b. 检查所有catalogX的license:

mac/linux下运行:

find . -name THIRD-PARTY.txt| xargs cat | grep -E 'BCL|Intel|JSR-275|Microsoft Limited Public License|ASL|Java SDK for Satori RTM| Redis Source Available License|RSAL|Booz Allen Public License|Creative Commons|Sun Community|GPL|Affero|LGPL|QPL|Sleepycat|Server Side|SSPL|Code Project|CPOL|BSD-4|Facebook BSD+|Solipsistic Eclipse Public|Be A Dick|JSON License' | grep -v CDDL |grep -v Apache | grep -v MIT | grep -v "Creative Commons CC0"


2.4 手动修改client-py的版本(新增内容)

手动修改 client-py/setup.py 文件中的版本号为当前发布版。


2.5 手动修改 jdbc feature.xml 的版本

手动修改 jdbc/src/main/feature/feature.xml 文件中的版本号为当前发布版。


2.6 在仓库中新增当前发布版本的 Dockerfile


然后开始正式的发版。

3.发布版本

3.1 自动在github上打tag,并生成各种签名文件



这里坑比较多!!!!一定要注意!!!!!!

如果你的机器有多个key,一定要检查~/.gnupg/gpg.conf 文件中的默认key是之前apache邮箱的那个key,否则签名会出大问题!!!!!




先在项目源码中删除  .mvn/wrapper/*.jar   

删除可能的 data 目录

保证本地没有 iotdb server在运行,不然测试会端口占用

再确认一下现在在 rel/0.12 分支,别在 master 分支

merge 一下远程 rel/0.12 分支,确保现在的本地分支是最新的

确认一下本地和远程的 v0.12.0 的 tag 被删掉了:

(在这个文档中,一定不要把下面的分支名字换成一个真实存在的名字,防止有人直接复制粘贴,故以0.12.x替代0.12.0)

删本地 tag:$git tag -d v0.12.x

删远端 tag:git push origin :refs/tags/v0.12.x


执行:

$ mvn release:prepare -DautoVersionSubmodules=true -P site 

注:0.12版本中的编译命令:

mvn release:prepare -DautoVersionSubmodules=true -P site -P compile-cpp -P code-coverage -P get-jar-with-dependencies

注:0.13版本中的编译命令:

mvn release:prepare -DautoVersionSubmodules=true -P site -P compile-grafana-plugin -P compile-cpp -P code-coverage -P get-jar-with-dependencies

注2,若自身电脑没有docker,建议将testcontainer模块中的版本号进行手动修改。



如果出现sign失败,可以尝试以下命令
export GPG_TTY=$(tty)


执行时,会让你输入三个内容:

a. 希望发布的版本号,默认值为pom中的版本号去掉“-SNAPSHOT”,一般可以不修改

b. 希望在github打的tag名字是什么,注意我们目前使用的命名风格是: v0.12.0

c. 下一个版本号是什么,默认值一般也是对的。


(踩坑注:已知Windows中使用CRLF标识一行的结束,而在Linux/UNIX系统中只使用LF标识一行的结束。git设置core.autocrlf=true后,检出时git会把文本文件的换行符转化为CRLF(只转化纯 LF 的文件),提交时把暂存区的内容(也就是我们对工作区做的改动)转化为 LF 然后放入版本库。 也就是说,如果你是windows环境且core.autocrlf=true,那么从github上下载到本地的incubator-iotdb换行符会变成CRLF,所以直接这样执行mvn release:prepare -DautoVersionSubmodules=true,打出来的zip包里使用的仍然是CRLF,这样的影响之一是把zip复制到linux环境解压之后,会发现shell文件不可直接执行。网上似乎搜到一种办法是下载源码时暂时设置core.autocrlf=input,但是我没有试过,可能有其他副作用。我直接转到ubuntu虚拟机重新做这件事的,记得gpg key导入。


(问题记录:有可能该mvn命令会编译失败。此时不要慌张,记录原因,并回滚。若编译失败,那么不会进行新的提交,即查看git log 发现没有变化,然后首先

$ git checkout -- .

$ git clean -f

将本地库恢复如初。

然后看一下具体是什么问题。

例如,Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. 这个是指的有项目中的依赖的jar包版本冲突,这时候要用exclusion来进行排除。具体内容可以google。

)





这个过程会自动地把pom中版本的“-SNAPSHOT”删除,然后在云端创建tag。

最后会提示 success,并且除了第一个parent 的pom,其他的都 skippted 了。


如果成功了,根据PLC4X的文档,还应该去apache的仓库看一看是否有最新的记录。地址是 https://gitbox.apache.org/repos/asf?p=iotdb.git;a=shortlog;h=refs/heads/rel/0.12 注意分支名。

应该能看到刚才mvn release:prepare自动做的git操作,commit日志是:[maven-release-plugin] prepare release release/0.11.1 和 [maven-release-plugin] prepare for next development iteration


另外如果成功,在本地的目录下,有如下文件生成:

target目录下:

apache-iotdb-0.11.1-source-release.zip
apache-iotdb-0.11.1-source-release.zip.asc
apache-iotdb-0.11.1-source-release.zip.sha512

distribution/target/目录下:

apache-iotdb-0.11.1-bin.zip
apache-iotdb-0.11.1-bin.zip.asc 
apache-iotdb-0.11.1-bin.zip.sha512

验证!有问题赶紧改,这里还有悔过的机会,不然RC++

gpg2 --verify target/apache-iotdb-0.11.1-source-release.zip.asc target/apache-iotdb-0.11.1-source-release.zip

gpg2 --verify distribution/target/apache-iotdb-0.11.1-bin.zip.asc distribution/target/apache-iotdb-0.11.1-bin.zip

shasum -a512 target/apache-iotdb-0.11.1-source-release.zip

shasum -a512 distribution/target/apache-iotdb-0.11.1-bin.zip

然后和.sha512文件对比下,确认一致。


检查一下源码包和二进制包的大小,源码包是几M,二进制包是十几M都是合理的,不然检查是不是打进去了其他东西

在源码包里 ./mvnw clean package 

在二进制包里 ./sbin/start-server.sh    ./sbin/start-client.sh  ,检查一下版本号,跑一些测试语句:

SET STORAGE GROUP TO root.ChangSha;
CREATE TIMESERIES root.ChangSha.A.aa WITH DATATYPE=INT64, ENCODING=RLE;
CREATE TIMESERIES root.ChangSha WITH DATATYPE=INT64, ENCODING=RLE;
CREATE TIMESERIES root.ChangSha.A.ac WITH DATATYPE=INT64, ENCODING=RLE;
CREATE TIMESERIES root.ChangSha.B.aa WITH DATATYPE=INT64, ENCODING=RLE;
CREATE TIMESERIES root.ChangSha.B.ab WITH DATATYPE=INT64, ENCODING=RLE;
CREATE TIMESERIES root.ChangSha.B.ad WITH DATATYPE=INT64, ENCODING=RLE;
insert into root.ChangSha.A(timestamp,aa,ab,ac) values(1,1,1,1);

insert into root.ChangSha.A(timestamp,aa,ab,ac) values(3,1,1,1);
insert into root.ChangSha.B(timestamp,aa,ab,ad) values(1,1,2,2);
insert into root.ChangSha.B(timestamp,aa,ab,ad) values(2,1,2,2);
select * from root.ChangSha.* where time=1 and aa=1

如果一切成功,恭喜!


不成功可能的原因:

(1)对于github仓库没有权限。

(2)本地库比远程库要旧,需要重新merge一下远程分支


不管成功与否本地的所有pom文件都会出现一个同名的以releaseBackup为结尾的文件。


如果发生了失败,先执行:

$ mvn release:rollback

如果执行也失败,就再执行一次。。一般就成功了。

然而这个rollback并不会删除tag,还需要手动删除。

删本地 tag:$git tag -d v0.12.x

删远端 tag:git push origin :refs/tags/v0.12.x

我的话,没有用rollback这个指令,而是直接覆盖重新再来:

git fetch origin
git reset --hard origin/rel/0.11
git clean -fx -d // To remove ignored and non-ignored directories ⭐
git status // 检查确认一下
git log // 检查确认一下



maven官方参考链接:https://maven.apache.org/maven-release/maven-release-plugin/examples/prepare-release.html


3.2 自动从github上下载下来源码,并重新编译后上传到Apache Nexus仓库

执行:

$ mvn release:perform -P site  

0.12版本开始,命令改为:

mvn release:perform  -P site -P compile-cpp -P code-coverage -P get-jar-with-dependencies

0.13版本开始,命令改为:

mvn release:perform  -P site -P compile-grafana-plugin -P compile-cpp -P code-coverage -P get-jar-with-dependencies


就开始真正的发布并上传到apache的服务器了。

。。。

。。。

漫长的等待

。。。

。。。

我使用教育网花费了46分钟。。

(注:建议在北京时间的早晨执行该步,网速比晚上快很多)


maven官方参考链接:https://maven.apache.org/maven-release/maven-release-plugin/examples/perform-release.html


3.3 进行签名认证

首先网页打开网站 https://repository.apache.org   (一直转圈加载不出来就关了重开几次)

然后点右上角的登录!用apache账号登录。

登录成功后,你的左边栏的Repositories就会出现 Staging Repositories,点击他,能看到如下图的列表,找到项目名字为 “orgapacheiotdb-数字” 这样的一行,选中后点击上方的close按钮。

注意如果存在多个编号,检查一下时间,时间比较小的drop掉,留下时间比较大的close

然后就开始等待完成close,期间可以点击refresh更新页面。也可以选中iotdb后,点击下方的activity,来查看具体的close进度和问题。

都没问题后就开始下一步。

如果close失败了,可以再 close 一下。我遇到了没有找到我的 公钥的问题,但是其实网上可以搜到,再close 一次就可以了。

如果之前的~/.gnupg/gpg.conf中的 key不对,会导致close失败。只能重新3从来过!!!

注:close成功后,点击activity一栏会看到如下成功操作的信息:

  • open
  • close
    • Evaluating rules: Apache Rules
    • Evaluating rule: Signature Validation
    • Passed: Signature Validation
    • Evaluating rule: Archives must not contain insecure paths
    • Passed: Archives must not contain insecure paths
    • Evaluating rule: Checksum Validation
    • Passed: Checksum Validation
    • All rules passed: Apache Rules
    • Repository closed


3.3 上传编译好的文件到dist网站

现在可以把需要的内容都上传到dist了。

对于每次发布,可以先发布RC1版本,有问题要修改的话再发布RC2版,以此类推。在投票通过前,都发布到dev下,通过后再移动到release下。

3.3.1 发布到dev下

地址是https://dist.apache.org/repos/dist/dev/iotdb

这其实是一个SVN仓库,我们在1.d1操作步骤的时候已经将这个SVN仓库下载到本地了,本地文件夹名字叫做 iotdb-dist-dev。

下面暂时以iotdb-dist-dev为根目录,你会看到当前的目录如下图所示(应该没有0.8.1这个文件夹)

然后就按照上图所示,创建0.11.1文件夹,再创建0.11.1/rc1文件夹。

然后从iotdb源码的根目录下的target/checkout/将README.md,README_ZH.mdRELEASE_NOTES.md拷贝进来。

再从iotdb源码/target/checkout/target/apache-iotdb-0.11.1-source-release.zip* (zip, zip.asc, zip.sha512三个文件)拷贝进来;

再从Iotdb源码/target/checkout/distribution/target/apache-iotdb-0.11.1-bin.zip* (zip, zip.asc, zip.sha512三个文件)拷贝进来;

(注:0.12版本的二进制文件更多,源码包要注意checkout的路径,“target/checkout/target”)


然后用svn命令提交:

$ svn add 0.11.1

如果这个目录以及添加了,需要添加 svn add 0.11.1/rc2

$ svn commit -m "perparing RC1 of 0.11.1 of IoTDB release"


release那个svn,最多保留5个版本的下载!如果过多了,请记得删除之前的版本!



3.4 标记github上的release为pre-release

https://github.com/apache/iotdb/releases,找到刚打的release,点击edit tag ,选中 This is a pre-release ,然后 Save draft

(这是因为“发行版不稳定,要通知用户该版本还不适合投入生产“,所以选择 This is a pre-release(这是预发行版),参考链接:https://help.github.com/cn/github/administering-a-repository/creating-releases

点击这里,然后

然后在Release title里写好版本: release/x.x.x

3.5 写邮件

参考例子:(自己写的时候一定要仔细检查更新)

邮件标题:[VOTE] Apache IoTDB 0.11.1  RC2 release

邮件模板:

Hi all,

(这一句是可选的) Apache IoTDB 0.11.1 is a bug-fix version from 0.11.0. You can get its mainly changes from [5]. 

Apache IoTDB 0.8.1 has been staged under [2] and it’s time to vote
on accepting it for release.  All Maven artifacts are available under [1].
Voting will be open for 72hr.
A minimum of 3 binding +1 votes and more binding +1 than binding -1
are required to pass.

Release tag: v0.11.1
Hash for the release tag: 37b213b6ab6fc8ca13ab60f21dff099042a0e295

Before voting +1, PMC members are required to download
the signed source code package, compile it as provided, and test
the resulting executable on their own platform, along with also
verifying that the package meets the requirements of the ASF policy
on releases. [3]

You can achieve the above by following [4].

[ ]  +1 accept (indicate what you validated - e.g. performed the non-RM items in [4])
[ ]  -1 reject (explanation required)


(这也是可选的)Difference with RC1:

[1] https://repository.apache.org/content/repositories/orgapacheiotdb-1050
[2] https://dist.apache.org/repos/dist/dev/iotdb/0.11.1/rc2
[3] https://www.apache.org/dev/release.html#approving-a-release
[4] https://cwiki.apache.org/confluence/display/IOTDB/Validating+a+staged+Release

[5] https://dist.apache.org/repos/dist/dev/iotdb/0.11.1/rc2/RELEASE_NOTES.md

[6] https://dist.apache.org/repos/dist/dev/iotdb/KEYS


上面红色的字都是需要改的。

其中tag的hash值可以通过如下命令拿到:

$ git show v0.11.1 --name-only

4 投票失败了怎么办

投票失败时,需要先清理战场,然后重新发布。

首先把Nexus上的发布关闭掉,方法是登录到 repository.apache.org 后,然后选中刚才的行,点击 Drop 按钮。

然后手动删除github上的release和tag,以及本地的tag。

(在这个文档中,一定不要把下面的分支名字换成一个真实存在的名字,防止有人直接复制粘贴)

删本地 tag:$git tag -d v0.12.x

删远端 tag:git push origin :refs/tags/v0.12.x

删除远端 tag:git push origin :refs/tags/release/0.11.x

删除本地 tag:git tag -d release/0.11.x



然后使用maven插件来管理版本就好:

$ mvn release:prepare -DautoVersionSubmodules=true

当然这一步你也可以用git revert 来实现。

然后开始修改各种投票中大家发现的问题。并提交到rel/0.11.

之后跳转到步骤3重新开始。


并且投票失败了也要写一个RESULT邮件告知情况和下一步的打算,比如参考以前发布经理的例子:https://lists.apache.org/thread.html/89b0af63c0af7455641f738e2500a8a92a2cb4f9efca5456371bf06f%40%3Cdev.iotdb.apache.org%3E

5. 投票通过后怎么办


投票72小时之后要做一个总结邮件:

参考例子:(自己写的时候一定要仔细检查更新)

主题:[RESULT][VOTE] Release Apache IoTDB 0.9.0


Hi all,

The vote to release Apache IoTDB (incubating) 0.8.2 has passed with 3 +1 binding votes and 1 +1 non-binding vote.

binding votes:

xxx

xxx

donon-binding vote:
xxx

Vote thread:
https://lists.apache.org/thread.html/9653646c533df93e286a512b2b5c544b8d7bc9a565183806feeec642%40%3Cgeneral.incubator.apache.org%3E


感谢的话

你的名字


这个 vote thread 可以去这个网页搜:https://lists.apache.org/list.html?dev@iotdb.apache.org

用 apache 账户登录,找到投票的 thread,然后右边这个 permalink 是永久链接,点进去之后拷贝网址就行了。

如果有分裂开的投票线程,可以直接粘贴多个



6. 通过后怎么办


把发布好的文件从dev仓库中移动到release的svn项目中。

release的svn地址是:https://dist.apache.org/repos/dist/release/iotdb

如果第一次的话,可以clone这个仓库,然后增加文件,然后提交。

$svn co https://dist.apache.org/repos/dist/release/iotdb

$cd iotdb

$拷贝文件过来,放在 版本下,例如 下面的0.11.1就是我刚刚放过去的。



MacBook-Pro-3:iotdb-rel hxd$ tree .
.
├── 0.11.0
│   ├── README.md
│   ├── RELEASE_NOTES.md
│   ├── apache-iotdb-0.11.0-bin.zip
│   ├── apache-iotdb-0.11.0-bin.zip.asc
│   ├── apache-iotdb-0.11.0-bin.zip.sha512
│   ├── apache-iotdb-0.11.0-source-release.zip
│   ├── apache-iotdb-0.11.0-source-release.zip.asc
│   └── apache-iotdb-0.11.0-source-release.zip.sha512
├── 0.11.1-incubating
│   ├── README.md
│   ├── RELEASE_NOTES.md
│   ├── apache-iotdb-0.11.1-bin.zip
│   ├── apache-iotdb-0.11.1-bin.zip.asc
│   ├── apache-iotdb-0.11.1-bin.zip.sha512
│   ├── apache-iotdb-0.11.1-source-release.zip
│   ├── apache-iotdb-0.11.1-source-release.zip.asc
│   └── apache-iotdb-0.11.1-source-release.zip.sha512
└── KEYS



然后提交:

$svn add 0.11.1

$svn commit -m "upload 0.11.1 release files"(只有PMC有写权限,可以把文件夹打个包发给PMC,让PMC帮忙执行这一步)


如果你的keys也修改了,可能还要在更新下keys文件。



注意:所有的apache 镜像都会开始同步这些文件了,一般会在24小时内同步完成。

这里可能会可以很快加载出下载页面,但是里面的下载链接都是无法打开和下载的,必须等到下载链接可以正常下载,才表示同步真正完成

d

7. 删除旧版本的发布文件

Apache似乎要求当新版本都同步好后,删除掉旧版本的文件(例如本例中是0.11.0),但是我查看了几个项目,这个不是绝对要求的。。建议保留一些版本。

删除方法是用 svn delete命令删除文件夹即可。

例如:$svn delete https://dist.apache.org/repos/dist/release/iotdb/0.8.0/ -m"deleted version 0.11.0"

还可以如下删除:

svn delete 要删除的文件或者文件夹

svn commit -m "写上提交日志"


8. 正式发布Maven文件


进入https://repository.apache.org/#welcome,登录账号,然后到Staging Repositories中选中你之前close的版本,选择release。完事儿。


9. github publish release

https://github.com/apache/iotdb/releases,把之前this is a pre-release & save draft的改为publish release。


10. 将release分支的代码更新到最新


我们项目中,release分支始终指向最新的发布版本。

git checkout release
git merge release/0.11.1

如果有有冲突,那么全盘接收tag上的修改,可以使用如下命令:

git merge -X theirs release/0.11.1


11. 更新JIRA

  1. Set the released version to "released" and set the "release-date"

  2. Add the next version to the versions.

目前这个操作只能够由ppmc执行


12. 修改master分支代码

如果只是小版本发布,可以直接跳过本节。

当有大版本发布时,例如从0.9.3发布到0.10.0时,需要(1)修改master分支的版本号到0.11.0-SNAPSHOT;(2)更复杂的是修改官网的文档目录;(3)修改官网链接。

(1)master分支代码主要是修改版本号。

方法:

首先运行 `mvn clean -P site` 把target目录都清理下。

然后在IDEA中全局搜索 0.10.0-SNAPSHOT,逐个检查并替换成0.11.0-SNAPSHOT。

(2)修改官网的文档目录。该项工作也仅需要在发布大版本时操作。

方法:以添加0.10.x的文档为例,增加如下代码:


(2.1)在site/pom.xml中找到 ”<!-- download lagecy docs from iotdb repo -->“,在该plugin下的exectuions进行修改。

<execution>
    <id>get-0.10-docs</id>
    <phase>generate-sources</phase>
    <goals>
        <goal>wget</goal>
    </goals>
    <configuration>
        <url>https://github.com/apache/incubator-iotdb/archive/rel/0.10.zip</url>
        <outputDirectory>${project.build.directory}/download</outputDirectory>
        <outputFileName>0.10.x.zip</outputFileName>
    </configuration>
</execution>

注意上述代码中仅需要把0.10替换成对应的版本就行(注意版本号中的x保留)。

(2.2)找到"<!-- unpack lagecy docs from the zip files-->",在plugin下的exectuions进行修改。

<execution>
    <id>copy-0.10-documentation</id>
    <goals>
        <goal>copy</goal>
    </goals>
    <phase>generate-sources</phase>
    <configuration>
        <fileset>
            <directory>${project.build.directory}/download/0.10.x.zip/incubator-iotdb-rel-0.10/docs/UserGuide</directory>
            <outputDirectory>${project.build.directory}/vue-source/src/UserGuide/V0.10.x</outputDirectory>
        </fileset>
    </configuration>
</execution>
<execution>
    <id>copy-0.10-zh-documentation</id>
    <goals>
        <goal>copy</goal>
    </goals>
    <phase>generate-sources</phase>
    <configuration>
        <fileset>
            <directory>${project.build.directory}/download/0.10.x.zip/incubator-iotdb-rel-0.10/docs/zh/UserGuide</directory>
            <outputDirectory>${project.build.directory}/vue-source/src/zh/UserGuide/V0.10.x</outputDirectory>
        </fileset>
    </configuration>
</execution>

同理也只需要修改版本号就行(注意版本号中的x保留)。

(2.3)修改site/src/main/.vuepress/config.js 中的siderbar模块,添加相应链接。

格式上,每个文档的格式为:

{
 title: '0-Get Started',
 children: [
  ['0-Get Started/1-QuickStart','QuickStart'],
  ['0-Get Started/2-Frequently asked questions','Frequently asked questions'],
  ['0-Get Started/3-Publication','Research Papers']
 ]
}
title是显示给用户的文档一级目录名字。
children下每个是一个文档。逗号前面是docs/UserGuide文件夹下的相对路径(不含文件名上的".md"),逗号后面是显示给用户的文档名。

但是实际中一般不需要自己手动写这些条目:理论上'/UserGuide/Master/' 下对应的内容就直接拷贝过来,然后改名称当前版本号就行了。


注意中文、英文两个都要做。

此外再搜索nav模块,添加新版本的文档链接。

items: [
 { text: 'In progress', link: '/UserGuide/Master/Get Started/QuickStart' },
 { text: 'V0.10.x', link: '/UserGuide/V0.10.x/Get Started/QuickStart' },
 { text: 'V0.9.x', link: '/UserGuide/V0.9.x/0-Get Started/1-QuickStart' },
 { text: 'V0.8.x', link: '/UserGuide/V0.8.x/0-Get Started/1-QuickStart'},
]

items: [
  { text: 'In progress', link: '/zh/UserGuide/Master/Get Started/QuickStart' },
 { text: 'V0.10.x', link: '/zh/UserGuide/V0.10.x/Get Started/QuickStart' },
  { text: 'V0.9.x', link: '/zh/UserGuide/V0.9.x/0-Get Started/1-QuickStart' },
  { text: 'V0.8.x', link: '/zh/UserGuide/V0.8.x/0-Get Started/1-QuickStart'},
]


(2.4)因为这个改动太大了。建议做一遍编译检查下。

进入到site目录,运行`mvn  generate-sources`。

然后再进入site目录下的target/vue-source,运行`npm install`, `npm run dev`。

就能在本地测试网页了。(也可以在第13节的下载链接修改完成后但是还没部署前做测试)


13. 更新官网的下载链接

修改master分支的 docs/Download/README.md 和 zh/Download/README.md,注意表格中只保留每个大版本的最新版本。

具体的:

官网下载链接目前要求都用镜像总站,

二进制下载链接 binary-distribution:https://www.apache.org/dyn/closer.cgi/incubator/iotdb/0.8.0-incubating/apache-iotdb-0.8.0-incubating-bin.zip

SHA文件和ASC文件可以用svn上的地址:

SHA:https://www.apache.org/dist/incubator/iotdb/0.8.0-incubating/apache-iotdb-0.8.0-incubating-bin.zip.sha512

ASC:https://www.apache.org/dist/incubator/iotdb/0.8.0-incubating/apache-iotdb-0.8.0-incubating-bin.zip.asc

源码下载版本 source-release:https://www.apache.org/dyn/closer.cgi/incubator/iotdb/0.8.0-incubating/apache-iotdb-0.8.0-incubating-source-release.zip


SHA文件和ASC文件可以用svn上的地址:

SHA:https://www.apache.org/dist/incubator/iotdb/0.8.0-incubating/apache-iotdb-0.8.0-incubating-source-release.zip.sha512

ASC:https://www.apache.org/dist/incubator/iotdb/0.8.0-incubating/apache-iotdb-0.8.0-incubating-source-release.zip.asc


RELEASE_NOTE文件其实也可以用SVN上的,但是我们这个项目svn上的在网页上打开就丢了换行符。。所以可以用github的raw文件:

https://raw.githubusercontent.com/apache/incubator-iotdb/release/0.8.1/RELEASE_NOTES.md

将上面的版本改成你最终的版本即可。


当发布大版本的时候,还需要更新docs/UserGuide/UserGuideReadme.md 和docs/zh/UserGuide/UserGuideReadme.md ,

将大版本对应的网页链接放进去,如:


- [In progress version](https://iotdb.apache.org/UserGuide/Master/Get%20Started/QuickStart.html) 
- [Version 0.8.x](/zh/UserGuide/V0.8.x/0-Get%20Started/1-QuickStart.html) - [Version 0.10.x](https://iotdb.apache.org/UserGuide/V0.10.x/Get%20Started/QuickStart.html)
- [Version 0.9.x](/zh/UserGuide/V0.9.x/0-Get%20Started/1-QuickStart.html) - [Version 0.9.x](https://iotdb.apache.org/UserGuide/V0.9.x/0-Get%20Started/1-QuickStart.html)
- [Version 0.8.x](https://iotdb.apache.org/UserGuide/V0.8.x/0-Get%20Started/1-QuickStart.html)



往master分支提个pr,pr合进master后网页会自动部署,等待部署成功、官网更新后,再昭告天下:

14. 昭告天下!

当你确认多数镜像都同步好了之后,可以昭告天下发布新版本的信息了:

发邮件的邮箱:务必是apache.org的邮箱,否则会被拒收。邮件必须是纯文本,否则,也会被拒收。

发送邮件到:announce@apache.org

抄送邮件到:dev@iotdb.apache.org

消息主题:[ANNOUNCE] Apache IoTDB 0.12.6 released

消息内容示例:


The Apache IoTDB team is pleased to announce the release of Apache IoTDB 0.12.6.



Apache IoTDB (Database for Internet of Things) is an IoT native database with high performance for data management and analysis, deployable on the edge and the cloud.

This is a bug-fixed version of 0.12.5, which includes a number of improvements:
## Improvements
* [IOTDB-3515] Make the message clear when loading empty TsFile

## Bug Fixes
* [IOTDB-2773] Fix overlapped data should be consumed first bug
* [IOTDB-3135] Fix parameter max_select_unseq_file_num_in_each_unseq_compaction doesn't work
* [IOTDB-3292] Fix chunk size overflow in level compaction
* [IOTDB-3392] Fix File doesn't exist when moving TsFile when virtual_storage_group > 1
* [IOTDB-3398] Remove the exception when query meet a device is not in TsFile, which is a normal case
* [IOTDB-3602] Skip empty TsFile when loading directory
* [ISSUE-4399] When non-root user get an empty query result, return no permission error message
* [ISSUE-5809] Fix bug: sum aggregation result return 0 when no data
* Fix data in seq files overlapped


The full release note is available at:
https://raw.githubusercontent.com/apache/iotdb/v0.12.6/RELEASE_NOTES.md

The release is available for download at:
http://iotdb.apache.org/Download

Maven artifacts for JDBC driver, session SDK, TsFile SDK, Spark-connector, Hadoop-connector, Hive-connector and Flink-connector can be found at:
https://search.maven.org/search?q=g:org.apache.iotdb


Docker image of IoTDB server can be found at:
https://hub.docker.com/r/apache/iotdb

Python API package can be found at:
https://pypi.org/project/apache-iotdb/


Regards,
The Apache IoTDB team

更多参考例子:https://lists.apache.org/list.html?dev@iotdb.apache.org:gte=1d:announce


发布Python包到Pypi

首先,你要有一个账号,在这里注册:https://pypi.org/account/register/

其次,最好在注册一个测试仓库的账号,在这里https://test.pypi.org/account/register/


注意:在正式发布之前要先在测试仓库确保没有问题。因为正式发布之后PyPI does not allow for a filename to be reused, even once a project has been deleted and recreated.

即正式发布之后再发现有问题,即便删除了那个包,已经用过的名字(比如apache-iotdb 0.11.1)也不可再用于重新上传了。


自己电脑上需要安装python3、pip3;安装后,还需要安装setuptools和wheel和twine

python3 -m pip install --user --upgrade setuptools wheel
python3 -m pip install --user --upgrade twine

我执行上面这个指令时候,报错: creating build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c build/temp.linux-x86_64-3.6/_openssl.c -o build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6/_openssl.o -Wconversion -Wno-error=sign-conversion
build/temp.linux-x86_64-3.6/_openssl.c:22:24: fatal error: pyconfig.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
解决办法:sudo apt install python3.6-dev (我的python是3.6版本)


然后,在整个项目编译后,进入client-py/文件夹。


注意一定要在进行下一步前编译项目,否则发布出来的版本会缺少thrift 相关的依赖。。。。(血的教训)


(注意:iotdb/client-py/src/pypi/setup.py和iotdb/client-py/src/pypi/README.md中的版本号、链接等,应该在上述第2步“准备发布版本”就已完成更新。)


如果是第一次发布,可以在测试仓库进行实验:

python3 setup.py sdist bdist_wheel

python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*


注意:上传测试版本时,python3 setup.py sdist bdist_wheel使用的setup.py里的name要修改,可以在后面后缀上自己的用户名(像这样:name="example-pkg-YOUR-USERNAME-HERE"),否则无法会报错:The credential associated with user 'xxx' isn't allowed to upload to project 'apache-iotdb'。正式上传之前,记得把setup.py里的name改回来,删掉egg-info,dist,build这三个文件夹,之后重新生成。


完成后的输出示例:

MacMini-FIT:generated-sources-python hxd$ python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
Uploading distributions to https://test.pypi.org/legacy/
Enter your username:

 
Enter your password:
Uploading apache_iotdb-0.9.0rc5-py3-none-any.whl
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 33.5k/33.5k [00:04<00:00, 7.14kB/s]
Uploading apache-iotdb-0.9.0rc5.tar.gz
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 26.0k/26.0k [00:01<00:00, 16.0kB/s]

View at:
https://test.pypi.org/project/apache-iotdb/0.9.0rc5/

网页的效果:https://test.pypi.org/project/apache-iotdb/

然后本地可以下载下来试用试用:

(官方教程建议使用virtualevn,但是我在virtualevn中pip install的包不生效 很奇怪):

python3 -m pip install --index-url https://test.pypi.org/simple/ apache-iotdb==0.9.0-rc5 (假设版本是0.9.0-rc5)

注意,如果上述命令失败,那说明这个test pypi下没有thrift包,此时可以使用--no-deps参数跳过thrift安装:

python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps apache-iotdb==0.9.0-rc5 (假设版本是0.9.0-rc5)

不过并没有什么用。。因为没有thrift就没法运行。。

所以准确流程是:

python3 -m pip install thrift==0.13.0

python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps apache-iotdb==0.9.0-rc5


然后跑一下client-py下的client-example.py看是否正确。


如果不是在virtualevn环境下,记得用完后删除这个临时包:python3 -m pip uninstall apache-iotdb



一切OK,就可以正式发布了:(注:如果之前为了测试修改过setup.py,这里记得把setup.py里的name改回来重新生成dist文件夹)

控制台运行:python3 setup.py sdist bdist_wheel

python3 -m twine upload  dist/*

注:如果没有上传权限找项目管理员。


这部分内容参考了

https://packaging.python.org/tutorials/packaging-projects/


发布Docker 镜像包到DockerHub

首先,你需要有dockerhub网站下的用户名。

其次,需要去JIRA的INFRA项目中申请(在模仿 INFRA-22636 - Getting issue details... STATUS ,创建一个ISSUE),给自己的用户名增加dockerhub中apache/iotdb项目的权限。如果不是PMC,还需要PMC去那个ISSUE下面留个言,approve一下。

注意,每个项目的 dockerhub 只允许 5 个名额,如果需要新增用户进 dockerhub 的 iotdb/committer,则需要在 Jira 中说明被替换走的用户是谁。

以上准备工作就做好了。

然后编写Dockerfile脚本,0.9.1的示例如下(该脚本需要根据每个版本的实际部署方式不同进行修改):

FROM openjdk:11-jre-slim
RUN apt update \
  # procps is for `free` command
  && apt install wget unzip lsof procps -y \
  #&& wget https://www-us.apache.org/dist/incubator/iotdb/0.9.1-incubating/apache-iotdb-0.9.1-incubating-bin.zip \
  && wget http://mirrors.tuna.tsinghua.edu.cn/apache/incubator/iotdb/0.9.1-incubating/apache-iotdb-0.9.1-incubating-bin.zip \
  && unzip apache-iotdb-0.9.1-incubating-bin.zip \
  && rm apache-iotdb-0.9.1-incubating-bin.zip \
  && mv apache-iotdb-0.9.1-incubating /iotdb \
  && apt remove wget unzip -y \
  && apt autoremove -y \
  && apt purge --auto-remove -y \
  && apt clean -y
EXPOSE 6667
EXPOSE 31999
EXPOSE 5555
EXPOSE 8181
VOLUME /iotdb/data
VOLUME /iotdb/logs
ENV PATH="/iotdb/sbin/:/iotdb/tools/:${PATH}"
ENTRYPOINT ["/iotdb/sbin/start-server.sh"]


Dockerfile-0.12.4-node的示例

#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

FROM openjdk:11-jre-slim
RUN apt update \
  # procps is for `free` command
  && apt install wget unzip lsof procps -y \
  && wget https://downloads.apache.org/iotdb/0.12.4/apache-iotdb-0.12.4-server-bin.zip \
  # if you are in China, use the following URL
  #&& wget https://mirrors.tuna.tsinghua.edu.cn/apache/iotdb/0.12.4/apache-iotdb-0.12.4-server-bin.zip \
  && unzip apache-iotdb-0.12.4-server-bin.zip \
  && rm apache-iotdb-0.12.4-server-bin.zip \
  && mv apache-iotdb-0.12.4-server-bin /iotdb \
  && apt remove wget unzip -y \
  && apt autoremove -y \
  && apt purge --auto-remove -y \
  && apt clean -y
# rpc port
EXPOSE 6667
# JMX port
EXPOSE 31999
# sync port
EXPOSE 5555
# monitor port
EXPOSE 8181
VOLUME /iotdb/data
VOLUME /iotdb/logs
ENV PATH="/iotdb/sbin/:/iotdb/tools/:${PATH}"
ENTRYPOINT ["/iotdb/sbin/start-server.sh"]


Dockerfile-0.12.4-cluster的示例

#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

FROM openjdk:11-jre-slim
RUN apt update \
  # procps is for `free` command
  && apt install wget unzip lsof procps -y \
  && wget https://downloads.apache.org/iotdb/0.12.4/apache-iotdb-0.12.4-cluster-bin.zip \
  # if you are in China, use the following URL
  #&& wget https://mirrors.tuna.tsinghua.edu.cn/apache/iotdb/0.12.4/apache-iotdb-0.12.4-cluster-bin.zip \
  && unzip apache-iotdb-0.12.4-cluster-bin.zip \
  && rm apache-iotdb-0.12.4-cluster-bin.zip \
  && mv apache-iotdb-0.12.4-cluster-bin /iotdb \
  && apt remove wget unzip -y \
  && apt autoremove -y \
  && apt purge --auto-remove -y \
  && apt clean -y \
  # modify the seeds in configuration file
  && sed -i '/^seed_nodes/cseed_nodes=127.0.0.1:9003' /iotdb/conf/iotdb-cluster.properties \
  && sed -i '/^default_replica_num/cdefault_replica_num=1' /iotdb/conf/iotdb-cluster.properties

# rpc port
EXPOSE 6667
# JMX port
EXPOSE 31999
# sync port
EXPOSE 5555
# monitor port
EXPOSE 8181
# internal meta port
EXPOSE 9003
# internal data port
EXPOSE 40010
VOLUME /iotdb/data
VOLUME /iotdb/logs
ENV PATH="/iotdb/sbin/:/iotdb/tools/:${PATH}"
ENTRYPOINT ["/iotdb/sbin/start-node.sh"]

Dockerfile-0.12.4-grafana的示例

#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

FROM openjdk:11-jre-slim
RUN apt update \
  # procps is for `free` command
  && apt install wget unzip lsof procps -y \
  && wget https://downloads.apache.org/iotdb/0.12.4/apache-iotdb-0.12.4-grafana-bin.zip \
  # if you are in China, use the following URL
  #&& wget https://mirrors.tuna.tsinghua.edu.cn/apache/iotdb/0.12.4/apache-iotdb-0.12.4-grafana-bin.zip \
  && unzip apache-iotdb-0.12.4-grafana-bin.zip \
  && rm apache-iotdb-0.12.4-grafana-bin.zip \
  && mv apache-iotdb-0.12.4-grafana-bin /iotdb-grafana \
  && apt remove wget unzip -y \
  && apt autoremove -y \
  && apt purge --auto-remove -y \
  && apt clean -y
# rpc port
EXPOSE 8888
VOLUME /iotdb-grafana/config
RUN echo "#!/bin/bash" > /iotdb-grafana/runboot.sh
RUN echo "java -Djava.security.egd=file:/dev/./urandom -jar /iotdb-grafana/iotdb-grafana.war" >> /iotdb-grafana/runboot.sh
RUN chmod a+x /iotdb-grafana/runboot.sh
WORKDIR /iotdb-grafana
ENTRYPOINT ["./runboot.sh"]

Dockerfile-0.13.0-grafana-connector的示例

#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

FROM openjdk:11-jre-slim
RUN apt update \
  # procps is for `free` command
  && apt install wget unzip lsof procps -y \
  && wget https://downloads.apache.org/iotdb/0.13.0/apache-iotdb-0.13.0-grafana-connector-bin.zip \
  # if you are in China, use the following URL
  #&& wget https://mirrors.tuna.tsinghua.edu.cn/apache/iotdb/0.13.0/apache-iotdb-0.13.0-grafana-connector-bin.zip \
  && unzip apache-iotdb-0.13.0-grafana-connector-bin.zip \
  && rm apache-iotdb-0.13.0-grafana-connector-bin.zip \
  && mv apache-iotdb-0.13.0-grafana-connector-bin /iotdb-grafana-connector \
  && apt remove wget unzip -y \
  && apt autoremove -y \
  && apt purge --auto-remove -y \
  && apt clean -y
# rpc port
EXPOSE 8888
VOLUME /iotdb-grafana-connector/config
RUN echo "#!/bin/bash" > /iotdb-grafana-connector/runboot.sh
RUN echo "java -Djava.security.egd=file:/dev/./urandom -jar /iotdb-grafana-connector/iotdb-grafana-connector.war" >> /iotdb-grafana-connector/runboot.sh
RUN chmod a+x /iotdb-grafana-connector/runboot.sh
WORKDIR /iotdb-grafana-connector
ENTRYPOINT ["./runboot.sh"]


注意该脚本可以存储到docker/src/main下。


然后本地构造image (注意运行的时候 要确保Dockerfile文件夹内没有别的文件):

docker build -t apache/iotdb:0.9.1 .

0.12.X版本可以用下面的命令

docker build -t apache/iotdb:0.12.4-node . -f Dockerfile-0.12.4-node

docker build -t apache/iotdb:0.12.4-cluster . -f Dockerfile-0.12.4-cluster

docker build -t apache/iotdb:0.12.4-grafana . -f Dockerfile-0.12.4-grafana

0.13.X版本可以用下面的命令

docker build -t apache/iotdb:0.13.0-node . -f Dockerfile-0.13.0-node

docker build -t apache/iotdb:0.13.0-cluster . -f Dockerfile-0.13.0-cluster

docker build -t apache/iotdb:0.13.0-grafana-connector . -f Dockerfile-0.13.0-grafana-connector


然后本地尝试运行:

docker run -d -p 6667:6667 -p 31999:31999 -p 8181:8181 apache/iotdb:0.12.4-node


如果需要杀死该镜像,使用docker ps 查看容器id,然后使用docker kill 容器id即可。


进行测试,启动iotdb-client进行连接和增删改查操作:

docker exec -it a4434aff6123(需要替换成上一步自己运行的的CONTAINER ID) /bin/bash


都没问题的话,可以上传镜像了:

首先需要登录docker:

docker login --username=yourhubusername 

使用docker images再确认一遍容器,以及容器的tag:

以上图为例,其中apache/iotdb 0.9.0和0.9.1拥有相同的Image ID的原因是,我在构建0.9.1的时候,错误地将版本号指定成了0.9.0。

因此构建完成镜像后一定要使用客户端连接iotdb进行测试。


如果构建镜像的时候,名字不是apache/iotdb这种类型,或者版本号不正确,还有机会修改:

docker tag 6a6365cd99d0  apache/iotdb:0.12.4-node

上传吧:

docker push apache/iotdb:0.12.4-node

如果是最新版本(比如还没有0.10,那么0.9.x就是最新版本。但是假设0.10.0已经发布,那么再上传0.9.5就不算最新版),还要更新下latest标签:

docker tag  apache/iotdb:0.12.4-node  apache/iotdb:latest

docker push apache/iotdb:latest


(注意目前有三个镜像要打:node,cluster,grafana)。

完成。


docker push apache/iotdb:0.12.4-node

docker push apache/iotdb:0.12.4-cluster 

docker push apache/iotdb:0.12.4-grafana 


0.13.x之后

docker push apache/iotdb:0.13.0-node

docker push apache/iotdb:0.13.0-cluster 

docker push apache/iotdb:0.13.0-grafana-connector


发布 跨平台的docker镜像

以0.13.1为例,在 Docker 19.03+ 版本中可以使用 docker buildx build 命令使用 BuildKit 构建镜像。该命令支持 --platform 参数可以同时构建支持多种系统架构的 Docker 镜像。(例如linux/amd64,linux/arm64)

dockerfile如下:

只修改了第一行,将jdk 替换成了eclipse-temurin:11-jre-focal,因为这个JDK支持amd64、arm/v7、arm64/v8三种版本,并且是ubuntu-focal,可以正常使用apt-get

FROM --platform=$TARGETPLATFORM eclipse-temurin:11-jre-focal
RUN apt update \
  # procps is for `free` command
  && apt install wget unzip lsof procps -y \
  && wget https://downloads.apache.org/iotdb/0.13.1/apache-iotdb-0.13.1-server-bin.zip \
  # if you are in China, use the following URL
  #&& wget https://mirrors.tuna.tsinghua.edu.cn/apache/iotdb/0.13.1/apache-iotdb-0.13.1-server-bin.zip \
  && unzip apache-iotdb-0.13.1-server-bin.zip \
  && rm apache-iotdb-0.13.1-server-bin.zip \
  && mv apache-iotdb-0.13.1-server-bin /iotdb \
  && apt remove wget unzip -y \
  && apt autoremove -y \
  && apt purge --auto-remove -y \
  && apt clean -y
# rpc port
EXPOSE 6667
# JMX port
EXPOSE 31999
# sync port
EXPOSE 5555
# monitor port
EXPOSE 8181
VOLUME /iotdb/data
VOLUME /iotdb/logs
ENV PATH="/iotdb/sbin/:/iotdb/tools/:${PATH}"
ENTRYPOINT ["/iotdb/sbin/start-server.sh"]


安装buildx:

# 确定可以使用buildx,否则要升级docker

docker buildx version

# 指定buildx使用docker-container

docker buildx create --name mybuilder --driver docker-container

docker buildx use mybuilder

# 开启用于多平台镜像构建的镜像

docker run --rm --privileged tonistiigi/binfmt:latest --install all 


构建并上传

## apache/iotdb:latest

docker buildx build --platform linux/amd64,linux/arm64/v8,linux/arm/v7 -t apache/iotdb:latest -f Dockerfile-0.13.1-node . --push

## apache/iotdb:0.13.1-node

docker buildx build --platform linux/amd64,linux/arm64/v8,linux/arm/v7 -t apache/iotdb:0.13.1-node -f Dockerfile-0.13.1-node . --push


发布 Go client (如果有需要发布)


本地clone go client 代码

git clone https://github.com/apache/iotdb-client-go

checkout 到相应的 rel/xx 分支,检查是否有遗漏的commit,如果有,可以从main分支cherry-pick过来。

打tag 并push到 github 仓库

git tag v0.xx.x

git push origin v0.xx.x


进入下面的链接,点 draft a new release,选刚才打的那个tag 之后 release 就行。

https://github.com/apache/iotdb-client-go/releases




That is all.













  • No labels

1 Comment

  1. 发布 Python 包到 Pypi 的时候,遇到了以下问题:

    requests.exceptions.SSLError: HTTPSConnectionPool(host='test.pypi.org', port=443): Max retries exceeded with url: /legacy/ (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:720)'),))

    网上说是因为 pip 版本的问题,但是我无论如何更新 pip / python 版本,都一直报这个错误,如果以后的 RM 遇到这个问题并有解决方案,烦请告知 :)