diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..efcb1fe --- /dev/null +++ b/.travis.yml @@ -0,0 +1,57 @@ +compiler: +- g++ +os: +- linux +addons: + apt: + packages: + - g++-4.9 +env: + global: + - secure: "c9CezEJjUr+dCgL5dfGurLDzqB5WarCx5aK1MTPM5jjGRIr3BlyEAWsADPf3yRwfVf4zDTBgHTxt+MmyYyftN3OQvXXI247TFGJuHqq5DRaHJEb7/o/ePcjGHdc8jTA74SMiy40+FCRmLOWRnKk8WHl2rSBnCHx91t0s0PTS+tsQc8lIz0a5VufTQb2WnHo3uTIn/tvzPM+V5rxgRuueDe42nksq/pAYHjhwr9sENTbtOTu5bL+T5ATeSi7jMcGPt9ou2GtUZhSzUSttn3pto1t55HhsXIdwZ/vOQpTsxu3oozNDB3Phzd+YZDNc81Rl17J23cWDpMWaAAn/DvSZ3pk231NpXCFrJwSFugd067xWMItLENdDEnjC0oXlHom7lPC1Wo6II0b+IhSl7QmRczheNP2Xf/YtHmAFwf9vlsPCQebkaLrq9qqRq2z275QNS+i/aH1LOAWsP/4oQB9NyW4JSUCxyliCpBk4LCVDKc1dNj3Cep3/+pwvbXz+HSiD4qsWOMLekugz3BtNCbVPBrQ2XhOrZm2ZwKkXRP1IQQE+Bhmv6OWfmNg66iKn59poF0r/RtUoHf8qzdRlVYRrUc1/EUtR52PJz2kkR1YoIMYezW+8dmrpZRw/lm0qMPwZnv2KuaeCgIU4jvcd7tg6qLcUoqL3xKB5TeSFuaSMo+M=" + - secure: "Tv6d8MSq11A8PFdJrxOKJrsMxsQO2OTip03p+NUdokj44cIxpjKwpujaod0ap/VgHRslKkGTV1dKpcnHPL/LwEQmsmreNWThb0dSSHAFrCoMhTTU4W6CAko46NjsYzHkZvvSZcXTCoBpwpG8/nLCUVUqzDDa6Z2EAcB8UEy6bwgbT4TW9SEhnuYp1y0dcZ90Zfgl2uQ4ZHyiLY0ZlxTWpKYHy8OmPuIDEQ6eBIkxjSDgU/shtoUtt0vkVuZFFVxrDTlKk2H5btv6vqa75iMDZpDDwW8we1I54Jmgcb6qNETW/XRI2QZ4H0C+41nhGXBLOlSoX1p4XTXFFsoqUdFuUm0RFC6jJlqnGwG1S3pLQY+fZiCKDaU5526cFpANAoYYGhm/Pn2e9IxpKgFP8I5sRFYEb6IvBgtoi7V48cPCqsrVFzTgNwWHB5+hOPtqURsInYgHallAO6VvixFMRWnSI+ItiUtBjOiAxD1zF+1xWQ84nZxRTnNJZhCipPDd0z0AoFS+HQFQuHX7VJdlTYv/PJLXwOv6jlxf1MQDfhbxT+5cV0oMPDc8aEIvokt617U7Unvow6xJFhqDCev8nTnKjZo73n3kEJUdFKans9gg7Kb4n2rtzTJa7sBaMLgUyULAuEFryUvqZ/OsxFJHhytC7aKUcf/tD6qh0MwnHEwi66U=" + - ISEARCH_EVAL="CC=gcc-4.9 && CXX=g++-4.9" + +before_install: +- eval "${ISEARCH_EVAL}" + +install: +- sudo apt-get install snappy libsnappy-dev zlib1g zlib1g-dev bzip2 liblz4-dev libasan0 openssl libmxml-dev jq +- sudo apt update +- sudo apt install gcc-4.8 +- sudo apt install g++-4.8 +- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20 +- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20 + +script: +- cd ../ +- git clone https://github.com/gflags/gflags.git +- cd gflags +- git checkout -b 2.2 v2.2.2 +- cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON -DGFLAGS_NAMESPACE=google -G "Unix Makefiles" . +- make +- cd ../isearch +- sudo ln -s /home/travis/build/jdisearch/gflags/lib/libgflags.so.2.2.2 /lib64/libgflags.so.2.2 +- sh build.sh + +after_success: +- cp src/search_agent/bin/search_agent dockerfiles/agent/ +- cp resource/search_agent/conf/sa.conf dockerfiles/agent/ +- cp src/search_agent/bin/search_agent dockerfiles/search_local +- cp -r resource dockerfiles/search_local +- cp src/3rdlib/rocksdb/lib/librocksdb.so dockerfiles/search_local +- cp /home/travis/build/jdisearch/gflags/lib/libgflags.so.2.2.2 dockerfiles/search_local +- cp src/search_local/index_storage/cache/dtcd dockerfiles/search_local +- cp src/search_local/index_storage/rocksdb_helper/rocksdb_helper dockerfiles/search_local +- cp src/search_local/index_storage/api/c_api_cc/libdtc-gcc-4.8-r4646582.so dockerfiles/search_local +- cp src/search_local/index_write/bin/index_write dockerfiles/search_local +- cp src/search_local/index_read/bin/index_read dockerfiles/search_local + +- cd dockerfiles/agent +- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin +- docker build -t $DOCKER_USERNAME/search_agent:latest . +- docker push $DOCKER_USERNAME/search_agent:latest + +- cd ../search_local +- docker build -t $DOCKER_USERNAME/search_local:latest . +- docker push $DOCKER_USERNAME/search_local:latest \ No newline at end of file diff --git a/dockerfiles/agent/Dockerfile b/dockerfiles/agent/Dockerfile new file mode 100644 index 0000000..d3033aa --- /dev/null +++ b/dockerfiles/agent/Dockerfile @@ -0,0 +1,13 @@ +FROM centos:centos7.2.1511 + +ARG basepath=/usr/local/isearch/search_agent + +RUN mkdir -p $basepath/bin +RUN mkdir -p $basepath/conf +RUN mkdir -p $basepath/log + +COPY search_agent $basepath/bin/search_agent +COPY sa.conf $basepath/conf/sa.conf +COPY start.sh /root/start.sh + +CMD ["/bin/bash", "/root/start.sh"] \ No newline at end of file diff --git a/dockerfiles/agent/start.sh b/dockerfiles/agent/start.sh new file mode 100644 index 0000000..8c9efdc --- /dev/null +++ b/dockerfiles/agent/start.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e + +#初始化 +INIT(){ + cd /usr/local/isearch/search_agent/bin + ./search_agent -d -c ../conf/sa.conf -v 3 +} + +#守护脚本 +PROCESS_DAEMON(){ + while : + do + sleep 5 + done +} + +/usr/sbin/sshd -D & +INIT +PROCESS_DAEMON \ No newline at end of file diff --git a/dockerfiles/search_local/Dockerfile b/dockerfiles/search_local/Dockerfile new file mode 100644 index 0000000..e5ae888 --- /dev/null +++ b/dockerfiles/search_local/Dockerfile @@ -0,0 +1,56 @@ +FROM centos:centos7.2.1511 + +RUN yum -y update +RUN yum install -y epel-release +RUN yum install -y snappy-devel jq +ARG invertpath=/usr/local/isearch/index_storage/inverted_index +RUN mkdir -p $invertpath +RUN mkdir $invertpath/conf $invertpath/bin $invertpath/rocksdb_data +COPY resource/index_storage/inverted_index/conf/cache.conf $invertpath/conf/ +COPY resource/index_storage/inverted_index/conf/table.conf $invertpath/conf/ +COPY resource/dtcd.sh $invertpath/bin/ +COPY dtcd $invertpath/bin/ +COPY rocksdb_helper $invertpath/bin/ + +ARG intellipath=/usr/local/isearch/index_storage/intelligent_index +RUN mkdir -p $intellipath +RUN mkdir $intellipath/conf $intellipath/bin $intellipath/rocksdb_data +COPY resource/index_storage/intelligent_index/conf/cache.conf $intellipath/conf/ +COPY resource/index_storage/intelligent_index/conf/table.conf $intellipath/conf/ +COPY resource/dtcd.sh $intellipath/bin/ +COPY dtcd $intellipath/bin/ +COPY rocksdb_helper $intellipath/bin/ + +ARG originalpath=/usr/local/isearch/index_storage/original_data +RUN mkdir -p $originalpath +RUN mkdir $originalpath/conf $originalpath/bin +COPY resource/index_storage/original_data/conf/cache.conf $originalpath/conf/ +COPY resource/index_storage/original_data/conf/table.conf $originalpath/conf/ +COPY resource/dtcd.sh $originalpath/bin/ +COPY dtcd $originalpath/bin/ + +COPY libdtc-gcc-4.8-r4646582.so /lib64/libdtc.so.1 +COPY librocksdb.so /lib64/librocksdb.so.6 +COPY libgflags.so.2.2.2 /lib64/libgflags.so.2.2 +ARG writepath=/usr/local/isearch/index_write +RUN mkdir -p $writepath && mkdir $writepath/conf $writepath/bin $writepath/log $writepath/stat +COPY resource/index_write/conf $writepath/conf/ +COPY resource $writepath/conf/ +COPY index_write $writepath/bin/ + +ARG readpath=/usr/local/isearch/index_read +RUN mkdir -p $readpath && mkdir $readpath/conf $readpath/bin $readpath/log $readpath/stat $readpath/data +COPY resource $readpath/conf/ +COPY resource/index_read/conf $readpath/conf/ +COPY resource/index_read/data $readpath/data/ +COPY index_read $readpath/bin/ + +ARG agentpath=/usr/local/isearch/search_agent +RUN mkdir -p $agentpath +RUN mkdir $agentpath/conf $agentpath/log $agentpath/log/bin +COPY search_agent $agentpath/bin/search_agent +COPY resource/search_agent/conf/sa.conf $agentpath/conf/sa.conf +COPY resource/tools /usr/local/isearch/tools +COPY start.sh /root/start.sh + +CMD ["/bin/bash", "/root/start.sh"] \ No newline at end of file diff --git a/dockerfiles/search_local/start.sh b/dockerfiles/search_local/start.sh new file mode 100644 index 0000000..72cfd67 --- /dev/null +++ b/dockerfiles/search_local/start.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -e + +#初始化 +INIT(){ + cd /usr/local/isearch/index_storage/inverted_index/bin + chmod +x dtcd.sh + ./dtcd.sh start + cd /usr/local/isearch/index_storage/intelligent_index/bin + chmod +x dtcd.sh + ./dtcd.sh start + cd /usr/local/isearch/index_storage/original_data/bin + chmod +x dtcd.sh + ./dtcd.sh start + cd /usr/local/isearch/index_write/bin + ./index_write + cd /usr/local/isearch/index_read/bin + ./index_read + cd /usr/local/isearch/search_agent/bin + ./search_agent -d -c ../conf/sa.conf -v 3 +} + +#守护脚本 +PROCESS_DAEMON(){ + while : + do + sleep 5 + done +} + +/usr/sbin/sshd -D & +INIT +PROCESS_DAEMON \ No newline at end of file