You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pegasus.apache.org by wu...@apache.org on 2020/10/15 06:06:57 UTC

[incubator-pegasus-website] branch master updated: feat: support multi-version docs

This is an automated email from the ASF dual-hosted git repository.

wutao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus-website.git


The following commit(s) were added to refs/heads/master by this push:
     new efdc32d  feat: support multi-version docs
efdc32d is described below

commit efdc32d25bb5f66a402c40dade0eb266baf545e8
Author: neverchanje <wu...@gmail.com>
AuthorDate: Thu Oct 15 14:05:03 2020 +0800

    feat: support multi-version docs
---
 Gemfile                                        |  1 +
 _config.yml                                    |  6 ++
 _data/docs_menu.yml                            |  4 ++
 _data/overview_menu.yml                        |  2 +-
 _docs/en/installation.md                       |  5 ++
 {_overview/zh => _docs/zh/1.x}/installation.md |  3 +-
 {_overview => _docs}/zh/installation.md        | 78 +++++++++-----------------
 _includes/version-select.html                  | 34 +++++++++++
 _layouts/docs.html                             |  9 ++-
 _overview/en/installation.md                   |  5 --
 assets/js/app.js                               |  4 ++
 11 files changed, 86 insertions(+), 65 deletions(-)

diff --git a/Gemfile b/Gemfile
index 7d5ad32..47c4a1b 100755
--- a/Gemfile
+++ b/Gemfile
@@ -8,4 +8,5 @@ group :jekyll_plugins do
     gem "jekyll-paginate"
     gem "jekyll-seo-tag"
     gem "jekyll-polyglot"
+    gem 'jekyll-redirect-from'
 end
diff --git a/_config.yml b/_config.yml
index 1d842bc..90ae1a8 100755
--- a/_config.yml
+++ b/_config.yml
@@ -18,6 +18,7 @@ plugins:
   - jekyll-feed
   - jekyll-seo-tag
   - jekyll-polyglot
+  - jekyll-redirect-from
   - kramdown
   - rouge
 
@@ -83,5 +84,10 @@ sass:
   sourcemap: never
   style: compressed
 
+latest_pegasus_version: 2.1.0
+pegasus_versions:
+- 2.1.0
+- 1.x
+
 pegasus_github_url: "https://github.com/apache/incubator-pegasus"
 pegasus_website_github_url: "https://github.com/apache/incubator-pegasus-website"
diff --git a/_data/docs_menu.yml b/_data/docs_menu.yml
index 7d2422d..cb649f0 100644
--- a/_data/docs_menu.yml
+++ b/_data/docs_menu.yml
@@ -1,3 +1,7 @@
+- name: title_docs
+  items:
+    - name: title_installation
+      link: /docs/installation
 - name: title_clients
   items:
     - name: title_java-client
diff --git a/_data/overview_menu.yml b/_data/overview_menu.yml
index 7d7d666..44021b4 100644
--- a/_data/overview_menu.yml
+++ b/_data/overview_menu.yml
@@ -10,7 +10,7 @@
     - name: title_benchmark
       link: /overview/benchmark
     - name: title_installation
-      link: /overview/installation
+      link: /docs/installation
     - name: title_onebox
       link: /overview/onebox
     - name: title_shell
diff --git a/_docs/en/installation.md b/_docs/en/installation.md
new file mode 100755
index 0000000..3c58337
--- /dev/null
+++ b/_docs/en/installation.md
@@ -0,0 +1,5 @@
+---
+permalink: docs/installation/
+---
+
+TRANSLATING
diff --git a/_overview/zh/installation.md b/_docs/zh/1.x/installation.md
similarity index 99%
copy from _overview/zh/installation.md
copy to _docs/zh/1.x/installation.md
index 41c12e1..e312bfd 100755
--- a/_overview/zh/installation.md
+++ b/_docs/zh/1.x/installation.md
@@ -1,5 +1,6 @@
 ---
-permalink: /overview/installation/
+permalink: 1.x/docs/installation/
+version: 1.x
 ---
 
 Pegasus目前只支持Linux平台。目前在CentOS、Ubuntu上都测试运行过。
diff --git a/_overview/zh/installation.md b/_docs/zh/installation.md
similarity index 61%
rename from _overview/zh/installation.md
rename to _docs/zh/installation.md
index 41c12e1..85b09fb 100755
--- a/_overview/zh/installation.md
+++ b/_docs/zh/installation.md
@@ -1,17 +1,14 @@
 ---
