From eaefc188405e8c943b192c8e4c77a816989e8670 Mon Sep 17 00:00:00 2001 From: Nelson-He Date: Tue, 22 Nov 2022 11:49:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E4=BA=8E3.1.0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=92=8Cmaster=E5=88=86=E6=94=AF=E4=BB=A3=E7=A0=81=E5=88=B6?= =?UTF-8?q?=E4=BD=9C=E8=B7=A8=E5=B9=B3=E5=8F=B0=E5=AE=B9=E5=99=A8=E9=95=9C?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 26 -------------------- docker/Dockerfile | 58 ++++++++++++++++++++++++++++++++++++++++++++ docker/bashrc | 13 ++++++++++ docker/entrypoint.sh | 24 ++++++++++++++++++ entrypoint.sh | 18 -------------- 5 files changed, 95 insertions(+), 44 deletions(-) delete mode 100644 Dockerfile create mode 100644 docker/Dockerfile create mode 100644 docker/bashrc create mode 100644 docker/entrypoint.sh delete mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 865c6a5..0000000 --- a/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM openeuler/openeuler:22.03-lts -LABEL maintainer="Nelson-He " -ENV OPENGAUSS_WEBCLIENT_VERSION 1.0.4 - -RUN \ - yum -y update && \ - yum -y install sudo util-linux lsof wget unzip && \ - yum -y install opengauss && \ - su - opengauss -c "gsql -d postgres -U opengauss -p 7654 -c 'alter user opengauss password \"opengauss_2022\"'" && \ - su - opengauss -c "gs_ctl stop -D /var/lib/opengauss/data -mf " && \ - cd /tmp && \ - wget -q https://gitee.com/opengauss/openGauss-webclient/releases/download/v$OPENGAUSS_WEBCLIENT_VERSION-master/openGauss-webclient_linux_amd64.zip && \ - unzip openGauss-webclient_linux_amd64.zip -d /usr/bin && \ - mv /usr/bin/openGauss-webclient_linux_amd64 /usr/bin/openGauss_webclient && \ - chmod 755 /usr/bin/openGauss_webclient && \ - rm -f openGauss-webclient_linux_amd64.zip && \ - yum clean all - -COPY --chown=opengauss:opengauss ./entrypoint.sh /var/lib/opengauss/entrypoint.sh -USER opengauss:opengauss - -ENTRYPOINT ["/bin/bash", "/var/lib/opengauss/entrypoint.sh"] - -EXPOSE 8081 - -CMD ["openGauss_webclient"] diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..855aaaa --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,58 @@ +FROM openeuler/openeuler:22.03-lts +MAINTAINER openGauss-ml@openguass.org +LABEL MAIL="heguofeng@huawei.com" \ + CREATE_DATE="2022-10" \ + GAUSS_SERVER="openGauss-3.1.0" + +RUN \ + sed -i "s/gpgcheck=1/gpgcheck=0/g" /etc/yum.repos.d/openEuler.repo && \ + sed -i "s#http://repo.openeuler.org#https://mirrors.huaweicloud.com/openeuler#g" /etc/yum.repos.d/openEuler.repo && \ + yum install -y -q net-tools wget sudo shadow vim bc util-linux git && \ + useradd opengauss && \ + sed -i "101i opengauss ALL=(ALL) NOPASSWD:ALL" /etc/sudoers && \ + sed -i "s/TMOUT=300/TMOUT=0/g" /etc/bashrc && \ + cp -rf /usr/share/zoneinfo/Asia/Beijing /etc/localtime && \ + yum install -y python -q tzdata cmake libaio-devel ncurses-devel pam-devel libffi-devel libtool \ + libtool-ltdl openssl-devel bison flex glibc-devel patch unzip openeuler-lsb make automake xz && \ + yum clean all + +WORKDIR /home/opengauss +COPY --chown=opengauss:opengauss . /home/opengauss + +USER opengauss:opengauss + +RUN cp -f /home/opengauss/bashrc /home/opengauss/.bashrc && \ + cd /home/opengauss && \ + if [ "`uname -m`" == "x86_64" ]; then \ + wget -q https://golang.google.cn/dl/go1.18.8.linux-amd64.tar.gz && sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.18.8.linux-amd64.tar.gz && rm -rf go1.18.8.linux-amd64.tar.gz && \ + wget -q https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.1.0/binarylibs/openGauss-third_party_binarylibs_openEuler_x86_64.tar.gz -O openGauss_third.tar.gz; \ + else \ + wget -q https://golang.google.cn/dl/go1.18.8.linux-arm64.tar.gz && sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.18.8.linux-arm64.tar.gz && rm -rf go1.18.8.linux-arm64.tar.gz && \ + wget -q https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.1.0/binarylibs/openGauss-third_party_binarylibs_openEuler_arm.tar.gz -O openGauss_third.tar.gz; \ + fi && \ + tar -xf openGauss_third.tar.gz && mv openGauss-third_party_binarylibs* binarylibs && rm -f openGauss_third.tar.gz && \ + source /home/opengauss/.bashrc && git clone https://gitee.com/Nelson-He/openGauss-server.git && cd openGauss-server && \ + ./configure --gcc-version=7.3.0 CC=g++ CFLAGS='-O2' \ + --prefix=$GAUSSHOME --3rd=$BINARYLIBS \ + --enable-cassert --enable-thread-safety \ + --without-readline --without-zlib && \ + make -sj 8 && make install -sj 8 && \ + cd /home/opengauss && wget -q https://gitee.com/opengauss/openGauss-webclient/repository/archive/master.zip && \ + go env -w GO111MODULE=on && go env -w GOPROXY=https://goproxy.cn && \ + unzip -q master.zip && cd openGauss-webclient-master && make release && \ + sudo cp -rf ./bin/openGauss-webclient_linux_amd64 /usr/bin/openGauss_webclient; \ + cd /home/opengauss && \ + chmod +x /home/opengauss/entrypoint.sh && \ + sudo chmod 755 /usr/bin/openGauss_webclient && \ + sudo rm -rf /home/opengauss/binarylibs && \ + sudo rm -rf /home/opengauss/openGauss-server && \ + sudo rm -rf /home/opengauss/master.zip && \ + sudo rm -rf /home/opengauss/openGauss-webclient-master && \ + sudo yum remove -y make cmake git && \ + sudo yum clean all + +ENTRYPOINT ["/bin/bash", "/home/opengauss/entrypoint.sh"] + +EXPOSE 8081 + +CMD ["openGauss_webclient"] diff --git a/docker/bashrc b/docker/bashrc new file mode 100644 index 0000000..26c5f8a --- /dev/null +++ b/docker/bashrc @@ -0,0 +1,13 @@ +# Source default setting +[ -f /etc/bashrc ] && . /etc/bashrc + +# User environment PATH +PATH="$HOME/.local/bin:$HOME/bin:$PATH" +export GAUSSHOME="/home/opengauss/openGauss/install" +export BINARYLIBS="/home/opengauss/binarylibs" +export GCC_PATH="$BINARYLIBS/buildtools/gcc7.3/" +export CC="$GCC_PATH/gcc/bin/gcc" +export CXX="$GCC_PATH/gcc/bin/g++" +export LD_LIBRARY_PATH="$GAUSSHOME/lib:$GCC_PATH/gcc/lib64:$GCC_PATH/isl/lib:$GCC_PATH/mpc/lib/:$GCC_PATH/mpfr/lib/:$GCC_PATH/gmp/lib/:$LD_LIBRARY_PATH" +export PATH="/usr/local/go/bin:$GAUSSHOME/bin:$GCC_PATH/gcc/bin:$PATH" +export PGPORT=5433 diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 0000000..adb2c5c --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Exit on error, real CI +set -e + +echo "Initing openGauss..." + +source /home/opengauss/.bashrc + +source ~/.bashrc && gs_initdb -D /home/opengauss/openGauss/data/ -w "openGauss2022" -E utf8 --nodename=datanode +sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" /home/opengauss/openGauss/data/postgresql.conf +sed -i "s/#port = 5432/port = 5433/g" /home/opengauss/openGauss/data/postgresql.conf && \ + +echo "Starting openGauss..." +gs_ctl start -D /home/opengauss/openGauss/data -Z single_node + +echo "Connecting to openGauss..." +while ! gsql -U opengauss -W openGauss2022 -h 127.0.0.1 -p 5433 -d postgres -c 'SELECT 1' > /dev/null; do + echo "waiting openGauss start..." + sleep 1 +done + +openGauss_webclient --bind=0.0.0.0 --listen=8081 --url "opengauss://opengauss:openGauss2022@0.0.0.0:5433/postgres?sslmode=disable" + diff --git a/entrypoint.sh b/entrypoint.sh deleted file mode 100644 index d347cb6..0000000 --- a/entrypoint.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# Exit on error, real CI -set -e - -source /var/lib/opengauss/.bash_profile - -echo "Starting openGauss..." - -gs_ctl start -D /var/lib/opengauss/data -Z single_node - -echo "Connecting to openGauss..." -while ! gsql -U opengauss -W opengauss_2022 -h 127.0.0.1 -p 7654 -d postgres -c 'SELECT 1' > /dev/null; do - echo "waiting openGauss start..." - sleep 1 -done - -openGauss_webclient --bind=0.0.0.0 --listen=8081 --url "opengauss://opengauss:opengauss_2022@0.0.0.0:7654/postgres?sslmode=disable" -- Gitee