From 8361a9ec6210ad3fdc183caa3b33443eb1121c68 Mon Sep 17 00:00:00 2001 From: Fei Han Date: Mon, 23 Dec 2019 17:28:40 +0800 Subject: [PATCH 1/4] static compile for centos and ubuntu deploy --- release-centos7/Dockerfile-builder | 4 --- ...ile-tiflash => Dockerfile-tiflash-centos7} | 2 +- release-centos7/Dockerfile-tiflash-ubuntu | 15 +++++++++++ release-centos7/Makefile | 6 +++-- release-centos7/README.md | 25 +++++++++++++++++++ release-centos7/build/build-tiflash.sh | 6 ++--- 6 files changed, 47 insertions(+), 11 deletions(-) rename release-centos7/{Dockerfile-tiflash => Dockerfile-tiflash-centos7} (89%) create mode 100644 release-centos7/Dockerfile-tiflash-ubuntu create mode 100644 release-centos7/README.md diff --git a/release-centos7/Dockerfile-builder b/release-centos7/Dockerfile-builder index 3397c6897f9..8aa1c480964 100644 --- a/release-centos7/Dockerfile-builder +++ b/release-centos7/Dockerfile-builder @@ -15,10 +15,7 @@ RUN yum makecache \ debhelper \ libtool \ ncurses-static \ - readline-devel \ - unixODBC-devel \ openssl-devel \ - libicu-devel \ libtool-ltdl-devel \ python3-devel \ && curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain nightly \ @@ -33,7 +30,6 @@ RUN yum makecache \ setuptools \ && cd /prepare-environments \ && ./install-openssl.sh \ - && ./install-mysql-dev.sh \ && ./install-cmake.sh \ && ./install-gcc.sh \ && ./install-llvm.sh \ diff --git a/release-centos7/Dockerfile-tiflash b/release-centos7/Dockerfile-tiflash-centos7 similarity index 89% rename from release-centos7/Dockerfile-tiflash rename to release-centos7/Dockerfile-tiflash-centos7 index 7622136ee5a..4327092d411 100644 --- a/release-centos7/Dockerfile-tiflash +++ b/release-centos7/Dockerfile-tiflash-centos7 @@ -1,4 +1,4 @@ -FROM centos:centos7.7.1908 +FROM centos:centos7.6.1810 USER root WORKDIR /root/ diff --git a/release-centos7/Dockerfile-tiflash-ubuntu b/release-centos7/Dockerfile-tiflash-ubuntu new file mode 100644 index 00000000000..204135e644a --- /dev/null +++ b/release-centos7/Dockerfile-tiflash-ubuntu @@ -0,0 +1,15 @@ +FROM ubuntu:16.04 + +USER root +WORKDIR /root/ + +ENV HOME /root/ +ENV TZ Asia/Shanghai +ENV LD_LIBRARY_PATH /tiflash + +RUN apt update && apt install -y tzdata python && rm -rf /var/lib/apt/lists/* +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +COPY tiflash /tiflash + +ENTRYPOINT ["/tiflash/theflash", "server"] diff --git a/release-centos7/Makefile b/release-centos7/Makefile index d29991223fa..008fb996adc 100644 --- a/release-centos7/Makefile +++ b/release-centos7/Makefile @@ -8,7 +8,9 @@ push_image_builder: docker push hub.pingcap.net/tiflash/tiflash-builder image_tiflash: - docker build -f Dockerfile-tiflash -t hub.pingcap.net/tiflash/tiflash-server . + docker build -f Dockerfile-tiflash-centos7 -t hub.pingcap.net/tiflash/tiflash-server-centos7 . + docker build -f Dockerfile-tiflash-ubuntu -t hub.pingcap.net/tiflash/tiflash-server-ubuntu . push_image_tiflash: - docker push hub.pingcap.net/tiflash/tiflash-server + docker push hub.pingcap.net/tiflash/tiflash-server-centos7 + docker push hub.pingcap.net/tiflash/tiflash-server-ubuntu diff --git a/release-centos7/README.md b/release-centos7/README.md new file mode 100644 index 00000000000..e52ff4b84d4 --- /dev/null +++ b/release-centos7/README.md @@ -0,0 +1,25 @@ +# How to build + +```shell +#prepare build enviroment +make image_builer +``` + +```shell +#compile +make build_release +``` + +The executable files are located in `tiflash` dir. + +# Deploy Enviroument Requirements + +Following OS are tested OK + +* CentOS 7.6 or higher version +* Ubuntu 16.04 or higher version + +Your system needs to install + +* GLibC 2.27+ (musl LibC is not OK) +* Libgcc 4.8+ diff --git a/release-centos7/build/build-tiflash.sh b/release-centos7/build/build-tiflash.sh index 982a2f75663..bc20fd54045 100755 --- a/release-centos7/build/build-tiflash.sh +++ b/release-centos7/build/build-tiflash.sh @@ -36,13 +36,11 @@ rm -rf $build_dir && mkdir -p $build_dir && cd $build_dir cmake "$SRCPATH" \ -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \ -DENABLE_EMBEDDED_COMPILER=$ENABLE_EMBEDDED_COMPILER \ + -DENABLE_ICU=OFF \ + -DENABLE_MYSQL=OFF \ -Wno-dev make -j $NPROC cp -f "$build_dir/dbms/src/Server/theflash" "$install_dir/theflash" -ldd "$build_dir/dbms/src/Server/theflash" | grep '/' | grep '=>' | \ - awk -F '=>' '{print $2}' | awk '{print $1}' | while read lib; do - cp -f "$lib" "$install_dir" -done From af8f48608375fcc53856784432db3a95ffa6471a Mon Sep 17 00:00:00 2001 From: Fei Han Date: Mon, 23 Dec 2019 17:31:17 +0800 Subject: [PATCH 2/4] update readme --- release-centos7/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/release-centos7/README.md b/release-centos7/README.md index e52ff4b84d4..2c63e2e6656 100644 --- a/release-centos7/README.md +++ b/release-centos7/README.md @@ -19,6 +19,8 @@ Following OS are tested OK * CentOS 7.6 or higher version * Ubuntu 16.04 or higher version +**NOTE** CentOS 8 has newer `libnsl.so.2`. If we want to run on CentOS 8 , maybe we should copy old libnsl manually. + Your system needs to install * GLibC 2.27+ (musl LibC is not OK) From e3c209258f4ee6e5bd12f5976908dcecea252771 Mon Sep 17 00:00:00 2001 From: Fei Han Date: Mon, 23 Dec 2019 17:53:01 +0800 Subject: [PATCH 3/4] rm push command --- release-centos7/Makefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/release-centos7/Makefile b/release-centos7/Makefile index 008fb996adc..453aeee46d7 100644 --- a/release-centos7/Makefile +++ b/release-centos7/Makefile @@ -10,7 +10,3 @@ push_image_builder: image_tiflash: docker build -f Dockerfile-tiflash-centos7 -t hub.pingcap.net/tiflash/tiflash-server-centos7 . docker build -f Dockerfile-tiflash-ubuntu -t hub.pingcap.net/tiflash/tiflash-server-ubuntu . - -push_image_tiflash: - docker push hub.pingcap.net/tiflash/tiflash-server-centos7 - docker push hub.pingcap.net/tiflash/tiflash-server-ubuntu From 76b954f90c44343ca1a021ea01dcd89d964359dc Mon Sep 17 00:00:00 2001 From: Fei Han Date: Mon, 23 Dec 2019 17:55:11 +0800 Subject: [PATCH 4/4] adjust readme --- release-centos7/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release-centos7/README.md b/release-centos7/README.md index 2c63e2e6656..6e5ece0c653 100644 --- a/release-centos7/README.md +++ b/release-centos7/README.md @@ -16,8 +16,8 @@ The executable files are located in `tiflash` dir. Following OS are tested OK -* CentOS 7.6 or higher version -* Ubuntu 16.04 or higher version +* CentOS 7.6 +* Ubuntu 16.04 and 18.04 **NOTE** CentOS 8 has newer `libnsl.so.2`. If we want to run on CentOS 8 , maybe we should copy old libnsl manually.