-permalink: /overview/installation/
+permalink: docs/installation/
+redirect_from:
+  - overview/installation/
+  - 2.1.0/docs/installation/
+version: 2.1.0
 ---
 
 Pegasus目前只支持Linux平台。目前在CentOS、Ubuntu上都测试运行过。
 
-编译过程中遇到问题,请先参考下面的**常见问题**,如果还不能解决,可以通过[Github Issues](https://github.com/XiaoMi/pegasus/issues)向我们咨询。
-
-## 用docker编译
-
-如果你的机器支持运行docker,推荐使用我们提供的dockerfile进行编译:
-
-* centos: [请点击此处](https://github.com/XiaoMi/pegasus/blob/master/docker/dev/centos7/Dockerfile)
-* Ubuntu: 敬请期待
+编译过程中遇到问题,请先参考下面的**常见问题**,如果还不能解决,可以通过[Github Issues]({{ site.pegasus_github_url }}/issues)向我们咨询。
 
 ## 安装依赖
 
@@ -19,21 +16,19 @@ Pegasus编译依赖以下软件:
 
 * 编译器:GCC-5以上版本,要求支持C++14
 * CMake:3.5.2及以上版本
-* Boost:1.58及以上版本
-* openssl: 1.10以下版本(pegasus 1.10及以下版本有该限制,以上版本无限制)
-* 其他库:libaio、snappy、zstd、lz4、gflags、zlib
+* 其他库:libaio、snappy、zstd、lz4、zlib
 
 如果是Ubuntu,可以使用apt-get安装依赖库:
 
 ```bash
-sudo apt-get install build-essential cmake libboost-all-dev libaio-dev libsnappy-dev libzstd-dev liblz4-dev libgflags-dev zlib1g zlib1g.dev patch git curl zip automake libtool libssl-dev bison flex
+sudo apt-get install build-essential cmake libaio-dev libsnappy-dev libzstd-dev liblz4-dev zlib1g zlib1g.dev patch git curl zip automake libtool libssl-dev bison flex
 ```
 
-如果是CentOS,可以使用yum安装依赖库(不含gflags):
+如果是CentOS,可以使用yum安装依赖库:
 
 ```bash
 yum -y groupinstall "Development Tools"
-yum -y install cmake boost-devel libaio-devel snappy-devel zstd-devel lz4-devel gflags-devel zlib zlib-devel patch openssl-devel bison flex
+yum -y install cmake libaio-devel snappy-devel zstd-devel lz4-devel zlib zlib-devel patch openssl-devel bison flex
 ```
 
 如果你的系统没有提供zstd的软件源,你可以尝试手动安装,这里提供一个安装脚本:
@@ -48,23 +43,24 @@ cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib -DZSTD_BUILD_PROGRA
 sudo make install -j8
 ```
 
-## 源码编译
+## 源码获取
 
-从github获取Pegasus源代码,并递归获取其依赖的[rDSN](https://github.com/xiaomi/rdsn)和[Rocksdb](https://github.com/XiaoMi/pegasus-rocksdb):
+我们推荐下载遵循[ASF Release Policy](http://www.apache.org/legal/release-policy.html)发布的源码包。
+下载地址:
 
-```bash
-git clone https://github.com/xiaomi/pegasus.git --recursive
-cd pegasus
-```
+<https://dist.apache.org/repos/dist/release/incubator/pegasus/{{ page.version }}/apache-pegasus-{{ page.version }}-source-release.zip>
 
-如果要编译发布的稳定版本,请checkout至相应的tag(建议用[最新的release版本](https://github.com/xiaomi/pegasus/releases)),譬如:
+
+你也可以通过git clone的方式获取Pegasus源码:
 
 ```bash
-git checkout -b v1.11.4 v1.11.4
+git clone {{ site.pegasus_github_url }}.git --recursive
+cd pegasus
+git checkout -b v{{ page.version }} v{{ page.version }}
 git submodule update
 ```
 
-运行build命令进行编译:
+## 源码编译
 
 ```bash
 ./run.sh build -c
@@ -72,19 +68,21 @@ git submodule update
 
 编译后输出会放在当前目录的`DSN_ROOT/`文件夹下,里面包含bin、include、lib目录。
 
-可以用pack_server命令打包server端程序包,用于服务部署:
+## 编译打包
+
+打包server端程序包,用于服务部署:
 
 ```bash
 ./run.sh pack_server
 ```
 
-可以用pack_client命令打包client端库,用于C/C++端客户端开发:
+打包client端库,用于C/C++端客户端开发:
 
 ```bash
 ./run.sh pack_client
 ```
 
-可以用pack_tools命令打包tools包,里面包含了各种工具(shell、bench):
+打包tools工具集,里面包含了各种工具(shell、bench):
 
 ```bash
 ./run.sh pack_tools
@@ -117,20 +115,6 @@ git submodule update
 
 如果还不能解决,可以咨询我们。
 
-### 使用非系统自带的boost库
-
-编译默认使用系统自带的boost库,但是如果系统自带的库版本太低且无法升级,可以自己下载和编译高版本的boost库,然后通过```-b```参数传进来:
-
-```bash
-./run.sh build -b /your/boost/installation/path
-```
-
-譬如:
-
-```bash
-./run.sh build -b /home/work/software/boost_1_58_0/output
-```
-
 ### 使用toolchain编译
 
 如果系统自带的编译器版本太低且难以升级(不支持C++14),可以自己下载和编译高版本的gcc工具链,然后放到PATH中:
@@ -164,15 +148,3 @@ export PATH="$TOOLCHAIN_DIR/bin:$PATH"
 ```
 ./run.sh pack_server -g
 ```
-
-如果你用了自己的boost,就在pack的时候加上`-b`选项,譬如:
-
-```
-./run.sh pack_server -b
-```
-
-如果都用了,就同时加上`-b`和`-g`选项,譬如:
-
-```
-./run.sh pack_server -b -g
-```
diff --git a/_includes/version-select.html b/_includes/version-select.html
new file mode 100644
index 0000000..0d60ea7
--- /dev/null
+++ b/_includes/version-select.html
@@ -0,0 +1,34 @@
+{% if page.version %}
+<div class="dropdown pt-3 has-text-left">
+    <div class="dropdown-trigger">
+        <button class="button" aria-haspopup="true" aria-controls="dropdown-menu3">
+            <span>{{ page.version }}</span>
+            <span class="icon is-small">
+                <i class="fas fa-angle-down" aria-hidden="true"></i>
+            </span>
+        </button>
+    </div>
+    <div class="dropdown-menu">
+        <div class="dropdown-content">
+            {% for ver in site.pegasus_versions %}
+
+            <!--URL of our latest verion always starts without version prefixed.-->
+            {% assign version_prefix = '/' | append: page.version %}
+            {% assign no_version_link = page.permalink | remove_first: version_prefix %}
+            {% if ver == site.latest_pegasus_version %}
+            {% assign version_url = no_version_link %}
+            {% else %}
+            {% assign version_url = '/' | append: ver | append: no_version_link %}
+            {% endif %}
+
+            <a href="{{ version_url }}" class="dropdown-item {% if ver == page.version %}is-active{% endif %}">
+                {{ ver }}
+                {% if ver == site.latest_pegasus_version %}
+                <b> (latest)</b>
+                {% endif %}
+            </a>
+            {% endfor %}
+        </div>
+    </div>
+</div>
+{% endif %}
\ No newline at end of file
diff --git a/_layouts/docs.html b/_layouts/docs.html
index 4bbd9cb..5475fbf 100644
--- a/_layouts/docs.html
+++ b/_layouts/docs.html
@@ -5,15 +5,14 @@
 <body>
     <div class="dashboard is-full-height">
         <!-- left panel -->
-        <div class="dashboard-panel is-medium is-hidden-mobile">
-            <div class="dashboard-panel-header has-text-left">
+        <div class="dashboard-panel is-medium is-hidden-mobile pl-0">
+            <div class="dashboard-panel-header has-text-centered">
                 <a href="{{ site.baseurl }}/">
                     <img src="{{ site.baseurl }}/assets/images/pegasus-logo-inv.png" style="width: 80%;">
                 </a>
-                <a class="dropdown">
-                </a>
+                {% include version-select.html %}
             </div>
-            <div class="dashboard-panel-main is-scrollable">
+            <div class="dashboard-panel-main is-scrollable pl-6">
                 {% include menubar.html %}
             </div>
         </div>
diff --git a/_overview/en/installation.md b/_overview/en/installation.md
deleted file mode 100755
index 4e093dd..0000000
--- a/_overview/en/installation.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-permalink: /overview/installation/
----
-
-TRANSLATING
diff --git a/assets/js/app.js b/assets/js/app.js
index 1b262e8..f202900 100644
--- a/assets/js/app.js
+++ b/assets/js/app.js
@@ -39,3 +39,7 @@ $('.modal-background, .modal-close').click(function () {
 document.addEventListener('DOMContentLoaded', () => {
   $("table").wrap("<div class=\"table-container\"></div>")
 })
+
+$('.dropdown').click(function () {
+  $('.dropdown').toggleClass("is-active")
+});


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pegasus.apache.org
For additional commands, e-mail: commits-help@pegasus.apache.org