Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLASH-777] static compile for centos and ubuntu deploy #363

Merged
merged 9 commits into from
Dec 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions release-centos7/Dockerfile-builder
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM centos:centos7.7.1908
FROM centos:centos7.6.1810

USER root
WORKDIR /root/
Expand Down
15 changes: 15 additions & 0 deletions release-centos7/Dockerfile-tiflash-ubuntu
Original file line number Diff line number Diff line change
@@ -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"]
6 changes: 2 additions & 4 deletions release-centos7/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ 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 .

push_image_tiflash:
docker push 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 .
27 changes: 27 additions & 0 deletions release-centos7/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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
* 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.

Your system needs to install

* GLibC 2.27+ (musl LibC is not OK)
* Libgcc 4.8+
6 changes: 2 additions & 4 deletions release-centos7/build/build-tiflash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,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 '=>' | \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not forget to copy tiflash proxy so to $install_dir

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ganranteed by build-tiproxy

awk -F '=>' '{print $2}' | awk '{print $1}' | while read lib; do
cp -f "$lib" "$install_dir"
done