From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 2A05F4696C6 for ; Mon, 13 Jan 2020 14:48:43 +0300 (MSK) From: "Alexander V. Tikhonov" Date: Mon, 13 Jan 2020 14:48:36 +0300 Message-Id: <49a92513986821cdcd2cb5086b5ed9282f55f0a8.1578916023.git.avtikhon@tarantool.org> In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH docker v1 2/5] Merge files in repository List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Turenko Cc: tarantool-patches@dev.tarantool.org Reorganized the repository files - removed duplicating. Changed file structure to: .gitlab-ci.yml .gitlab.mk ├── dockerfiles │ ├── _ │ ├── alpine_3.5_1.x │ ├── alpine_3.5_2.2 │ ├── alpine_3.5_2.x │ ├── centos_7_1.x │ └── centos_7_2.x ├── files │ ├── │ └── ... ├── README.md └── versions ├── ├── alpine_3.5_1.x ├── alpine_3.5_2.1 ├── alpine_3.5_2.2 ├── alpine_3.5_2.x ├── centos_7_1.x └── centos_7_2.x For now the 'versions/__' with use of common files: 'files/'. Gitlab-CI YML file has the environment variables setup for each build, which can be reproduced manually like: IMAGE=tarantool/tarantool TAG=2.1 OS=alpine_3.5 VER=2.1 DVER=2.2 \ PORT=3121 make -f .gitlab.mk build --- .gitlab-ci.yml | 56 +++- .gitlab.mk | 5 +- 1.5/Dockerfile | 105 ------- 1.5/docker-entrypoint.sh | 69 ----- 1.6/Dockerfile | 280 ----------------- 1.6/luarocks-config.lua | 9 - 1.6/tarantool-entrypoint.lua | 261 ---------------- 1.6/tarantool.default | 21 -- 1.6/tarantool_set_config.lua | 129 -------- 1.7/Dockerfile | 244 --------------- 1.7/console | 15 - 1.7/docker-entrypoint.sh | 22 -- 1.7/gperftools_alpine.diff | 110 ------- 1.7/luarocks-config.lua | 9 - 1.7/tarantool-entrypoint.lua | 292 ------------------ 1.7/tarantool_is_up | 41 --- 1.7/tarantool_set_config.lua | 130 -------- 1.9/Dockerfile | 244 --------------- 1.9/console | 15 - 1.9/docker-entrypoint.sh | 22 -- 1.9/gperftools_alpine.diff | 110 ------- 1.9/luarocks-config.lua | 9 - 1.9/tarantool-entrypoint.lua | 292 ------------------ 1.9/tarantool.default | 22 -- 1.9/tarantool_is_up | 41 --- 1.9/tarantool_set_config.lua | 130 -------- 1.x-centos7/.dockerignore | 0 1.x-centos7/console | 15 - 1.x-centos7/tarantool-entrypoint.lua | 292 ------------------ 1.x-centos7/tarantool.default | 22 -- 1.x-centos7/tarantool_is_up | 41 --- 1.x-centos7/tarantool_set_config.lua | 130 -------- 1.x/console | 15 - 1.x/docker-entrypoint.sh | 22 -- 1.x/gperftools_alpine.diff | 110 ------- 1.x/luarocks-config.lua | 9 - 1.x/tarantool-entrypoint.lua | 292 ------------------ 1.x/tarantool.default | 22 -- 1.x/tarantool_is_up | 41 --- 1.x/tarantool_set_config.lua | 130 -------- 2.1/Dockerfile | 246 --------------- 2.1/console | 15 - 2.1/docker-entrypoint.sh | 22 -- 2.1/gperftools_alpine.diff | 110 ------- 2.1/luarocks-config.lua | 9 - 2.1/tarantool-entrypoint.lua | 292 ------------------ 2.1/tarantool.default | 22 -- 2.1/tarantool_is_up | 41 --- 2.1/tarantool_set_config.lua | 130 -------- 2.2/console | 15 - 2.2/docker-entrypoint.sh | 22 -- 2.2/gperftools_alpine.diff | 110 ------- 2.2/luarocks-config.lua | 9 - 2.2/tarantool-entrypoint.lua | 292 ------------------ 2.2/tarantool.default | 22 -- 2.2/tarantool_is_up | 41 --- 2.2/tarantool_set_config.lua | 130 -------- 2.x-centos7/.dockerignore | 0 2.x-centos7/console | 15 - 2.x-centos7/docker-entrypoint.sh | 22 -- 2.x-centos7/mosquitto.repo | 7 - 2.x-centos7/tarantool.default | 22 -- 2.x-centos7/tarantool_is_up | 41 --- 2.x/console | 15 - 2.x/docker-entrypoint.sh | 22 -- 2.x/gperftools_alpine.diff | 110 ------- 2.x/tarantool-entrypoint.lua | 291 ----------------- 2.x/tarantool.default | 22 -- 2.x/tarantool_is_up | 41 --- 2.x/tarantool_set_config.lua | 130 -------- README.md | 24 +- 1.x/Dockerfile => dockerfiles/alpine_3.5_1.x | 22 +- 2.2/Dockerfile => dockerfiles/alpine_3.5_2.2 | 22 +- 2.x/Dockerfile => dockerfiles/alpine_3.5_2.x | 20 +- .../Dockerfile => dockerfiles/centos_7_1.x | 18 +- .../Dockerfile => dockerfiles/centos_7_2.x | 20 +- {1.6 => files}/console | 0 {1.6 => files}/docker-entrypoint.sh | 0 .../docker-entrypoint_centos.sh | 0 {1.6 => files}/gperftools_alpine.diff | 0 {1.5 => files}/luarocks-config.lua | 0 .../luarocks-config_centos.lua | 0 {1.x-centos7 => files}/mosquitto.repo | 0 .../tarantool-entrypoint.lua | 0 {1.7 => files}/tarantool.default | 0 {1.6 => files}/tarantool_is_up | 0 .../tarantool_set_config.lua | 0 versions/alpine_3.5_1.x | 1 + versions/alpine_3.5_2.1 | 1 + versions/alpine_3.5_2.2 | 1 + versions/alpine_3.5_2.x | 1 + versions/centos_7_1.x | 1 + versions/centos_7_2.x | 1 + 93 files changed, 120 insertions(+), 6102 deletions(-) delete mode 100644 1.5/Dockerfile delete mode 100755 1.5/docker-entrypoint.sh delete mode 100644 1.6/Dockerfile delete mode 100644 1.6/luarocks-config.lua delete mode 100755 1.6/tarantool-entrypoint.lua delete mode 100644 1.6/tarantool.default delete mode 100755 1.6/tarantool_set_config.lua delete mode 100644 1.7/Dockerfile delete mode 100755 1.7/console delete mode 100755 1.7/docker-entrypoint.sh delete mode 100644 1.7/gperftools_alpine.diff delete mode 100644 1.7/luarocks-config.lua delete mode 100755 1.7/tarantool-entrypoint.lua delete mode 100755 1.7/tarantool_is_up delete mode 100755 1.7/tarantool_set_config.lua delete mode 100644 1.9/Dockerfile delete mode 100755 1.9/console delete mode 100755 1.9/docker-entrypoint.sh delete mode 100644 1.9/gperftools_alpine.diff delete mode 100644 1.9/luarocks-config.lua delete mode 100755 1.9/tarantool-entrypoint.lua delete mode 100644 1.9/tarantool.default delete mode 100755 1.9/tarantool_is_up delete mode 100755 1.9/tarantool_set_config.lua delete mode 100644 1.x-centos7/.dockerignore delete mode 100755 1.x-centos7/console delete mode 100755 1.x-centos7/tarantool-entrypoint.lua delete mode 100644 1.x-centos7/tarantool.default delete mode 100755 1.x-centos7/tarantool_is_up delete mode 100755 1.x-centos7/tarantool_set_config.lua delete mode 100755 1.x/console delete mode 100755 1.x/docker-entrypoint.sh delete mode 100644 1.x/gperftools_alpine.diff delete mode 100644 1.x/luarocks-config.lua delete mode 100755 1.x/tarantool-entrypoint.lua delete mode 100644 1.x/tarantool.default delete mode 100755 1.x/tarantool_is_up delete mode 100755 1.x/tarantool_set_config.lua delete mode 100644 2.1/Dockerfile delete mode 100755 2.1/console delete mode 100755 2.1/docker-entrypoint.sh delete mode 100644 2.1/gperftools_alpine.diff delete mode 100644 2.1/luarocks-config.lua delete mode 100755 2.1/tarantool-entrypoint.lua delete mode 100644 2.1/tarantool.default delete mode 100755 2.1/tarantool_is_up delete mode 100755 2.1/tarantool_set_config.lua delete mode 100755 2.2/console delete mode 100755 2.2/docker-entrypoint.sh delete mode 100644 2.2/gperftools_alpine.diff delete mode 100644 2.2/luarocks-config.lua delete mode 100755 2.2/tarantool-entrypoint.lua delete mode 100644 2.2/tarantool.default delete mode 100755 2.2/tarantool_is_up delete mode 100755 2.2/tarantool_set_config.lua delete mode 100644 2.x-centos7/.dockerignore delete mode 100755 2.x-centos7/console delete mode 100755 2.x-centos7/docker-entrypoint.sh delete mode 100644 2.x-centos7/mosquitto.repo delete mode 100644 2.x-centos7/tarantool.default delete mode 100755 2.x-centos7/tarantool_is_up delete mode 100755 2.x/console delete mode 100755 2.x/docker-entrypoint.sh delete mode 100644 2.x/gperftools_alpine.diff delete mode 100755 2.x/tarantool-entrypoint.lua delete mode 100644 2.x/tarantool.default delete mode 100755 2.x/tarantool_is_up delete mode 100755 2.x/tarantool_set_config.lua rename 1.x/Dockerfile => dockerfiles/alpine_3.5_1.x (92%) rename 2.2/Dockerfile => dockerfiles/alpine_3.5_2.2 (92%) rename 2.x/Dockerfile => dockerfiles/alpine_3.5_2.x (92%) rename 1.x-centos7/Dockerfile => dockerfiles/centos_7_1.x (95%) rename 2.x-centos7/Dockerfile => dockerfiles/centos_7_2.x (94%) rename {1.6 => files}/console (100%) rename {1.6 => files}/docker-entrypoint.sh (100%) rename 1.x-centos7/docker-entrypoint.sh => files/docker-entrypoint_centos.sh (100%) rename {1.6 => files}/gperftools_alpine.diff (100%) rename {1.5 => files}/luarocks-config.lua (100%) rename 1.x-centos7/luarocks-config.lua => files/luarocks-config_centos.lua (100%) rename {1.x-centos7 => files}/mosquitto.repo (100%) rename {2.x-centos7 => files}/tarantool-entrypoint.lua (100%) rename {1.7 => files}/tarantool.default (100%) rename {1.6 => files}/tarantool_is_up (100%) rename {2.x-centos7 => files}/tarantool_set_config.lua (100%) create mode 100644 versions/alpine_3.5_1.x create mode 100644 versions/alpine_3.5_2.1 create mode 100644 versions/alpine_3.5_2.2 create mode 100644 versions/alpine_3.5_2.x create mode 100644 versions/centos_7_1.x create mode 100644 versions/centos_7_2.x diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 508e250..d704f3e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,7 @@ stages: variables: REGISTRY: registry.gitlab.com IMAGE: ${REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME} + CHECK_GIT: git diff origin/master --name-only before_script: # Enable GitLab registry @@ -13,35 +14,64 @@ before_script: stage: build script: - > - if git diff origin/master --name-only | grep "^${DIR}/" ; then + if ${CHECK_GIT} | grep "^versions/${OS}_${VER}$" || \ + ${CHECK_GIT} | grep "^dockerfiles/${OS}_${DVER}$" || \ + ${CHECK_GIT} | grep "^files/" + then make -f .gitlab.mk build fi; -'1.x': +'alpine 3.5 1.x': <<: *build_definition variables: + OS: 'alpine_3.5' TAG: '1' - DIR: '1.x' - PORT: 3301 + VER: '1.x' + DVER: '1.x' + PORT: 3110 -'2.x': +'alpine 3.5 2.x': <<: *build_definition variables: + OS: 'alpine_3.5' TAG: '2' - DIR: '2.x' - PORT: 3302 + VER: '2.x' + DVER: '2.x' + PORT: 3120 -'2.1': +'alpine 3.5 2.1': <<: *build_definition variables: + OS: 'alpine_3.5' TAG: '2.1' - DIR: '2.1' - PORT: 3321 + VER: '2.1' + DVER: '2.2' + PORT: 3121 -'2.2': +'alpine 3.5 2.2': <<: *build_definition variables: + OS: 'alpine_3.5' TAG: '2.2' - DIR: '2.2' - PORT: 3322 + VER: '2.2' + DVER: '2.2' + PORT: 3122 + +'centos 7 1.x': + <<: *build_definition + variables: + OS: 'centos_7' + TAG: '1.x-centos7' + VER: '1.x' + DVER: '1.x' + PORT: 3210 + +'centos 7 2.x': + <<: *build_definition + variables: + OS: 'centos_7' + TAG: '2.x-centos7' + VER: '2.x' + DVER: '2.x' + PORT: 3220 diff --git a/.gitlab.mk b/.gitlab.mk index 5589177..59f53c9 100644 --- a/.gitlab.mk +++ b/.gitlab.mk @@ -1,5 +1,8 @@ +TNT_VER=$(shell cat versions/${OS}_${VER}) + build: - docker build --network=host -t ${IMAGE}:${TAG} ${DIR}/ + docker build --network=host --build-arg TNT_VER=${TNT_VER} \ + -t ${IMAGE}:${TAG} -f dockerfiles/${OS}_${DVER} . docker run --rm --name tarantool_${TAG} -p ${PORT}:${PORT} -d ${IMAGE}:${TAG} docker exec -t tarantool_${TAG} tarantool_is_up docker stop tarantool_${TAG} diff --git a/1.5/Dockerfile b/1.5/Dockerfile deleted file mode 100644 index 753af94..0000000 --- a/1.5/Dockerfile +++ /dev/null @@ -1,105 +0,0 @@ -FROM alpine:3.4 -MAINTAINER mail@racktear.com - -RUN addgroup -S tarantool \ - && adduser -S -G tarantool tarantool \ - && apk add --no-cache 'su-exec>=0.2' - -ENV TARANTOOL_VERSION=1.5.5.27 \ - TARANTOOL_DOWNLOAD_URL=https://github.com/tarantool/tarantool.git \ - TARANTOOL_COMMIT=1687c022e7aa93e9c118e1b80e1eac6c429b1010 \ - TARANTOOL_INSTALL_LUADIR=/usr/local/share/tarantool \ - LUAROCKS_URL=http://keplerproject.github.io/luarocks/releases/luarocks-2.3.0.tar.gz \ - TARANTOOL_SNAP_DIR=/var/lib/tarantool \ - TARANTOOL_WAL_DIR=/var/lib/tarantool \ - TARANTOOL_PORT=3301 \ - TARANTOOL_ADMIN_PORT=3302 - -RUN set -x \ - && apk add --no-cache --virtual .run-deps \ - libstdc++ \ - readline \ - openssl \ - yaml \ - lz4 \ - binutils \ - ncurses \ - libgomp \ - lua \ - curl \ - tar \ - zip \ - mariadb-client-libs \ - libpq \ - mariadb-libs \ - && apk add --no-cache --virtual .build-deps \ - perl \ - gcc \ - g++ \ - cmake \ - readline-dev \ - openssl-dev \ - yaml-dev \ - lz4-dev \ - binutils-dev \ - ncurses-dev \ - lua-dev \ - musl-dev \ - make \ - git \ - postgresql-dev \ - lua-dev \ - mariadb-dev \ - wget \ - && : "---------- tarantool ----------" \ - && mkdir -p /usr/src/tarantool \ - && git clone "$TARANTOOL_DOWNLOAD_URL" /usr/src/tarantool \ - && git -C /usr/src/tarantool checkout "$TARANTOOL_COMMIT" \ - && git -C /usr/src/tarantool submodule init \ - && git -C /usr/src/tarantool submodule update \ - && echo "$TARANTOOL_VERSION" > /usr/src/tarantool/VERSION \ - && (cd /usr/src/tarantool; \ - cmake -DENABLE_CLIENT:BOOL=ON \ - -DWITH_MYSQL:BOOL=ON \ - -DWITH_POSTGRESQL:BOOL=ON \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DENABLE_BUNDLED_LIBYAML:BOOL=OFF \ - -DENABLE_BACKTRACE:BOOL=ON \ - .) \ - && make -C /usr/src/tarantool -j \ - && make -C /usr/src/tarantool install \ - && make -C /usr/src/tarantool clean \ - && : "---------- luarocks ----------" \ - && wget -O luarocks.tar.gz "$LUAROCKS_URL" \ - && mkdir -p /usr/src/luarocks \ - && tar -xzf luarocks.tar.gz -C /usr/src/luarocks --strip-components=1 \ - && (cd /usr/src/luarocks; \ - ./configure; \ - make build; \ - make install) \ - && rm -r /usr/src/luarocks \ - && rm -rf /usr/src/tarantool \ - && : "---------- remove build deps ----------" \ - && apk del .build-deps - -COPY luarocks-config.lua /usr/local/etc/luarocks/config-5.1.lua - -RUN mkdir -p /var/lib/tarantool \ - && chown tarantool:tarantool /var/lib/tarantool \ - && mkdir -p /opt/tarantool \ - && chown tarantool:tarantool /opt/tarantool \ - && mkdir -p /var/run/tarantool \ - && chown tarantool:tarantool /var/run/tarantool \ - && mkdir /etc/tarantool \ - && chown tarantool:tarantool /etc/tarantool - -VOLUME /var/lib/tarantool -WORKDIR /opt/tarantool - -COPY docker-entrypoint.sh /usr/local/bin/ - -RUN ln -s /usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat -ENTRYPOINT ["docker-entrypoint.sh"] - -EXPOSE 3301 -CMD [ "tarantool_box", "-c", "/etc/tarantool/tarantool.cfg" ] diff --git a/1.5/docker-entrypoint.sh b/1.5/docker-entrypoint.sh deleted file mode 100755 index bcc6819..0000000 --- a/1.5/docker-entrypoint.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh - -update_cfg() -{ - variable=$1 - varname=$2 - value=$(printenv $varname) - CFG=/etc/tarantool/tarantool.cfg - - if printenv $varname > /dev/null - then - if grep "$variable=" $CFG - then - sed -i "s/$variable=.*/$variable=$value/g" $CFG - else - echo "$variable=$value" >> $CFG - fi - fi -} - -try_init_db() -{ - if [ "$(find /var/lib/tarantool -maxdepth 1 -name '*.snap' -print)" = "" ] - then - echo "Initializing config:" - - CFG=/etc/tarantool/tarantool.cfg - - if [ ! -f $CFG ] - then - echo "work_dir=/opt/tarantool" > $CFG - echo "memcached_port=11211" >> $CFG - echo "primary_port=3301" >> $CFG - echo "admin_port=3302" >> $CFG - echo "replication_port=3310" >> $CFG - echo "snap_dir=/var/lib/tarantool" >> $CFG - echo "wal_dir=/var/lib/tarantool" >> $CFG - fi - - update_cfg "replication_port" "TARANTOOL_REPLICATION_PORT" - update_cfg "replication_source" "TARANTOOL_REPLICATION_SOURCE" - update_cfg "slab_alloc_arena" "TARANTOOL_SLAB_ALLOC_ARENA" - update_cfg "slab_alloc_factor" "TARANTOOL_SLAB_ALLOC_FACTOR" - update_cfg "slab_alloc_minimal" "TARANTOOL_SLAB_ALLOC_MINIMAL" - update_cfg "primary_port" "TARANTOOL_PORT" - update_cfg "admin_port" "TARANTOOL_ADMIN_PORT" - update_cfg "wal_mode" "TARANTOOL_WAL_MODE" - update_cfg "snap_dir" "TARANTOOL_SNAP_DIR" - update_cfg "wal_dir" "TARANTOOL_WAL_DIR" - - cat $CFG - - echo - echo "Initializing database:" - - su-exec tarantool tarantool_box -c $CFG --init-storage - - echo - fi -} - -# entry point wraps the passed script to do basic setup -if [ "$1" = 'tarantool_box' ]; then - shift - try_init_db - exec su-exec tarantool tarantool_box "$@" -fi - -exec "$@" diff --git a/1.6/Dockerfile b/1.6/Dockerfile deleted file mode 100644 index ece5f04..0000000 --- a/1.6/Dockerfile +++ /dev/null @@ -1,280 +0,0 @@ -FROM alpine:3.5 -MAINTAINER mail@racktear.com - -RUN addgroup -S tarantool \ - && adduser -S -G tarantool tarantool \ - && apk add --no-cache 'su-exec>=0.2' - -ENV TARANTOOL_VERSION=1.6.9-11-gf4619d0 \ - TARANTOOL_DOWNLOAD_URL=https://github.com/tarantool/tarantool.git \ - TARANTOOL_INSTALL_LUADIR=/usr/local/share/tarantool \ - CURL_REPO=https://github.com/curl/curl.git \ - CURL_TAG=curl-7_59_0 \ - GPERFTOOLS_REPO=https://github.com/gperftools/gperftools.git \ - GPERFTOOLS_TAG=gperftools-2.5 \ - LUAROCKS_URL=http://keplerproject.github.io/luarocks/releases/luarocks-2.3.0.tar.gz \ - LUAROCK_AVRO_SCHEMA_REPO=https://github.com/tarantool/avro-schema.git \ - LUAROCK_AVRO_SCHEMA_TAG=b49efa8 \ - LUAROCK_EXPIRATIOND_REPO=https://github.com/tarantool/expirationd.git \ - LUAROCK_EXPIRATIOND_TAG=9ec22b6 \ - LUAROCK_QUEUE_REPO=https://github.com/tarantool/queue.git \ - LUAROCK_QUEUE_TAG=24d730c \ - LUAROCK_CONNPOOL_REPO=https://github.com/tarantool/connpool.git \ - LUAROCK_CONNPOOL_TAG=685af44 \ - LUAROCK_SHARD_REPO=https://github.com/tarantool/shard.git \ - LUAROCK_SHARD_TAG=278b906 \ - LUAROCK_HTTP_REPO=https://github.com/tarantool/http.git \ - LUAROCK_HTTP_TAG=67d8a9b \ - LUAROCK_PG_REPO=https://github.com/tarantool/pg.git \ - LUAROCK_PG_TAG=43a7130 \ - LUAROCK_MYSQL_REPO=https://github.com/tarantool/mysql.git \ - LUAROCK_MYSQL_TAG=1c15d30 \ - LUAROCK_MEMCACHED_REPO=https://github.com/tarantool/memcached.git \ - LUAROCK_MEMCACHED_TAG=c927626 \ - LUAROCK_TARANTOOL_PROMETHEUS_REPO=https://github.com/tarantool/prometheus.git \ - LUAROCK_TARANTOOL_PROMETHEUS_TAG=0654304 \ - LUAROCK_TARANTOOL_CURL_REPO=https://github.com/tarantool/curl.git \ - LUAROCK_TARANTOOL_CURL_TAG=2.2.7 \ - LUAROCK_MQTT_REPO=https://github.com/tarantool/mqtt.git \ - LUAROCK_MQTT_TAG=238fd2e \ - LUAROCK_TARANTOOL_GIS_REPO=https://github.com/tarantool/gis.git \ - LUAROCK_TARANTOOL_GIS_TAG=25209fc \ - LUAROCK_GPERFTOOLS_REPO=https://github.com/tarantool/gperftools.git \ - LUAROCK_GPERFTOOLS_TAG=12a7ac2 - -COPY gperftools_alpine.diff / - -RUN set -x \ - && apk add --no-cache --virtual .run-deps \ - libstdc++ \ - readline \ - libressl \ - yaml \ - lz4 \ - binutils \ - ncurses \ - libgomp \ - lua \ - tar \ - zip \ - ca-certificates \ - && apk add --no-cache --virtual .build-deps \ - gcc \ - g++ \ - cmake \ - readline-dev \ - libressl-dev \ - yaml-dev \ - lz4-dev \ - binutils-dev \ - ncurses-dev \ - lua-dev \ - musl-dev \ - make \ - git \ - libunwind-dev \ - autoconf \ - automake \ - libtool \ - linux-headers \ - go \ - wget \ - && : "---------- curl ----------" \ - && mkdir -p /usr/src/curl \ - && git clone "$CURL_REPO" /usr/src/curl \ - && git -C /usr/src/curl checkout "$CURL_TAG" \ - && (cd /usr/src/curl \ - && ./buildconf \ - && ./configure --prefix "/usr/local" \ - && make -j \ - && make install) \ - && : "---------- gperftools ----------" \ - && mkdir -p /usr/src/gperftools \ - && git clone "$GPERFTOOLS_REPO" /usr/src/gperftools \ - && git -C /usr/src/gperftools checkout "$GPERFTOOLS_TAG" \ - && (cd /usr/src/gperftools; \ - patch -p1 < /gperftools_alpine.diff; \ - rm /gperftools_alpine.diff; \ - ./autogen.sh; \ - ./configure; \ - make; \ - cp .libs/libprofiler.so* /usr/local/lib;) \ - && (GOPATH=/usr/src/go go get github.com/google/pprof; \ - cp /usr/src/go/bin/pprof /usr/local/bin) \ - && : "---------- tarantool ----------" \ - && mkdir -p /usr/src/tarantool \ - && git clone "$TARANTOOL_DOWNLOAD_URL" /usr/src/tarantool \ - && git -C /usr/src/tarantool checkout "$TARANTOOL_VERSION" \ - && git -C /usr/src/tarantool submodule update --init --recursive \ - && (cd /usr/src/tarantool; \ - cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo\ - -DENABLE_BUNDLED_LIBYAML:BOOL=OFF\ - -DENABLE_BACKTRACE:BOOL=ON\ - -DENABLE_DIST:BOOL=ON\ - .) \ - && make -C /usr/src/tarantool -j \ - && make -C /usr/src/tarantool install \ - && make -C /usr/src/tarantool clean \ - && : "---------- small ----------" \ - && (cd /usr/src/tarantool/src/lib/small; \ - cmake -DCMAKE_INSTALL_PREFIX=/usr \ - -DCMAKE_INSTALL_LIBDIR=lib \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - .) \ - && make -C /usr/src/tarantool/src/lib/small \ - && make -C /usr/src/tarantool/src/lib/small install \ - && make -C /usr/src/tarantool/src/lib/small clean \ - && : "---------- msgpuck ----------" \ - && (cd /usr/src/tarantool/src/lib/msgpuck; \ - cmake -DCMAKE_INSTALL_PREFIX=/usr \ - -DCMAKE_INSTALL_LIBDIR=lib \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - .) \ - && make -C /usr/src/tarantool/src/lib/msgpuck \ - && make -C /usr/src/tarantool/src/lib/msgpuck install \ - && make -C /usr/src/tarantool/src/lib/msgpuck clean \ - && : "---------- luarocks ----------" \ - && wget -O luarocks.tar.gz "$LUAROCKS_URL" \ - && mkdir -p /usr/src/luarocks \ - && tar -xzf luarocks.tar.gz -C /usr/src/luarocks --strip-components=1 \ - && (cd /usr/src/luarocks; \ - ./configure; \ - make build; \ - make install) \ - && rm -r /usr/src/luarocks \ - && rm -rf /usr/src/tarantool \ - && rm -rf /usr/src/gperftools \ - && rm -rf /usr/src/go \ - && : "---------- remove build deps ----------" \ - && apk del .build-deps - -COPY luarocks-config.lua /usr/local/etc/luarocks/config-5.1.lua - -RUN set -x \ - && apk add --no-cache --virtual .run-deps \ - mariadb-client-libs \ - libpq \ - cyrus-sasl \ - mosquitto-libs \ - libev \ - && apk add --no-cache --virtual .build-deps \ - git \ - cmake \ - make \ - gcc \ - g++ \ - postgresql-dev \ - lua-dev \ - musl-dev \ - cyrus-sasl-dev \ - mosquitto-dev \ - libev-dev \ - && : "---------- proj (for gis module) ----------" \ - && wget -O proj.tar.gz http://download.osgeo.org/proj/proj-4.9.3.tar.gz \ - && mkdir -p /usr/src/proj \ - && tar -xzf proj.tar.gz -C /usr/src/proj --strip-components=1 \ - && (cd /usr/src/proj; \ - ./configure; \ - make; \ - make install) \ - && rm -r /usr/src/proj \ - && rm -rf /usr/src/proj \ - && : "---------- geos (for gis module) ----------" \ - && wget -O geos.tar.bz2 http://download.osgeo.org/geos/geos-3.6.0.tar.bz2 \ - && mkdir -p /usr/src/geos \ - && tar -xjf geos.tar.bz2 -C /usr/src/geos --strip-components=1 \ - && (cd /usr/src/geos; \ - ./configure; \ - make; \ - make install) \ - && rm -r /usr/src/geos \ - && rm -rf /usr/src/geos \ - && : "---------- luarocks ----------" \ - && luarocks install lua-term \ - && luarocks install ldoc \ - && : "avro" \ - && git clone $LUAROCK_AVRO_SCHEMA_REPO /rocks/avro \ - && git -C /rocks/avro checkout $LUAROCK_AVRO_SCHEMA_TAG \ - && (cd /rocks/avro && luarocks make *rockspec) \ - && : "expirationd" \ - && git clone $LUAROCK_EXPIRATIOND_REPO /rocks/expirationd \ - && git -C /rocks/expirationd checkout $LUAROCK_EXPIRATIOND_TAG \ - && (cd /rocks/expirationd && luarocks make *rockspec) \ - && : "queue" \ - && git clone $LUAROCK_QUEUE_REPO /rocks/queue \ - && git -C /rocks/queue checkout $LUAROCK_QUEUE_TAG \ - && (cd /rocks/queue && luarocks make *rockspec) \ - && : "connpool" \ - && git clone $LUAROCK_CONNPOOL_REPO /rocks/connpool \ - && git -C /rocks/connpool checkout $LUAROCK_CONNPOOL_TAG \ - && (cd /rocks/connpool && luarocks make *rockspec) \ - && : "shard" \ - && git clone $LUAROCK_SHARD_REPO /rocks/shard \ - && git -C /rocks/shard checkout $LUAROCK_SHARD_TAG \ - && (cd /rocks/shard && luarocks make *rockspec) \ - && : "http" \ - && git clone $LUAROCK_HTTP_REPO /rocks/http \ - && git -C /rocks/http checkout $LUAROCK_HTTP_TAG \ - && (cd /rocks/http && luarocks make *rockspec) \ - && : "pg" \ - && git clone $LUAROCK_PG_REPO /rocks/pg \ - && git -C /rocks/pg checkout $LUAROCK_PG_TAG \ - && (cd /rocks/pg && luarocks make *rockspec) \ - && : "mysql" \ - && git clone $LUAROCK_MYSQL_REPO /rocks/mysql \ - && git -C /rocks/mysql checkout $LUAROCK_MYSQL_TAG \ - && (cd /rocks/mysql && luarocks make *rockspec) \ - && : "memcached" \ - && git clone $LUAROCK_MEMCACHED_REPO /rocks/memcached \ - && git -C /rocks/memcached checkout $LUAROCK_MEMCACHED_TAG \ - && (cd /rocks/memcached && luarocks make *rockspec) \ - && : "prometheus" \ - && git clone $LUAROCK_TARANTOOL_PROMETHEUS_REPO /rocks/prometheus \ - && git -C /rocks/prometheus checkout $LUAROCK_TARANTOOL_PROMETHEUS_TAG \ - && (cd /rocks/prometheus && luarocks make *rockspec) \ - && : "curl" \ - && git clone $LUAROCK_TARANTOOL_CURL_REPO /rocks/curl \ - && git -C /rocks/curl checkout $LUAROCK_TARANTOOL_CURL_TAG \ - && (cd /rocks/curl && luarocks make *rockspec) \ - && : "mqtt" \ - && git clone $LUAROCK_MQTT_REPO /rocks/mqtt \ - && git -C /rocks/mqtt checkout $LUAROCK_MQTT_TAG \ - && (cd /rocks/mqtt && luarocks make *rockspec) \ - && : "gis" \ - && git clone $LUAROCK_TARANTOOL_GIS_REPO /rocks/gis \ - && git -C /rocks/gis checkout $LUAROCK_TARANTOOL_GIS_TAG \ - && (cd /rocks/gis && luarocks make *rockspec) \ - && : "gperftools" \ - && git clone $LUAROCK_GPERFTOOLS_REPO /rocks/gperftools \ - && git -C /rocks/gperftools checkout $LUAROCK_GPERFTOOLS_TAG \ - && (cd /rocks/gperftools && luarocks make *rockspec) \ - && : "---------- remove build deps ----------" \ - && apk del .build-deps - - -RUN mkdir -p /var/lib/tarantool \ - && chown tarantool:tarantool /var/lib/tarantool \ - && mkdir -p /opt/tarantool \ - && chown tarantool:tarantool /opt/tarantool \ - && mkdir -p /var/run/tarantool \ - && chown tarantool:tarantool /var/run/tarantool \ - && mkdir /etc/tarantool \ - && chown tarantool:tarantool /etc/tarantool - -VOLUME /var/lib/tarantool -WORKDIR /opt/tarantool - -COPY tarantool-entrypoint.lua /usr/local/bin/ -COPY tarantool_set_config.lua /usr/local/bin/ -COPY docker-entrypoint.sh /usr/local/bin/ -COPY console /usr/local/bin/ -COPY tarantool_is_up /usr/local/bin/ -COPY tarantool.default /usr/local/etc/default/tarantool - -RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat -ENTRYPOINT ["docker-entrypoint.sh"] - -HEALTHCHECK CMD tarantool_is_up - -EXPOSE 3301 -CMD [ "tarantool" ] diff --git a/1.6/luarocks-config.lua b/1.6/luarocks-config.lua deleted file mode 100644 index 111f955..0000000 --- a/1.6/luarocks-config.lua +++ /dev/null @@ -1,9 +0,0 @@ -rocks_trees = { - { name = [[user]], root = home..[[/.luarocks]] }, - { name = [[system]], root = [[/usr/local]] } -} - -rocks_servers = { - [[http://rocks.tarantool.org/]], - [[http://luarocks.org/repositories/rocks]] -} diff --git a/1.6/tarantool-entrypoint.lua b/1.6/tarantool-entrypoint.lua deleted file mode 100755 index a71ec17..0000000 --- a/1.6/tarantool-entrypoint.lua +++ /dev/null @@ -1,261 +0,0 @@ -#!/usr/bin/env tarantool - -local fio = require('fio') -local errno = require('errno') -local fun = require('fun') -local urilib = require('uri') -local console = require('console') -local term = require('term') -local log = require('log') -local yaml = require('yaml') - -local TARANTOOL_DEFAULT_PORT = 3301 -local TARANTOOL_DEFAULT_SNAPSHOT_PERIOD = 3600 -- seconds -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local CFG_FILE_PATH = '/etc/tarantool/config.yml' - - -local orig_cfg = box.cfg - -local function read_config() - local f = io.open(CFG_FILE_PATH, "rb") - if f == nil then - log.error("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = f:read("*all") - f:close() - return yaml.decode(content) -end - -local function write_config(cfg) - local f = io.open(CFG_FILE_PATH, "w+") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = yaml.encode(cfg) - f:write(content) - f:close() -end - -local function parse_replication_source(replication_source, user_name, user_password) - if replication_source == nil then - return nil - end - - local replication_source_table = {} - for uri in string.gmatch(replication_source, "[^,]+") do - local parsed_uri = urilib.parse(uri) - if parsed_uri == nil then - error("Incorrect replication source URI format: '"..uri.."'") - end - local host = parsed_uri.host - local port = parsed_uri.service or TARANTOOL_DEFAULT_PORT - local user = parsed_uri.login or user_name - local password = parsed_uri.password or user_password - - if user == 'guest' or user == nil then - replication_source = string.format("%s:%s", host, port) - elseif password == nil then - replication_source = string.format("%s:@%s:%s", user, host, port) - else - replication_source = string.format("%s:%s@%s:%s", user, password, - host, port) - end - - table.insert(replication_source_table, replication_source) - end - - return replication_source_table -end - -function set_replication_source(replication_source, user_name, user_password) - local replication_source_table = - parse_replication_source(replication_source, user_name, user_password) - box.cfg{replication_source = replication_source_table} - - log.info("Updated box.cfg{replication_source} to "..replication_source) -end - -local function create_user(user_name, user_password) - if user_name ~= 'guest' and user_password == nil then - user_password = "" - - local warn_str = [[**************************************************** -WARNING: No password has been set for the database. - This will allow anyone with access to the - Tarantool port to access your database. In - Docker's default configuration, this is - effectively any other container on the same - system. - Use "-e TARANTOOL_USER_PASSWORD=password" - to set it in "docker run". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name == 'guest' and user_password == nil then - local warn_str = [[**************************************************** -WARNING: 'guest' is chosen as primary user. - Since it is not allowed to set a password for - guest user, your instance will be accessible - by anyone having direct access to the Tarantool - port. - If you wanted to create an authenticated user, - specify "-e TARANTOOL_USER_NAME=username" and - pick a user name other than "guest". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name == 'guest' and user_password ~= nil then - user_password = nil - - local warn_str = [[**************************************************** -WARNING: A password for guest user has been specified. - In Tarantool, guest user can't have a password - and is always allowed to login, if it has - enough privileges. - If you wanted to create an authenticated user, - specify "-e TARANTOOL_USER_NAME=username" and - pick a user name other than "guest". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name ~= 'admin' and user_name ~= 'guest' then - if not box.schema.user.exists(user_name) then - log.info("Creating user '%s'", user_name) - box.schema.user.create(user_name) - end - end - - if user_name ~= 'admin' then - log.info("Granting admin privileges to user '%s'", user_name) - box.schema.user.grant(user_name, 'read,write,execute', - 'universe', nil, {if_not_exists = true}) - box.schema.user.grant(user_name, 'replication', - nil, nil, {if_not_exists = true}) - end - - if user_name ~= 'guest' then - log.info("Setting password for user '%s'", user_name) - box.schema.user.passwd(user_name, user_password) - end -end - -function set_credentials(user_name, user_password) - create_user(user_name, user_password) -end - -local function wrapper_cfg(override) - local work_dir = '/var/lib/tarantool' - local snap_filename = "*.snap" - local snap_path = work_dir..'/'..snap_filename - - local first_run = false - if next(fio.glob(snap_path)) == nil then - first_run = true - end - - - local file_cfg = {} - local config_file_exists = fio.stat(CFG_FILE_PATH) ~= nil - if not config_file_exists then - log.info("Creating configuration file: " .. CFG_FILE_PATH) - - file_cfg.TARANTOOL_USER_NAME = os.getenv('TARANTOOL_USER_NAME') - file_cfg.TARANTOOL_USER_PASSWORD = os.getenv('TARANTOOL_USER_PASSWORD') - file_cfg.TARANTOOL_SLAB_ALLOC_ARENA = os.getenv('TARANTOOL_SLAB_ALLOC_ARENA') - file_cfg.TARANTOOL_SLAB_ALLOC_FACTOR = os.getenv('TARANTOOL_SLAB_ALLOC_FACTOR') - file_cfg.TARANTOOL_SLAB_ALLOC_MINIMAL = os.getenv('TARANTOOL_SLAB_ALLOC_MINIMAL') - file_cfg.TARANTOOL_SLAB_ALLOC_MAXIMAL = os.getenv('TARANTOOL_SLAB_ALLOC_MAXIMAL') - file_cfg.TARANTOOL_PORT = os.getenv('TARANTOOL_PORT') - file_cfg.TARANTOOL_WAL_MODE = os.getenv('TARANTOOL_WAL_MODE') - file_cfg.TARANTOOL_REPLICATION_SOURCE = os.getenv('TARANTOOL_REPLICATION_SOURCE') - file_cfg.TARANTOOL_SNAPSHOT_PERIOD = os.getenv('TARANTOOL_SNAPSHOT_PERIOD') - - write_config(file_cfg) - else - log.info("Loading existing configuration file: " .. CFG_FILE_PATH) - - file_cfg = read_config() - end - - local user_name = file_cfg.TARANTOOL_USER_NAME or - os.getenv('TARANTOOL_USER_NAME') or 'guest' - local user_password = file_cfg.TARANTOOL_USER_PASSWORD or - os.getenv('TARANTOOL_USER_PASSWORD') - - - local cfg = override or {} - cfg.slab_alloc_arena = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_ARENA) or - override.slab_alloc_arena - cfg.slab_alloc_factor = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_FACTOR) or - override.slab_alloc_factor - cfg.slab_alloc_maximal = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_MAXIMAL) or - override.slab_alloc_maximal - cfg.slab_alloc_minimal = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_MINIMAL) or - override.slab_alloc_minimal - cfg.listen = tonumber(file_cfg.TARANTOOL_PORT) or - override.listen or TARANTOOL_DEFAULT_PORT - cfg.wal_mode = file_cfg.TARANTOOL_WAL_MODE or - override.wal_mode - cfg.snapshot_period = tonumber(file_cfg.TARANTOOL_SNAPSHOT_PERIOD) or - override.snapshot_period or TARANTOOL_DEFAULT_SNAPSHOT_PERIOD - - cfg.wal_dir = override.wal_dir or '/var/lib/tarantool' - cfg.snap_dir = override.snap_dir or '/var/lib/tarantool' - cfg.pid_file = override.pid_file or '/var/run/tarantool/tarantool.pid' - - local replication_source = file_cfg.TARANTOOL_REPLICATION_SOURCE - local replication_source_table = parse_replication_source(replication_source, - user_name, - user_password) - - if replication_source then - cfg.replication_source = replication_source_table - else - cfg.replication_source = override.replication_source - end - - log.info("Config:\n" .. yaml.encode(cfg)) - - orig_cfg(cfg) - - box.once('tarantool-entrypoint', function () - if first_run then - log.info("Initializing database") - - create_user(user_name, user_password) - end - end) - - console.listen(CONSOLE_SOCKET_PATH) - -end - -box.cfg = wrapper_cfg - --- re-run the script passed as parameter with all arguments that follow -execute_script = arg[1] -if execute_script == nil then - box.cfg {} - - if term.isatty(io.stdout) then - console.start() - os.exit(0) - end -else - narg = 0 - while true do - arg[narg] = arg[narg + 1] - if arg[narg] == nil then - break - end - narg = narg + 1 - end - - dofile(execute_script) -end diff --git a/1.6/tarantool.default b/1.6/tarantool.default deleted file mode 100644 index 372dc23..0000000 --- a/1.6/tarantool.default +++ /dev/null @@ -1,21 +0,0 @@ --- --- System-wide settings for tarantoolctl and init scripts --- --- This file is meant to enable the usage of tarantoolctl inside --- docker containers. Since there is no init system, most of its --- functionality will not work, except 'tarantoolctl enter' or --- 'tarantoolctl status'. --- - -default_cfg = { - pid_file = "/var/run/tarantool", -- /var/run/tarantool/${INSTANCE}.pid - wal_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE}/ - snap_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE} - logger = "/var/log/tarantool", -- /var/log/tarantool/${INSTANCE}.log - username = "tarantool", -} - --- instances.available - all available instances --- instances.enabled - instances to autostart by sysvinit -instance_dir = "/usr/local/etc/tarantool/instances.enabled" --- vim: set ft=lua : diff --git a/1.6/tarantool_set_config.lua b/1.6/tarantool_set_config.lua deleted file mode 100755 index f6b2a55..0000000 --- a/1.6/tarantool_set_config.lua +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/env tarantool - -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local CFG_FILE_PATH = '/etc/tarantool/config.yml' - -local fio = require('fio') -local yaml = require('yaml') -local console = require('console') -local errno = require('errno') - -local function read_config() - local f = io.open(CFG_FILE_PATH, "rb") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = f:read("*all") - f:close() - return yaml.decode(content) -end - -local function write_config(cfg) - local f = io.open(CFG_FILE_PATH, "w+") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = yaml.encode(cfg) - f:write(content) - f:close() -end - -local function nop(console, cfg, value) -end - -local function update_replication_source(console, cfg, value) - local user_name = "nil" - if cfg['TARANTOOL_USER_NAME'] then - user_name = "'" .. cfg['TARANTOOL_USER_NAME'] .. "'" - end - - local user_password = "nil" - if cfg['TARANTOOL_USER_PASSWORD'] then - user_password = "'" .. cfg['TARANTOOL_USER_PASSWORD'] .. "'" - end - - local cmd = "set_replication_source('"..value.."', " .. user_name .. "," .. user_password .. ")" - print("cmd: ", cmd) - - local res = console:eval(cmd) - - if res ~= nil then - print(res) - end -end - -local function update_credentials(console, cfg, value) - local user_name = "nil" - if cfg['TARANTOOL_USER_NAME'] then - user_name = "'" .. cfg['TARANTOOL_USER_NAME'] .. "'" - end - - local user_password = "nil" - if cfg['TARANTOOL_USER_PASSWORD'] then - user_password = "'" .. cfg['TARANTOOL_USER_PASSWORD'] .. "'" - end - - local cmd = "set_credentials(" .. user_name .. "," .. user_password .. ")" - - local res = console:eval(cmd) - - if res ~= nil then - print(res) - end - - local replication_source = cfg['TARANTOOL_REPLICATION_SOURCE'] - - if replication_source ~= nil then - update_replication_source(console, cfg, replication_source) - end -end - - -local vars = { - TARANTOOL_SLAB_ALLOC_ARENA=nop, - TARANTOOL_SLAB_ALLOC_FACTOR=nop, - TARANTOOL_SLAB_ALLOC_MAXIMAL=nop, - TARANTOOL_SLAB_ALLOC_MINIMAL=nop, - TARANTOOL_PORT=nop, - TARANTOOL_WAL_MODE=nop, - TARANTOOL_USER_NAME=update_credentials, - TARANTOOL_USER_PASSWORD=update_credentials, - TARANTOOL_REPLICATION_SOURCE=update_replication_source -} - -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - os.exit(1) - end - - if arg[1] == nil or arg[2] == nil then - self:print("Usage: " .. arg[0] .. " ") - os.exit(1) - end - - if vars[arg[1]] == nil then - self:print("Unknown var: " .. arg[1]) - os.exit(1) - end - - local cfg = read_config() - cfg[arg[1]] = arg[2] - - local func = vars[arg[1]] - func(self, cfg, arg[2]) - - write_config(cfg) - - self.running = false - os.exit(0) -end) - -console.on_client_disconnect(function(self) self.running = false end) -console.start() - -os.exit(0) diff --git a/1.7/Dockerfile b/1.7/Dockerfile deleted file mode 100644 index ac8398f..0000000 --- a/1.7/Dockerfile +++ /dev/null @@ -1,244 +0,0 @@ -FROM alpine:3.5 -MAINTAINER mail@racktear.com - -RUN addgroup -S tarantool \ - && adduser -S -G tarantool tarantool \ - && apk add --no-cache 'su-exec>=0.2' - -ENV TARANTOOL_VERSION=1.7.6-27-g7ef5be2ee \ - TARANTOOL_DOWNLOAD_URL=https://github.com/tarantool/tarantool.git \ - TARANTOOL_INSTALL_LUADIR=/usr/local/share/tarantool \ - CURL_REPO=https://github.com/curl/curl.git \ - CURL_TAG=curl-7_59_0 \ - GPERFTOOLS_REPO=https://github.com/gperftools/gperftools.git \ - GPERFTOOLS_TAG=gperftools-2.5 \ - LUAROCKS_URL=https://github.com/tarantool/luarocks/archive/6e6fe62d9409fe2103c0fd091cccb3da0451faf5.tar.gz \ - LUAROCK_SHARD_REPO=https://github.com/tarantool/shard.git \ - LUAROCK_SHARD_TAG=8f8c5a7 \ - LUAROCK_AVRO_SCHEMA_VERSION=2.0.1 \ - LUAROCK_EXPERATIOND_VERSION=1.0.1 \ - LUAROCK_QUEUE_VERSION=1.0.2 \ - LUAROCK_CONNPOOL_VERSION=1.1.1 \ - LUAROCK_HTTP_VERSION=1.0.1 \ - LUAROCK_MEMCACHED_VERSION=1.0.0 \ - LUAROCK_TARANTOOL_PG_VERSION=2.0.1 \ - LUAROCK_TARANTOOL_MYSQL_VERSION=2.0.1 \ - LUAROCK_TARANTOOL_MQTT_VERSION=1.2.1 \ - LUAROCK_TARANTOOL_GIS_VERSION=1.0.0 \ - LUAROCK_TARANTOOL_PROMETHEUS_VERSION=1.0.0 \ - LUAROCK_TARANTOOL_GPERFTOOLS_VERSION=1.0.1 - -COPY gperftools_alpine.diff / - -RUN set -x \ - && apk add --no-cache --virtual .run-deps \ - libstdc++ \ - readline \ - libressl \ - yaml \ - lz4 \ - binutils \ - ncurses \ - libgomp \ - lua \ - tar \ - zip \ - libunwind \ - icu \ - ca-certificates \ - && apk add --no-cache --virtual .build-deps \ - perl \ - gcc \ - g++ \ - cmake \ - readline-dev \ - libressl-dev \ - yaml-dev \ - lz4-dev \ - binutils-dev \ - ncurses-dev \ - lua-dev \ - musl-dev \ - make \ - git \ - libunwind-dev \ - autoconf \ - automake \ - libtool \ - linux-headers \ - go \ - icu-dev \ - wget \ - && : "---------- curl ----------" \ - && mkdir -p /usr/src/curl \ - && git clone "$CURL_REPO" /usr/src/curl \ - && git -C /usr/src/curl checkout "$CURL_TAG" \ - && (cd /usr/src/curl \ - && ./buildconf \ - && ./configure --prefix "/usr/local" \ - && make -j \ - && make install) \ - && : "---------- gperftools ----------" \ - && mkdir -p /usr/src/gperftools \ - && git clone "$GPERFTOOLS_REPO" /usr/src/gperftools \ - && git -C /usr/src/gperftools checkout "$GPERFTOOLS_TAG" \ - && (cd /usr/src/gperftools; \ - patch -p1 < /gperftools_alpine.diff; \ - rm /gperftools_alpine.diff; \ - ./autogen.sh; \ - ./configure; \ - make; \ - cp .libs/libprofiler.so* /usr/local/lib;) \ - && (GOPATH=/usr/src/go go get github.com/google/pprof; \ - cp /usr/src/go/bin/pprof /usr/local/bin) \ - && : "---------- tarantool ----------" \ - && mkdir -p /usr/src/tarantool \ - && git clone "$TARANTOOL_DOWNLOAD_URL" /usr/src/tarantool \ - && git -C /usr/src/tarantool checkout "$TARANTOOL_VERSION" \ - && git -C /usr/src/tarantool submodule update --init --recursive \ - && (cd /usr/src/tarantool; \ - cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo\ - -DENABLE_BUNDLED_LIBYAML:BOOL=OFF\ - -DENABLE_BACKTRACE:BOOL=ON\ - -DENABLE_DIST:BOOL=ON\ - .) \ - && make -C /usr/src/tarantool -j\ - && make -C /usr/src/tarantool install \ - && make -C /usr/src/tarantool clean \ - && : "---------- small ----------" \ - && (cd /usr/src/tarantool/src/lib/small; \ - cmake -DCMAKE_INSTALL_PREFIX=/usr \ - -DCMAKE_INSTALL_LIBDIR=lib \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - .) \ - && make -C /usr/src/tarantool/src/lib/small \ - && make -C /usr/src/tarantool/src/lib/small install \ - && make -C /usr/src/tarantool/src/lib/small clean \ - && : "---------- msgpuck ----------" \ - && (cd /usr/src/tarantool/src/lib/msgpuck; \ - cmake -DCMAKE_INSTALL_PREFIX=/usr \ - -DCMAKE_INSTALL_LIBDIR=lib \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - .) \ - && make -C /usr/src/tarantool/src/lib/msgpuck \ - && make -C /usr/src/tarantool/src/lib/msgpuck install \ - && make -C /usr/src/tarantool/src/lib/msgpuck clean \ - && : "---------- luarocks ----------" \ - && wget -O luarocks.tar.gz "$LUAROCKS_URL" \ - && mkdir -p /usr/src/luarocks \ - && tar -xzf luarocks.tar.gz -C /usr/src/luarocks --strip-components=1 \ - && (cd /usr/src/luarocks; \ - ./configure; \ - make build; \ - make install) \ - && rm -r /usr/src/luarocks \ - && rm -rf /usr/src/tarantool \ - && rm -rf /usr/src/gperftools \ - && rm -rf /usr/src/go \ - && : "---------- remove build deps ----------" \ - && apk del .build-deps - -COPY luarocks-config.lua /usr/local/etc/luarocks/config-5.1.lua - -RUN set -x \ - && apk add --no-cache --virtual .run-deps \ - mariadb-client-libs \ - libpq \ - cyrus-sasl \ - mosquitto-libs \ - libev \ - && apk add --no-cache --virtual .build-deps \ - git \ - cmake \ - make \ - coreutils \ - gcc \ - g++ \ - postgresql-dev \ - lua-dev \ - musl-dev \ - cyrus-sasl-dev \ - mosquitto-dev \ - libev-dev \ - && mkdir -p /rocks \ - && : "---------- proj (for gis module) ----------" \ - && wget -O proj.tar.gz http://download.osgeo.org/proj/proj-4.9.3.tar.gz \ - && mkdir -p /usr/src/proj \ - && tar -xzf proj.tar.gz -C /usr/src/proj --strip-components=1 \ - && (cd /usr/src/proj; \ - ./configure; \ - make; \ - make install) \ - && rm -r /usr/src/proj \ - && rm -rf /usr/src/proj \ - && : "---------- geos (for gis module) ----------" \ - && wget -O geos.tar.bz2 http://download.osgeo.org/geos/geos-3.6.0.tar.bz2 \ - && mkdir -p /usr/src/geos \ - && tar -xjf geos.tar.bz2 -C /usr/src/geos --strip-components=1 \ - && (cd /usr/src/geos; \ - ./configure; \ - make; \ - make install) \ - && rm -r /usr/src/geos \ - && rm -rf /usr/src/geos \ - && : "---------- luarocks ----------" \ - && luarocks install lua-term \ - && luarocks install ldoc \ - && : "avro" \ - && luarocks install avro-schema $LUAROCK_AVRO_SCHEMA_VERSION \ - && : "expirationd" \ - && luarocks install expirationd $LUAROCK_EXPERATIOND_VERSION \ - && : "queue" \ - && luarocks install queue $LUAROCK_QUEUE_VERSION \ - && : "connpool" \ - && luarocks install connpool $LUAROCK_CONNPOOL_VERSION \ - && : "shard" \ - && git clone $LUAROCK_SHARD_REPO /rocks/shard \ - && git -C /rocks/shard checkout $LUAROCK_SHARD_TAG \ - && (cd /rocks/shard && luarocks make *rockspec) \ - && : "http" \ - && luarocks install http $LUAROCK_HTTP_VERSION \ - && : "pg" \ - && luarocks install pg $LUAROCK_TARANTOOL_PG_VERSION \ - && : "mysql" \ - && luarocks install mysql $LUAROCK_TARANTOOL_MYSQL_VERSION \ - && : "memcached" \ - && luarocks install memcached $LUAROCK_MEMCACHED_VERSION \ - && : "prometheus" \ - && luarocks install prometheus $LUAROCK_TARANTOOL_PROMETHEUS_VERSION \ - && : "mqtt" \ - && luarocks install mqtt $LUAROCK_TARANTOOL_MQTT_VERSION \ - && : "gis" \ - && luarocks install gis $LUAROCK_TARANTOOL_GIS_VERSION \ - && : "gperftools" \ - && luarocks install gperftools $LUAROCK_TARANTOOL_GPERFTOOLS_VERSION \ - && : "---------- remove build deps ----------" \ - && apk del .build-deps \ - && rm -rf /rocks - -RUN mkdir -p /var/lib/tarantool \ - && chown tarantool:tarantool /var/lib/tarantool \ - && mkdir -p /opt/tarantool \ - && chown tarantool:tarantool /opt/tarantool \ - && mkdir -p /var/run/tarantool \ - && chown tarantool:tarantool /var/run/tarantool \ - && mkdir /etc/tarantool \ - && chown tarantool:tarantool /etc/tarantool - -VOLUME /var/lib/tarantool -WORKDIR /opt/tarantool - -COPY tarantool-entrypoint.lua /usr/local/bin/ -COPY tarantool_set_config.lua /usr/local/bin/ -COPY docker-entrypoint.sh /usr/local/bin/ -COPY console /usr/local/bin/ -COPY tarantool_is_up /usr/local/bin/ -COPY tarantool.default /usr/local/etc/default/tarantool - -RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat -ENTRYPOINT ["docker-entrypoint.sh"] - -HEALTHCHECK CMD tarantool_is_up - -EXPOSE 3301 -CMD [ "tarantool" ] diff --git a/1.7/console b/1.7/console deleted file mode 100755 index d6fb192..0000000 --- a/1.7/console +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env tarantool - -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' - -console = require('console') -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - self.running = false - end -end) -console.on_client_disconnect(function(self) self.running = false end) -console.start() diff --git a/1.7/docker-entrypoint.sh b/1.7/docker-entrypoint.sh deleted file mode 100755 index 3a9f5e4..0000000 --- a/1.7/docker-entrypoint.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -# or first arg is `something.conf` -if [ "${1:0:1}" = '-' ]; then - set -- tarantool "$@" -fi - -# allow the container to be started with `--user` -if [ "$1" = 'tarantool' -a "$(id -u)" = '0' ]; then - chown -R tarantool /var/lib/tarantool - exec su-exec tarantool "$0" "$@" -fi - -# entry point wraps the passed script to do basic setup -if [ "$1" = 'tarantool' ]; then - shift - exec tarantool "/usr/local/bin/tarantool-entrypoint.lua" "$@" -fi - -exec "$@" diff --git a/1.7/gperftools_alpine.diff b/1.7/gperftools_alpine.diff deleted file mode 100644 index e768381..0000000 --- a/1.7/gperftools_alpine.diff +++ /dev/null @@ -1,110 +0,0 @@ -diff --git a/src/base/linux_syscall_support.h b/src/base/linux_syscall_support.h -index 5d578cd..fceebe2 100644 ---- a/src/base/linux_syscall_support.h -+++ b/src/base/linux_syscall_support.h -@@ -2432,9 +2432,9 @@ struct kernel_stat { - #if defined(__s390x__) - LSS_INLINE _syscall1(void*, mmap, void*, a) - #else -- /* Need to make sure __off64_t isn't truncated to 32-bits under x32. */ -+ /* Need to make sure off64_t isn't truncated to 32-bits under x32. */ - LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d, -- __off64_t o) { -+ off64_t o) { - LSS_BODY(6, void*, mmap, LSS_SYSCALL_ARG(s), LSS_SYSCALL_ARG(l), - LSS_SYSCALL_ARG(p), LSS_SYSCALL_ARG(f), - LSS_SYSCALL_ARG(d), (uint64_t)(o)); -@@ -2475,7 +2475,7 @@ struct kernel_stat { - LSS_INLINE _syscall6(void*, mmap, void*, s, - size_t, l, int, p, - int, f, int, d, -- __off64_t, o) -+ off64_t, o) - LSS_INLINE int LSS_NAME(sigaction)(int signum, - const struct kernel_sigaction *act, - struct kernel_sigaction *oldact) { -diff --git a/src/malloc_hook_mmap_linux.h b/src/malloc_hook_mmap_linux.h -index 1c4c766..b2aa8ed 100755 ---- a/src/malloc_hook_mmap_linux.h -+++ b/src/malloc_hook_mmap_linux.h -@@ -56,7 +56,7 @@ - - static inline void* do_mmap64(void *start, size_t length, - int prot, int flags, -- int fd, __off64_t offset) __THROW { -+ int fd, off64_t offset) __THROW { - return sys_mmap(start, length, prot, flags, fd, offset); - } - -@@ -67,7 +67,7 @@ static inline void* do_mmap64(void *start, size_t length, - - static inline void* do_mmap64(void *start, size_t length, - int prot, int flags, -- int fd, __off64_t offset) __THROW { -+ int fd, off64_t offset) __THROW { - void *result; - - // Try mmap2() unless it's not supported -@@ -151,9 +151,11 @@ static inline void* do_mmap64(void *start, size_t length, - # undef mmap - - extern "C" { -+ #ifndef mmap64 - void* mmap64(void *start, size_t length, int prot, int flags, -- int fd, __off64_t offset ) __THROW -+ int fd, off64_t offset ) __THROW - ATTRIBUTE_SECTION(malloc_hook); -+ #endif - void* mmap(void *start, size_t length,int prot, int flags, - int fd, off_t offset) __THROW - ATTRIBUTE_SECTION(malloc_hook); -@@ -166,8 +168,9 @@ extern "C" { - ATTRIBUTE_SECTION(malloc_hook); - } - -+#ifndef mmap64 - extern "C" void* mmap64(void *start, size_t length, int prot, int flags, -- int fd, __off64_t offset) __THROW { -+ int fd, off64_t offset) __THROW { - MallocHook::InvokePreMmapHook(start, length, prot, flags, fd, offset); - void *result; - if (!MallocHook::InvokeMmapReplacement( -@@ -177,6 +180,7 @@ extern "C" void* mmap64(void *start, size_t length, int prot, int flags, - MallocHook::InvokeMmapHook(result, start, length, prot, flags, fd, offset); - return result; - } -+#endif - - # if !defined(__USE_FILE_OFFSET64) || !defined(__REDIRECT_NTH) - -@@ -216,7 +220,7 @@ extern "C" void* mremap(void* old_addr, size_t old_size, size_t new_size, - return result; - } - --#ifndef __UCLIBC__ -+#if defined(__GLIBC__) && ! defined(__UCLIBC__) - // libc's version: - extern "C" void* __sbrk(ptrdiff_t increment); - -diff --git a/src/tests/stacktrace_unittest.cc b/src/tests/stacktrace_unittest.cc -index 3c9f735..2d39ad9 100644 ---- a/src/tests/stacktrace_unittest.cc -+++ b/src/tests/stacktrace_unittest.cc -@@ -120,17 +120,6 @@ void ATTRIBUTE_NOINLINE CheckStackTraceLeaf(void) { - CHECK_GE(size, 1); - CHECK_LE(size, STACK_LEN); - --#ifdef HAVE_EXECINFO_H -- { -- char **strings = backtrace_symbols(stack, size); -- printf("Obtained %d stack frames.\n", size); -- for (int i = 0; i < size; i++) -- printf("%s %p\n", strings[i], stack[i]); -- printf("CheckStackTrace() addr: %p\n", &CheckStackTrace); -- free(strings); -- } --#endif -- - for (int i = 0; i < BACKTRACE_STEPS; i++) { - printf("Backtrace %d: expected: %p..%p actual: %p ... ", - i, expected_range[i].start, expected_range[i].end, stack[i]); diff --git a/1.7/luarocks-config.lua b/1.7/luarocks-config.lua deleted file mode 100644 index 111f955..0000000 --- a/1.7/luarocks-config.lua +++ /dev/null @@ -1,9 +0,0 @@ -rocks_trees = { - { name = [[user]], root = home..[[/.luarocks]] }, - { name = [[system]], root = [[/usr/local]] } -} - -rocks_servers = { - [[http://rocks.tarantool.org/]], - [[http://luarocks.org/repositories/rocks]] -} diff --git a/1.7/tarantool-entrypoint.lua b/1.7/tarantool-entrypoint.lua deleted file mode 100755 index 11cd89d..0000000 --- a/1.7/tarantool-entrypoint.lua +++ /dev/null @@ -1,292 +0,0 @@ -#!/usr/bin/env tarantool - -local fio = require('fio') -local errno = require('errno') -local fun = require('fun') -local urilib = require('uri') -local console = require('console') -local term = require('term') -local log = require('log') -local yaml = require('yaml') - -local TARANTOOL_DEFAULT_PORT = 3301 -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local CFG_FILE_PATH = '/etc/tarantool/config.yml' - - -local orig_cfg = box.cfg - -local function read_config() - local f = io.open(CFG_FILE_PATH, "rb") - if f == nil then - log.error("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = f:read("*all") - f:close() - return yaml.decode(content) -end - -local function write_config(cfg) - local f = io.open(CFG_FILE_PATH, "w+") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = yaml.encode(cfg) - f:write(content) - f:close() -end - -local function parse_replication_source(replication_source, user_name, user_password) - if replication_source == nil then - return nil - end - - local replication_source_table = {} - for uri in string.gmatch(replication_source, "[^,]+") do - local parsed_uri = urilib.parse(uri) - if parsed_uri == nil then - error("Incorrect replication source URI format: '"..uri.."'") - end - local host = parsed_uri.host - local port = parsed_uri.service or TARANTOOL_DEFAULT_PORT - local user = parsed_uri.login or user_name - local password = parsed_uri.password or user_password - - if user == 'guest' or user == nil then - replication_source = string.format("%s:%s", host, port) - elseif password == nil then - replication_source = string.format("%s:@%s:%s", user, host, port) - else - replication_source = string.format("%s:%s@%s:%s", user, password, - host, port) - end - - table.insert(replication_source_table, replication_source) - end - - return replication_source_table -end - -local function choose_option(main, substitute, cfg) - if cfg[main] then - return main - end - if cfg[substitute] then - return substitute - end - return main -end - -function set_replication_source(replication_source, user_name, user_password) - local replication_source_table = parse_replication_source( - replication_source, user_name, user_password - ) - local choice = choose_option('replication', 'replication_source', box.cfg) - box.cfg{[choice] = replication_source_table} - log.info("Updated box.cfg.%s to %s", choice, replication_source) -end - -local function create_user(user_name, user_password) - if user_name ~= 'guest' and user_password == nil then - user_password = "" - - local warn_str = [[**************************************************** -WARNING: No password has been set for the database. - This will allow anyone with access to the - Tarantool port to access your database. In - Docker's default configuration, this is - effectively any other container on the same - system. - Use "-e TARANTOOL_USER_PASSWORD=password" - to set it in "docker run". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name == 'guest' and user_password == nil then - local warn_str = [[**************************************************** -WARNING: 'guest' is chosen as primary user. - Since it is not allowed to set a password for - guest user, your instance will be accessible - by anyone having direct access to the Tarantool - port. - If you wanted to create an authenticated user, - specify "-e TARANTOOL_USER_NAME=username" and - pick a user name other than "guest". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name == 'guest' and user_password ~= nil then - user_password = nil - - local warn_str = [[**************************************************** -WARNING: A password for guest user has been specified. - In Tarantool, guest user can't have a password - and is always allowed to login, if it has - enough privileges. - If you wanted to create an authenticated user, - specify "-e TARANTOOL_USER_NAME=username" and - pick a user name other than "guest". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name ~= 'admin' and user_name ~= 'guest' then - if not box.schema.user.exists(user_name) then - log.info("Creating user '%s'", user_name) - box.schema.user.create(user_name) - end - end - - if user_name ~= 'admin' then - log.info("Granting admin privileges to user '%s'", user_name) - box.schema.user.grant(user_name, 'read,write,execute', - 'universe', nil, {if_not_exists = true}) - box.schema.user.grant(user_name, 'replication', - nil, nil, {if_not_exists = true}) - end - - if user_name ~= 'guest' then - log.info("Setting password for user '%s'", user_name) - box.schema.user.passwd(user_name, user_password) - end -end - -function set_credentials(user_name, user_password) - create_user(user_name, user_password) -end - -local function wrapper_cfg(override) - local work_dir = '/var/lib/tarantool' - local snap_filename = "*.snap" - local snap_path = work_dir..'/'..snap_filename - - local first_run = false - if next(fio.glob(snap_path)) == nil then - first_run = true - end - - - local file_cfg = {} - local config_file_exists = fio.stat(CFG_FILE_PATH) ~= nil - if not config_file_exists then - log.info("Creating configuration file: " .. CFG_FILE_PATH) - - file_cfg.TARANTOOL_USER_NAME = os.getenv('TARANTOOL_USER_NAME') - file_cfg.TARANTOOL_USER_PASSWORD = os.getenv('TARANTOOL_USER_PASSWORD') - file_cfg.TARANTOOL_SLAB_ALLOC_ARENA = os.getenv('TARANTOOL_SLAB_ALLOC_ARENA') - file_cfg.TARANTOOL_SLAB_ALLOC_FACTOR = os.getenv('TARANTOOL_SLAB_ALLOC_FACTOR') - file_cfg.TARANTOOL_SLAB_ALLOC_MINIMAL = os.getenv('TARANTOOL_SLAB_ALLOC_MINIMAL') - file_cfg.TARANTOOL_SLAB_ALLOC_MAXIMAL = os.getenv('TARANTOOL_SLAB_ALLOC_MAXIMAL') - file_cfg.TARANTOOL_PORT = os.getenv('TARANTOOL_PORT') - file_cfg.TARANTOOL_WAL_MODE = os.getenv('TARANTOOL_WAL_MODE') - file_cfg.TARANTOOL_REPLICATION_SOURCE = os.getenv('TARANTOOL_REPLICATION_SOURCE') - file_cfg.TARANTOOL_REPLICATION = os.getenv('TARANTOOL_REPLICATION') - file_cfg.TARANTOOL_SNAPSHOT_PERIOD = os.getenv('TARANTOOL_SNAPSHOT_PERIOD') - file_cfg.TARANTOOL_MEMTX_MEMORY = os.getenv('TARANTOOL_MEMTX_MEMORY') - file_cfg.TARANTOOL_CHECKPOINT_INTERVAL = os.getenv('TARANTOOL_CHECKPOINT_INTERVAL') - file_cfg.TARANTOOL_MEMTX_MIN_TUPLE_SIZE = os.getenv('TARANTOOL_MEMTX_MIN_TUPLE_SIZE') - file_cfg.TARANTOOL_MEMTX_MAX_TUPLE_SIZE = os.getenv('TARANTOOL_MEMTX_MAX_TUPLE_SIZE') - - write_config(file_cfg) - else - log.info("Loading existing configuration file: " .. CFG_FILE_PATH) - - file_cfg = read_config() - end - - local user_name = file_cfg.TARANTOOL_USER_NAME or - os.getenv('TARANTOOL_USER_NAME') or 'guest' - local user_password = file_cfg.TARANTOOL_USER_PASSWORD or - os.getenv('TARANTOOL_USER_PASSWORD') - - - local cfg = override or {} - -- Placeholders for deprecated options - cfg.slab_alloc_arena = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_ARENA) or - override.slab_alloc_arena - cfg.slab_alloc_maximal = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_MAXIMAL) or - override.slab_alloc_maximal - cfg.slab_alloc_minimal = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_MINIMAL) or - override.slab_alloc_minimal - cfg.snapshot_period = tonumber(file_cfg.TARANTOOL_SNAPSHOT_PERIOD) or - override.snapshot_period - -- Replacements for deprecated options - cfg.memtx_memory = tonumber(file_cfg.TARANTOOL_MEMTX_MEMORY) or - override.memtx_memory - cfg.memtx_min_tuple_size = tonumber(file_cfg.TARANTOOL_MEMTX_MIN_TUPLE_SIZE) or - override.memtx_min_tuple_size - cfg.memtx_max_tuple_size = tonumber(file_cfg.TARANTOOL_MEMTX_MAX_TUPLE_SIZE) or - override.memtx_max_tuple_size - cfg.checkpoint_interval = tonumber(file_cfg.TARANTOOL_CHECKPOINT_INTERVAL) or - override.checkpoint_interval - -- Deprecated options with default values - local choice = choose_option('memtx_dir', 'snap_dir', override) - cfg[choice] = override[choice] or '/var/lib/tarantool' - - -- Remaining configuration - cfg.slab_alloc_factor = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_FACTOR) or - override.slab_alloc_factor - cfg.listen = tonumber(file_cfg.TARANTOOL_PORT) or - override.listen or TARANTOOL_DEFAULT_PORT - cfg.wal_mode = file_cfg.TARANTOOL_WAL_MODE or - override.wal_mode - - cfg.wal_dir = override.wal_dir or '/var/lib/tarantool' - cfg.vinyl_dir = override.vinyl_dir or '/var/lib/tarantool' - cfg.pid_file = override.pid_file or '/var/run/tarantool/tarantool.pid' - - local choice = choose_option('TARANTOOL_REPLICATION', 'TARANTOOL_REPLICATION_SOURCE', file_cfg) - local replication_source_table = parse_replication_source(file_cfg[choice], - user_name, - user_password) - - if replication_source_table then - cfg.replication = replication_source_table - else - local choice = choose_option('replication', 'replication_source', override) - cfg[choice] = override[choice] - end - - log.info("Config:\n" .. yaml.encode(cfg)) - - orig_cfg(cfg) - - box.once('tarantool-entrypoint', function () - if first_run then - log.info("Initializing database") - - create_user(user_name, user_password) - end - end) - - console.listen(CONSOLE_SOCKET_PATH) - -end - -box.cfg = wrapper_cfg - --- re-run the script passed as parameter with all arguments that follow -execute_script = arg[1] -if execute_script == nil then - box.cfg {} - - if term.isatty(io.stdout) then - console.start() - os.exit(0) - end -else - narg = 0 - while true do - arg[narg] = arg[narg + 1] - if arg[narg] == nil then - break - end - narg = narg + 1 - end - - dofile(execute_script) -end diff --git a/1.7/tarantool_is_up b/1.7/tarantool_is_up deleted file mode 100755 index 71148d5..0000000 --- a/1.7/tarantool_is_up +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -status=$( (tarantool <<-'EOF' -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local console = require('console') -local os = require("os") -local yaml = require("yaml") - -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - os.exit(1) - end - - cmd = 'box.info.status' - local res = self:eval(cmd) - if res ~= nil then - res = yaml.decode(res) - print(res[1]) - end - - os.exit(0) -end) - -console.on_client_disconnect(function(self) self.running = false end) -console.start() - -os.exit(0) -EOF -) 2>/dev/null) - - -echo "$status" - -if [ "$status" = "running" ]; then - exit 0 -else - exit 1 -fi diff --git a/1.7/tarantool_set_config.lua b/1.7/tarantool_set_config.lua deleted file mode 100755 index ddca36c..0000000 --- a/1.7/tarantool_set_config.lua +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env tarantool - -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local CFG_FILE_PATH = '/etc/tarantool/config.yml' - -local fio = require('fio') -local yaml = require('yaml') -local console = require('console') -local errno = require('errno') - -local function read_config() - local f = io.open(CFG_FILE_PATH, "rb") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = f:read("*all") - f:close() - return yaml.decode(content) -end - -local function write_config(cfg) - local f = io.open(CFG_FILE_PATH, "w+") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = yaml.encode(cfg) - f:write(content) - f:close() -end - -local function nop(console, cfg, value) -end - -local function update_replication_source(console, cfg, value) - local user_name = "nil" - if cfg['TARANTOOL_USER_NAME'] then - user_name = "'" .. cfg['TARANTOOL_USER_NAME'] .. "'" - end - - local user_password = "nil" - if cfg['TARANTOOL_USER_PASSWORD'] then - user_password = "'" .. cfg['TARANTOOL_USER_PASSWORD'] .. "'" - end - - local cmd = "set_replication_source('"..value.."', " .. user_name .. "," .. user_password .. ")" - print("cmd: ", cmd) - - local res = console:eval(cmd) - - if res ~= nil then - print(res) - end -end - -local function update_credentials(console, cfg, value) - local user_name = "nil" - if cfg['TARANTOOL_USER_NAME'] then - user_name = "'" .. cfg['TARANTOOL_USER_NAME'] .. "'" - end - - local user_password = "nil" - if cfg['TARANTOOL_USER_PASSWORD'] then - user_password = "'" .. cfg['TARANTOOL_USER_PASSWORD'] .. "'" - end - - local cmd = "set_credentials(" .. user_name .. "," .. user_password .. ")" - - local res = console:eval(cmd) - - if res ~= nil then - print(res) - end - - local replication_source = cfg['TARANTOOL_REPLICATION_SOURCE'] - - if replication_source ~= nil then - update_replication_source(console, cfg, replication_source) - end -end - - -local vars = { - TARANTOOL_SLAB_ALLOC_ARENA=nop, - TARANTOOL_SLAB_ALLOC_FACTOR=nop, - TARANTOOL_SLAB_ALLOC_MAXIMAL=nop, - TARANTOOL_SLAB_ALLOC_MINIMAL=nop, - TARANTOOL_PORT=nop, - TARANTOOL_WAL_MODE=nop, - TARANTOOL_USER_NAME=update_credentials, - TARANTOOL_USER_PASSWORD=update_credentials, - TARANTOOL_REPLICATION_SOURCE=update_replication_source, - TARANTOOL_REPLICATION=update_replication_source, -} - -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - os.exit(1) - end - - if arg[1] == nil or arg[2] == nil then - self:print("Usage: " .. arg[0] .. " ") - os.exit(1) - end - - if vars[arg[1]] == nil then - self:print("Unknown var: " .. arg[1]) - os.exit(1) - end - - local cfg = read_config() - cfg[arg[1]] = arg[2] - - local func = vars[arg[1]] - func(self, cfg, arg[2]) - - write_config(cfg) - - self.running = false - os.exit(0) -end) - -console.on_client_disconnect(function(self) self.running = false end) -console.start() - -os.exit(0) diff --git a/1.9/Dockerfile b/1.9/Dockerfile deleted file mode 100644 index 35df221..0000000 --- a/1.9/Dockerfile +++ /dev/null @@ -1,244 +0,0 @@ -FROM alpine:3.5 -MAINTAINER mail@racktear.com - -RUN addgroup -S tarantool \ - && adduser -S -G tarantool tarantool \ - && apk add --no-cache 'su-exec>=0.2' - -ENV TARANTOOL_VERSION=1.9.2-13-gfa7c74b4d \ - TARANTOOL_DOWNLOAD_URL=https://github.com/tarantool/tarantool.git \ - TARANTOOL_INSTALL_LUADIR=/usr/local/share/tarantool \ - CURL_REPO=https://github.com/curl/curl.git \ - CURL_TAG=curl-7_59_0 \ - GPERFTOOLS_REPO=https://github.com/gperftools/gperftools.git \ - GPERFTOOLS_TAG=gperftools-2.5 \ - LUAROCKS_URL=https://github.com/tarantool/luarocks/archive/6e6fe62d9409fe2103c0fd091cccb3da0451faf5.tar.gz \ - LUAROCK_SHARD_REPO=https://github.com/tarantool/shard.git \ - LUAROCK_SHARD_TAG=8f8c5a7 \ - LUAROCK_AVRO_SCHEMA_VERSION=2.0.1 \ - LUAROCK_EXPERATIOND_VERSION=1.0.1 \ - LUAROCK_QUEUE_VERSION=1.0.2 \ - LUAROCK_CONNPOOL_VERSION=1.1.1 \ - LUAROCK_HTTP_VERSION=1.0.1 \ - LUAROCK_MEMCACHED_VERSION=1.0.0 \ - LUAROCK_TARANTOOL_PG_VERSION=2.0.1 \ - LUAROCK_TARANTOOL_MYSQL_VERSION=2.0.1 \ - LUAROCK_TARANTOOL_MQTT_VERSION=1.2.1 \ - LUAROCK_TARANTOOL_GIS_VERSION=1.0.0 \ - LUAROCK_TARANTOOL_PROMETHEUS_VERSION=1.0.0 \ - LUAROCK_TARANTOOL_GPERFTOOLS_VERSION=1.0.1 - -COPY gperftools_alpine.diff / - -RUN set -x \ - && apk add --no-cache --virtual .run-deps \ - libstdc++ \ - readline \ - libressl \ - yaml \ - lz4 \ - binutils \ - ncurses \ - libgomp \ - lua \ - tar \ - zip \ - libunwind \ - icu \ - ca-certificates \ - && apk add --no-cache --virtual .build-deps \ - perl \ - gcc \ - g++ \ - cmake \ - readline-dev \ - libressl-dev \ - yaml-dev \ - lz4-dev \ - binutils-dev \ - ncurses-dev \ - lua-dev \ - musl-dev \ - make \ - git \ - libunwind-dev \ - autoconf \ - automake \ - libtool \ - linux-headers \ - go \ - icu-dev \ - wget \ - && : "---------- curl ----------" \ - && mkdir -p /usr/src/curl \ - && git clone "$CURL_REPO" /usr/src/curl \ - && git -C /usr/src/curl checkout "$CURL_TAG" \ - && (cd /usr/src/curl \ - && ./buildconf \ - && ./configure --prefix "/usr/local" \ - && make -j \ - && make install) \ - && : "---------- gperftools ----------" \ - && mkdir -p /usr/src/gperftools \ - && git clone "$GPERFTOOLS_REPO" /usr/src/gperftools \ - && git -C /usr/src/gperftools checkout "$GPERFTOOLS_TAG" \ - && (cd /usr/src/gperftools; \ - patch -p1 < /gperftools_alpine.diff; \ - rm /gperftools_alpine.diff; \ - ./autogen.sh; \ - ./configure; \ - make; \ - cp .libs/libprofiler.so* /usr/local/lib;) \ - && (GOPATH=/usr/src/go go get github.com/google/pprof; \ - cp /usr/src/go/bin/pprof /usr/local/bin) \ - && : "---------- tarantool ----------" \ - && mkdir -p /usr/src/tarantool \ - && git clone "$TARANTOOL_DOWNLOAD_URL" /usr/src/tarantool \ - && git -C /usr/src/tarantool checkout "$TARANTOOL_VERSION" \ - && git -C /usr/src/tarantool submodule update --init --recursive \ - && (cd /usr/src/tarantool; \ - cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo\ - -DENABLE_BUNDLED_LIBYAML:BOOL=OFF\ - -DENABLE_BACKTRACE:BOOL=ON\ - -DENABLE_DIST:BOOL=ON\ - .) \ - && make -C /usr/src/tarantool -j\ - && make -C /usr/src/tarantool install \ - && make -C /usr/src/tarantool clean \ - && : "---------- small ----------" \ - && (cd /usr/src/tarantool/src/lib/small; \ - cmake -DCMAKE_INSTALL_PREFIX=/usr \ - -DCMAKE_INSTALL_LIBDIR=lib \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - .) \ - && make -C /usr/src/tarantool/src/lib/small \ - && make -C /usr/src/tarantool/src/lib/small install \ - && make -C /usr/src/tarantool/src/lib/small clean \ - && : "---------- msgpuck ----------" \ - && (cd /usr/src/tarantool/src/lib/msgpuck; \ - cmake -DCMAKE_INSTALL_PREFIX=/usr \ - -DCMAKE_INSTALL_LIBDIR=lib \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - .) \ - && make -C /usr/src/tarantool/src/lib/msgpuck \ - && make -C /usr/src/tarantool/src/lib/msgpuck install \ - && make -C /usr/src/tarantool/src/lib/msgpuck clean \ - && : "---------- luarocks ----------" \ - && wget -O luarocks.tar.gz "$LUAROCKS_URL" \ - && mkdir -p /usr/src/luarocks \ - && tar -xzf luarocks.tar.gz -C /usr/src/luarocks --strip-components=1 \ - && (cd /usr/src/luarocks; \ - ./configure; \ - make build; \ - make install) \ - && rm -r /usr/src/luarocks \ - && rm -rf /usr/src/tarantool \ - && rm -rf /usr/src/gperftools \ - && rm -rf /usr/src/go \ - && : "---------- remove build deps ----------" \ - && apk del .build-deps - -COPY luarocks-config.lua /usr/local/etc/luarocks/config-5.1.lua - -RUN set -x \ - && apk add --no-cache --virtual .run-deps \ - mariadb-client-libs \ - libpq \ - cyrus-sasl \ - mosquitto-libs \ - libev \ - && apk add --no-cache --virtual .build-deps \ - git \ - cmake \ - make \ - coreutils \ - gcc \ - g++ \ - postgresql-dev \ - lua-dev \ - musl-dev \ - cyrus-sasl-dev \ - mosquitto-dev \ - libev-dev \ - && mkdir -p /rocks \ - && : "---------- proj (for gis module) ----------" \ - && wget -O proj.tar.gz http://download.osgeo.org/proj/proj-4.9.3.tar.gz \ - && mkdir -p /usr/src/proj \ - && tar -xzf proj.tar.gz -C /usr/src/proj --strip-components=1 \ - && (cd /usr/src/proj; \ - ./configure; \ - make; \ - make install) \ - && rm -r /usr/src/proj \ - && rm -rf /usr/src/proj \ - && : "---------- geos (for gis module) ----------" \ - && wget -O geos.tar.bz2 http://download.osgeo.org/geos/geos-3.6.0.tar.bz2 \ - && mkdir -p /usr/src/geos \ - && tar -xjf geos.tar.bz2 -C /usr/src/geos --strip-components=1 \ - && (cd /usr/src/geos; \ - ./configure; \ - make; \ - make install) \ - && rm -r /usr/src/geos \ - && rm -rf /usr/src/geos \ - && : "---------- luarocks ----------" \ - && luarocks install lua-term \ - && luarocks install ldoc \ - && : "avro" \ - && luarocks install avro-schema $LUAROCK_AVRO_SCHEMA_VERSION \ - && : "expirationd" \ - && luarocks install expirationd $LUAROCK_EXPERATIOND_VERSION \ - && : "queue" \ - && luarocks install queue $LUAROCK_QUEUE_VERSION \ - && : "connpool" \ - && luarocks install connpool $LUAROCK_CONNPOOL_VERSION \ - && : "shard" \ - && git clone $LUAROCK_SHARD_REPO /rocks/shard \ - && git -C /rocks/shard checkout $LUAROCK_SHARD_TAG \ - && (cd /rocks/shard && luarocks make *rockspec) \ - && : "http" \ - && luarocks install http $LUAROCK_HTTP_VERSION \ - && : "pg" \ - && luarocks install pg $LUAROCK_TARANTOOL_PG_VERSION \ - && : "mysql" \ - && luarocks install mysql $LUAROCK_TARANTOOL_MYSQL_VERSION \ - && : "memcached" \ - && luarocks install memcached $LUAROCK_MEMCACHED_VERSION \ - && : "prometheus" \ - && luarocks install prometheus $LUAROCK_TARANTOOL_PROMETHEUS_VERSION \ - && : "mqtt" \ - && luarocks install mqtt $LUAROCK_TARANTOOL_MQTT_VERSION \ - && : "gis" \ - && luarocks install gis $LUAROCK_TARANTOOL_GIS_VERSION \ - && : "gperftools" \ - && luarocks install gperftools $LUAROCK_TARANTOOL_GPERFTOOLS_VERSION \ - && : "---------- remove build deps ----------" \ - && apk del .build-deps \ - && rm -rf /rocks - -RUN mkdir -p /var/lib/tarantool \ - && chown tarantool:tarantool /var/lib/tarantool \ - && mkdir -p /opt/tarantool \ - && chown tarantool:tarantool /opt/tarantool \ - && mkdir -p /var/run/tarantool \ - && chown tarantool:tarantool /var/run/tarantool \ - && mkdir /etc/tarantool \ - && chown tarantool:tarantool /etc/tarantool - -VOLUME /var/lib/tarantool -WORKDIR /opt/tarantool - -COPY tarantool-entrypoint.lua /usr/local/bin/ -COPY tarantool_set_config.lua /usr/local/bin/ -COPY docker-entrypoint.sh /usr/local/bin/ -COPY console /usr/local/bin/ -COPY tarantool_is_up /usr/local/bin/ -COPY tarantool.default /usr/local/etc/default/tarantool - -RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat -ENTRYPOINT ["docker-entrypoint.sh"] - -HEALTHCHECK CMD tarantool_is_up - -EXPOSE 3301 -CMD [ "tarantool" ] diff --git a/1.9/console b/1.9/console deleted file mode 100755 index d6fb192..0000000 --- a/1.9/console +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env tarantool - -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' - -console = require('console') -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - self.running = false - end -end) -console.on_client_disconnect(function(self) self.running = false end) -console.start() diff --git a/1.9/docker-entrypoint.sh b/1.9/docker-entrypoint.sh deleted file mode 100755 index 3a9f5e4..0000000 --- a/1.9/docker-entrypoint.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -# or first arg is `something.conf` -if [ "${1:0:1}" = '-' ]; then - set -- tarantool "$@" -fi - -# allow the container to be started with `--user` -if [ "$1" = 'tarantool' -a "$(id -u)" = '0' ]; then - chown -R tarantool /var/lib/tarantool - exec su-exec tarantool "$0" "$@" -fi - -# entry point wraps the passed script to do basic setup -if [ "$1" = 'tarantool' ]; then - shift - exec tarantool "/usr/local/bin/tarantool-entrypoint.lua" "$@" -fi - -exec "$@" diff --git a/1.9/gperftools_alpine.diff b/1.9/gperftools_alpine.diff deleted file mode 100644 index e768381..0000000 --- a/1.9/gperftools_alpine.diff +++ /dev/null @@ -1,110 +0,0 @@ -diff --git a/src/base/linux_syscall_support.h b/src/base/linux_syscall_support.h -index 5d578cd..fceebe2 100644 ---- a/src/base/linux_syscall_support.h -+++ b/src/base/linux_syscall_support.h -@@ -2432,9 +2432,9 @@ struct kernel_stat { - #if defined(__s390x__) - LSS_INLINE _syscall1(void*, mmap, void*, a) - #else -- /* Need to make sure __off64_t isn't truncated to 32-bits under x32. */ -+ /* Need to make sure off64_t isn't truncated to 32-bits under x32. */ - LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d, -- __off64_t o) { -+ off64_t o) { - LSS_BODY(6, void*, mmap, LSS_SYSCALL_ARG(s), LSS_SYSCALL_ARG(l), - LSS_SYSCALL_ARG(p), LSS_SYSCALL_ARG(f), - LSS_SYSCALL_ARG(d), (uint64_t)(o)); -@@ -2475,7 +2475,7 @@ struct kernel_stat { - LSS_INLINE _syscall6(void*, mmap, void*, s, - size_t, l, int, p, - int, f, int, d, -- __off64_t, o) -+ off64_t, o) - LSS_INLINE int LSS_NAME(sigaction)(int signum, - const struct kernel_sigaction *act, - struct kernel_sigaction *oldact) { -diff --git a/src/malloc_hook_mmap_linux.h b/src/malloc_hook_mmap_linux.h -index 1c4c766..b2aa8ed 100755 ---- a/src/malloc_hook_mmap_linux.h -+++ b/src/malloc_hook_mmap_linux.h -@@ -56,7 +56,7 @@ - - static inline void* do_mmap64(void *start, size_t length, - int prot, int flags, -- int fd, __off64_t offset) __THROW { -+ int fd, off64_t offset) __THROW { - return sys_mmap(start, length, prot, flags, fd, offset); - } - -@@ -67,7 +67,7 @@ static inline void* do_mmap64(void *start, size_t length, - - static inline void* do_mmap64(void *start, size_t length, - int prot, int flags, -- int fd, __off64_t offset) __THROW { -+ int fd, off64_t offset) __THROW { - void *result; - - // Try mmap2() unless it's not supported -@@ -151,9 +151,11 @@ static inline void* do_mmap64(void *start, size_t length, - # undef mmap - - extern "C" { -+ #ifndef mmap64 - void* mmap64(void *start, size_t length, int prot, int flags, -- int fd, __off64_t offset ) __THROW -+ int fd, off64_t offset ) __THROW - ATTRIBUTE_SECTION(malloc_hook); -+ #endif - void* mmap(void *start, size_t length,int prot, int flags, - int fd, off_t offset) __THROW - ATTRIBUTE_SECTION(malloc_hook); -@@ -166,8 +168,9 @@ extern "C" { - ATTRIBUTE_SECTION(malloc_hook); - } - -+#ifndef mmap64 - extern "C" void* mmap64(void *start, size_t length, int prot, int flags, -- int fd, __off64_t offset) __THROW { -+ int fd, off64_t offset) __THROW { - MallocHook::InvokePreMmapHook(start, length, prot, flags, fd, offset); - void *result; - if (!MallocHook::InvokeMmapReplacement( -@@ -177,6 +180,7 @@ extern "C" void* mmap64(void *start, size_t length, int prot, int flags, - MallocHook::InvokeMmapHook(result, start, length, prot, flags, fd, offset); - return result; - } -+#endif - - # if !defined(__USE_FILE_OFFSET64) || !defined(__REDIRECT_NTH) - -@@ -216,7 +220,7 @@ extern "C" void* mremap(void* old_addr, size_t old_size, size_t new_size, - return result; - } - --#ifndef __UCLIBC__ -+#if defined(__GLIBC__) && ! defined(__UCLIBC__) - // libc's version: - extern "C" void* __sbrk(ptrdiff_t increment); - -diff --git a/src/tests/stacktrace_unittest.cc b/src/tests/stacktrace_unittest.cc -index 3c9f735..2d39ad9 100644 ---- a/src/tests/stacktrace_unittest.cc -+++ b/src/tests/stacktrace_unittest.cc -@@ -120,17 +120,6 @@ void ATTRIBUTE_NOINLINE CheckStackTraceLeaf(void) { - CHECK_GE(size, 1); - CHECK_LE(size, STACK_LEN); - --#ifdef HAVE_EXECINFO_H -- { -- char **strings = backtrace_symbols(stack, size); -- printf("Obtained %d stack frames.\n", size); -- for (int i = 0; i < size; i++) -- printf("%s %p\n", strings[i], stack[i]); -- printf("CheckStackTrace() addr: %p\n", &CheckStackTrace); -- free(strings); -- } --#endif -- - for (int i = 0; i < BACKTRACE_STEPS; i++) { - printf("Backtrace %d: expected: %p..%p actual: %p ... ", - i, expected_range[i].start, expected_range[i].end, stack[i]); diff --git a/1.9/luarocks-config.lua b/1.9/luarocks-config.lua deleted file mode 100644 index 111f955..0000000 --- a/1.9/luarocks-config.lua +++ /dev/null @@ -1,9 +0,0 @@ -rocks_trees = { - { name = [[user]], root = home..[[/.luarocks]] }, - { name = [[system]], root = [[/usr/local]] } -} - -rocks_servers = { - [[http://rocks.tarantool.org/]], - [[http://luarocks.org/repositories/rocks]] -} diff --git a/1.9/tarantool-entrypoint.lua b/1.9/tarantool-entrypoint.lua deleted file mode 100755 index 11cd89d..0000000 --- a/1.9/tarantool-entrypoint.lua +++ /dev/null @@ -1,292 +0,0 @@ -#!/usr/bin/env tarantool - -local fio = require('fio') -local errno = require('errno') -local fun = require('fun') -local urilib = require('uri') -local console = require('console') -local term = require('term') -local log = require('log') -local yaml = require('yaml') - -local TARANTOOL_DEFAULT_PORT = 3301 -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local CFG_FILE_PATH = '/etc/tarantool/config.yml' - - -local orig_cfg = box.cfg - -local function read_config() - local f = io.open(CFG_FILE_PATH, "rb") - if f == nil then - log.error("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = f:read("*all") - f:close() - return yaml.decode(content) -end - -local function write_config(cfg) - local f = io.open(CFG_FILE_PATH, "w+") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = yaml.encode(cfg) - f:write(content) - f:close() -end - -local function parse_replication_source(replication_source, user_name, user_password) - if replication_source == nil then - return nil - end - - local replication_source_table = {} - for uri in string.gmatch(replication_source, "[^,]+") do - local parsed_uri = urilib.parse(uri) - if parsed_uri == nil then - error("Incorrect replication source URI format: '"..uri.."'") - end - local host = parsed_uri.host - local port = parsed_uri.service or TARANTOOL_DEFAULT_PORT - local user = parsed_uri.login or user_name - local password = parsed_uri.password or user_password - - if user == 'guest' or user == nil then - replication_source = string.format("%s:%s", host, port) - elseif password == nil then - replication_source = string.format("%s:@%s:%s", user, host, port) - else - replication_source = string.format("%s:%s@%s:%s", user, password, - host, port) - end - - table.insert(replication_source_table, replication_source) - end - - return replication_source_table -end - -local function choose_option(main, substitute, cfg) - if cfg[main] then - return main - end - if cfg[substitute] then - return substitute - end - return main -end - -function set_replication_source(replication_source, user_name, user_password) - local replication_source_table = parse_replication_source( - replication_source, user_name, user_password - ) - local choice = choose_option('replication', 'replication_source', box.cfg) - box.cfg{[choice] = replication_source_table} - log.info("Updated box.cfg.%s to %s", choice, replication_source) -end - -local function create_user(user_name, user_password) - if user_name ~= 'guest' and user_password == nil then - user_password = "" - - local warn_str = [[**************************************************** -WARNING: No password has been set for the database. - This will allow anyone with access to the - Tarantool port to access your database. In - Docker's default configuration, this is - effectively any other container on the same - system. - Use "-e TARANTOOL_USER_PASSWORD=password" - to set it in "docker run". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name == 'guest' and user_password == nil then - local warn_str = [[**************************************************** -WARNING: 'guest' is chosen as primary user. - Since it is not allowed to set a password for - guest user, your instance will be accessible - by anyone having direct access to the Tarantool - port. - If you wanted to create an authenticated user, - specify "-e TARANTOOL_USER_NAME=username" and - pick a user name other than "guest". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name == 'guest' and user_password ~= nil then - user_password = nil - - local warn_str = [[**************************************************** -WARNING: A password for guest user has been specified. - In Tarantool, guest user can't have a password - and is always allowed to login, if it has - enough privileges. - If you wanted to create an authenticated user, - specify "-e TARANTOOL_USER_NAME=username" and - pick a user name other than "guest". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name ~= 'admin' and user_name ~= 'guest' then - if not box.schema.user.exists(user_name) then - log.info("Creating user '%s'", user_name) - box.schema.user.create(user_name) - end - end - - if user_name ~= 'admin' then - log.info("Granting admin privileges to user '%s'", user_name) - box.schema.user.grant(user_name, 'read,write,execute', - 'universe', nil, {if_not_exists = true}) - box.schema.user.grant(user_name, 'replication', - nil, nil, {if_not_exists = true}) - end - - if user_name ~= 'guest' then - log.info("Setting password for user '%s'", user_name) - box.schema.user.passwd(user_name, user_password) - end -end - -function set_credentials(user_name, user_password) - create_user(user_name, user_password) -end - -local function wrapper_cfg(override) - local work_dir = '/var/lib/tarantool' - local snap_filename = "*.snap" - local snap_path = work_dir..'/'..snap_filename - - local first_run = false - if next(fio.glob(snap_path)) == nil then - first_run = true - end - - - local file_cfg = {} - local config_file_exists = fio.stat(CFG_FILE_PATH) ~= nil - if not config_file_exists then - log.info("Creating configuration file: " .. CFG_FILE_PATH) - - file_cfg.TARANTOOL_USER_NAME = os.getenv('TARANTOOL_USER_NAME') - file_cfg.TARANTOOL_USER_PASSWORD = os.getenv('TARANTOOL_USER_PASSWORD') - file_cfg.TARANTOOL_SLAB_ALLOC_ARENA = os.getenv('TARANTOOL_SLAB_ALLOC_ARENA') - file_cfg.TARANTOOL_SLAB_ALLOC_FACTOR = os.getenv('TARANTOOL_SLAB_ALLOC_FACTOR') - file_cfg.TARANTOOL_SLAB_ALLOC_MINIMAL = os.getenv('TARANTOOL_SLAB_ALLOC_MINIMAL') - file_cfg.TARANTOOL_SLAB_ALLOC_MAXIMAL = os.getenv('TARANTOOL_SLAB_ALLOC_MAXIMAL') - file_cfg.TARANTOOL_PORT = os.getenv('TARANTOOL_PORT') - file_cfg.TARANTOOL_WAL_MODE = os.getenv('TARANTOOL_WAL_MODE') - file_cfg.TARANTOOL_REPLICATION_SOURCE = os.getenv('TARANTOOL_REPLICATION_SOURCE') - file_cfg.TARANTOOL_REPLICATION = os.getenv('TARANTOOL_REPLICATION') - file_cfg.TARANTOOL_SNAPSHOT_PERIOD = os.getenv('TARANTOOL_SNAPSHOT_PERIOD') - file_cfg.TARANTOOL_MEMTX_MEMORY = os.getenv('TARANTOOL_MEMTX_MEMORY') - file_cfg.TARANTOOL_CHECKPOINT_INTERVAL = os.getenv('TARANTOOL_CHECKPOINT_INTERVAL') - file_cfg.TARANTOOL_MEMTX_MIN_TUPLE_SIZE = os.getenv('TARANTOOL_MEMTX_MIN_TUPLE_SIZE') - file_cfg.TARANTOOL_MEMTX_MAX_TUPLE_SIZE = os.getenv('TARANTOOL_MEMTX_MAX_TUPLE_SIZE') - - write_config(file_cfg) - else - log.info("Loading existing configuration file: " .. CFG_FILE_PATH) - - file_cfg = read_config() - end - - local user_name = file_cfg.TARANTOOL_USER_NAME or - os.getenv('TARANTOOL_USER_NAME') or 'guest' - local user_password = file_cfg.TARANTOOL_USER_PASSWORD or - os.getenv('TARANTOOL_USER_PASSWORD') - - - local cfg = override or {} - -- Placeholders for deprecated options - cfg.slab_alloc_arena = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_ARENA) or - override.slab_alloc_arena - cfg.slab_alloc_maximal = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_MAXIMAL) or - override.slab_alloc_maximal - cfg.slab_alloc_minimal = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_MINIMAL) or - override.slab_alloc_minimal - cfg.snapshot_period = tonumber(file_cfg.TARANTOOL_SNAPSHOT_PERIOD) or - override.snapshot_period - -- Replacements for deprecated options - cfg.memtx_memory = tonumber(file_cfg.TARANTOOL_MEMTX_MEMORY) or - override.memtx_memory - cfg.memtx_min_tuple_size = tonumber(file_cfg.TARANTOOL_MEMTX_MIN_TUPLE_SIZE) or - override.memtx_min_tuple_size - cfg.memtx_max_tuple_size = tonumber(file_cfg.TARANTOOL_MEMTX_MAX_TUPLE_SIZE) or - override.memtx_max_tuple_size - cfg.checkpoint_interval = tonumber(file_cfg.TARANTOOL_CHECKPOINT_INTERVAL) or - override.checkpoint_interval - -- Deprecated options with default values - local choice = choose_option('memtx_dir', 'snap_dir', override) - cfg[choice] = override[choice] or '/var/lib/tarantool' - - -- Remaining configuration - cfg.slab_alloc_factor = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_FACTOR) or - override.slab_alloc_factor - cfg.listen = tonumber(file_cfg.TARANTOOL_PORT) or - override.listen or TARANTOOL_DEFAULT_PORT - cfg.wal_mode = file_cfg.TARANTOOL_WAL_MODE or - override.wal_mode - - cfg.wal_dir = override.wal_dir or '/var/lib/tarantool' - cfg.vinyl_dir = override.vinyl_dir or '/var/lib/tarantool' - cfg.pid_file = override.pid_file or '/var/run/tarantool/tarantool.pid' - - local choice = choose_option('TARANTOOL_REPLICATION', 'TARANTOOL_REPLICATION_SOURCE', file_cfg) - local replication_source_table = parse_replication_source(file_cfg[choice], - user_name, - user_password) - - if replication_source_table then - cfg.replication = replication_source_table - else - local choice = choose_option('replication', 'replication_source', override) - cfg[choice] = override[choice] - end - - log.info("Config:\n" .. yaml.encode(cfg)) - - orig_cfg(cfg) - - box.once('tarantool-entrypoint', function () - if first_run then - log.info("Initializing database") - - create_user(user_name, user_password) - end - end) - - console.listen(CONSOLE_SOCKET_PATH) - -end - -box.cfg = wrapper_cfg - --- re-run the script passed as parameter with all arguments that follow -execute_script = arg[1] -if execute_script == nil then - box.cfg {} - - if term.isatty(io.stdout) then - console.start() - os.exit(0) - end -else - narg = 0 - while true do - arg[narg] = arg[narg + 1] - if arg[narg] == nil then - break - end - narg = narg + 1 - end - - dofile(execute_script) -end diff --git a/1.9/tarantool.default b/1.9/tarantool.default deleted file mode 100644 index fffe3b0..0000000 --- a/1.9/tarantool.default +++ /dev/null @@ -1,22 +0,0 @@ --- --- System-wide settings for tarantoolctl and init scripts --- --- This file is meant to enable the usage of tarantoolctl inside --- docker containers. Since there is no init system, most of its --- functionality will not work, except 'tarantoolctl enter' or --- 'tarantoolctl status'. --- - -default_cfg = { - pid_file = "/var/run/tarantool", -- /var/run/tarantool/${INSTANCE}.pid - wal_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE}/ - snap_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE} - vinyl_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE} - logger = "/var/log/tarantool", -- /var/log/tarantool/${INSTANCE}.log - username = "tarantool", -} - --- instances.available - all available instances --- instances.enabled - instances to autostart by sysvinit -instance_dir = "/usr/local/etc/tarantool/instances.enabled" --- vim: set ft=lua : diff --git a/1.9/tarantool_is_up b/1.9/tarantool_is_up deleted file mode 100755 index 71148d5..0000000 --- a/1.9/tarantool_is_up +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -status=$( (tarantool <<-'EOF' -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local console = require('console') -local os = require("os") -local yaml = require("yaml") - -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - os.exit(1) - end - - cmd = 'box.info.status' - local res = self:eval(cmd) - if res ~= nil then - res = yaml.decode(res) - print(res[1]) - end - - os.exit(0) -end) - -console.on_client_disconnect(function(self) self.running = false end) -console.start() - -os.exit(0) -EOF -) 2>/dev/null) - - -echo "$status" - -if [ "$status" = "running" ]; then - exit 0 -else - exit 1 -fi diff --git a/1.9/tarantool_set_config.lua b/1.9/tarantool_set_config.lua deleted file mode 100755 index ddca36c..0000000 --- a/1.9/tarantool_set_config.lua +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env tarantool - -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local CFG_FILE_PATH = '/etc/tarantool/config.yml' - -local fio = require('fio') -local yaml = require('yaml') -local console = require('console') -local errno = require('errno') - -local function read_config() - local f = io.open(CFG_FILE_PATH, "rb") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = f:read("*all") - f:close() - return yaml.decode(content) -end - -local function write_config(cfg) - local f = io.open(CFG_FILE_PATH, "w+") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = yaml.encode(cfg) - f:write(content) - f:close() -end - -local function nop(console, cfg, value) -end - -local function update_replication_source(console, cfg, value) - local user_name = "nil" - if cfg['TARANTOOL_USER_NAME'] then - user_name = "'" .. cfg['TARANTOOL_USER_NAME'] .. "'" - end - - local user_password = "nil" - if cfg['TARANTOOL_USER_PASSWORD'] then - user_password = "'" .. cfg['TARANTOOL_USER_PASSWORD'] .. "'" - end - - local cmd = "set_replication_source('"..value.."', " .. user_name .. "," .. user_password .. ")" - print("cmd: ", cmd) - - local res = console:eval(cmd) - - if res ~= nil then - print(res) - end -end - -local function update_credentials(console, cfg, value) - local user_name = "nil" - if cfg['TARANTOOL_USER_NAME'] then - user_name = "'" .. cfg['TARANTOOL_USER_NAME'] .. "'" - end - - local user_password = "nil" - if cfg['TARANTOOL_USER_PASSWORD'] then - user_password = "'" .. cfg['TARANTOOL_USER_PASSWORD'] .. "'" - end - - local cmd = "set_credentials(" .. user_name .. "," .. user_password .. ")" - - local res = console:eval(cmd) - - if res ~= nil then - print(res) - end - - local replication_source = cfg['TARANTOOL_REPLICATION_SOURCE'] - - if replication_source ~= nil then - update_replication_source(console, cfg, replication_source) - end -end - - -local vars = { - TARANTOOL_SLAB_ALLOC_ARENA=nop, - TARANTOOL_SLAB_ALLOC_FACTOR=nop, - TARANTOOL_SLAB_ALLOC_MAXIMAL=nop, - TARANTOOL_SLAB_ALLOC_MINIMAL=nop, - TARANTOOL_PORT=nop, - TARANTOOL_WAL_MODE=nop, - TARANTOOL_USER_NAME=update_credentials, - TARANTOOL_USER_PASSWORD=update_credentials, - TARANTOOL_REPLICATION_SOURCE=update_replication_source, - TARANTOOL_REPLICATION=update_replication_source, -} - -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - os.exit(1) - end - - if arg[1] == nil or arg[2] == nil then - self:print("Usage: " .. arg[0] .. " ") - os.exit(1) - end - - if vars[arg[1]] == nil then - self:print("Unknown var: " .. arg[1]) - os.exit(1) - end - - local cfg = read_config() - cfg[arg[1]] = arg[2] - - local func = vars[arg[1]] - func(self, cfg, arg[2]) - - write_config(cfg) - - self.running = false - os.exit(0) -end) - -console.on_client_disconnect(function(self) self.running = false end) -console.start() - -os.exit(0) diff --git a/1.x-centos7/.dockerignore b/1.x-centos7/.dockerignore deleted file mode 100644 index e69de29..0000000 diff --git a/1.x-centos7/console b/1.x-centos7/console deleted file mode 100755 index d6fb192..0000000 --- a/1.x-centos7/console +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env tarantool - -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' - -console = require('console') -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - self.running = false - end -end) -console.on_client_disconnect(function(self) self.running = false end) -console.start() diff --git a/1.x-centos7/tarantool-entrypoint.lua b/1.x-centos7/tarantool-entrypoint.lua deleted file mode 100755 index ffbf2fc..0000000 --- a/1.x-centos7/tarantool-entrypoint.lua +++ /dev/null @@ -1,292 +0,0 @@ -#!/usr/bin/env tarantool - -local fio = require('fio') -local errno = require('errno') -local fun = require('fun') -local urilib = require('uri') -local console = require('console') -local term = require('term') -local log = require('log') -local yaml = require('yaml') - -local TARANTOOL_DEFAULT_PORT = 3301 -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local CFG_FILE_PATH = '/etc/tarantool/config.yml' - - -local orig_cfg = box.cfg - -local function read_config() - local f = io.open(CFG_FILE_PATH, "rb") - if f == nil then - log.error("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = f:read("*all") - f:close() - return yaml.decode(content) -end - -local function write_config(cfg) - local f = io.open(CFG_FILE_PATH, "w+") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = yaml.encode(cfg) - f:write(content) - f:close() -end - -local function parse_replication_source(replication_source, user_name, user_password) - if replication_source == nil then - return nil - end - - local replication_source_table = {} - for uri in string.gmatch(replication_source, "[^,]+") do - local parsed_uri = urilib.parse(uri) - if parsed_uri == nil then - error("Incorrect replication source URI format: '"..uri.."'") - end - local host = parsed_uri.host - local port = parsed_uri.service or TARANTOOL_DEFAULT_PORT - local user = parsed_uri.login or user_name - local password = parsed_uri.password or user_password - - if user == 'guest' or user == nil then - replication_source = string.format("%s:%s", host, port) - elseif password == nil then - replication_source = string.format("%s:@%s:%s", user, host, port) - else - replication_source = string.format("%s:%s@%s:%s", user, password, - host, port) - end - - table.insert(replication_source_table, replication_source) - end - - return replication_source_table -end - -local function choose_option(main, substitute, cfg) - if cfg[main] then - return main - end - if cfg[substitute] then - return substitute - end - return main -end - -function set_replication_source(replication_source, user_name, user_password) - local replication_source_table = parse_replication_source( - replication_source, user_name, user_password - ) - local choice = choose_option('replication', 'replication_source', box.cfg) - box.cfg{[choice] = replication_source_table} - log.info("Updated box.cfg.%s to %s", choice, replication_source) -end - -local function create_user(user_name, user_password) - if user_name ~= 'guest' and user_password == nil then - user_password = "" - - local warn_str = [[**************************************************** -WARNING: No password has been set for the database. - This will allow anyone with access to the - Tarantool port to access your database. In - Docker's default configuration, this is - effectively any other container on the same - system. - Use "-e TARANTOOL_USER_PASSWORD=password" - to set it in "docker run". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name == 'guest' and user_password == nil then - local warn_str = [[**************************************************** -WARNING: 'guest' is chosen as primary user. - Since it is not allowed to set a password for - guest user, your instance will be accessible - by anyone having direct access to the Tarantool - port. - If you wanted to create an authenticated user, - specify "-e TARANTOOL_USER_NAME=username" and - pick a user name other than "guest". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name == 'guest' and user_password ~= nil then - user_password = nil - - local warn_str = [[**************************************************** -WARNING: A password for guest user has been specified. - In Tarantool, guest user can't have a password - and is always allowed to login, if it has - enough privileges. - If you wanted to create an authenticated user, - specify "-e TARANTOOL_USER_NAME=username" and - pick a user name other than "guest". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name ~= 'admin' and user_name ~= 'guest' then - if not box.schema.user.exists(user_name) then - log.info("Creating user '%s'", user_name) - box.schema.user.create(user_name) - end - end - - if user_name ~= 'admin' then - log.info("Granting admin privileges to user '%s'", user_name) - box.schema.user.grant(user_name, 'read,write,execute,create,drop', - 'universe', nil, {if_not_exists = true}) - box.schema.user.grant(user_name, 'replication', - nil, nil, {if_not_exists = true}) - end - - if user_name ~= 'guest' then - log.info("Setting password for user '%s'", user_name) - box.schema.user.passwd(user_name, user_password) - end -end - -function set_credentials(user_name, user_password) - create_user(user_name, user_password) -end - -local function wrapper_cfg(override) - local work_dir = '/var/lib/tarantool' - local snap_filename = "*.snap" - local snap_path = work_dir..'/'..snap_filename - - local first_run = false - if next(fio.glob(snap_path)) == nil then - first_run = true - end - - - local file_cfg = {} - local config_file_exists = fio.stat(CFG_FILE_PATH) ~= nil - if not config_file_exists then - log.info("Creating configuration file: " .. CFG_FILE_PATH) - - file_cfg.TARANTOOL_USER_NAME = os.getenv('TARANTOOL_USER_NAME') - file_cfg.TARANTOOL_USER_PASSWORD = os.getenv('TARANTOOL_USER_PASSWORD') - file_cfg.TARANTOOL_SLAB_ALLOC_ARENA = os.getenv('TARANTOOL_SLAB_ALLOC_ARENA') - file_cfg.TARANTOOL_SLAB_ALLOC_FACTOR = os.getenv('TARANTOOL_SLAB_ALLOC_FACTOR') - file_cfg.TARANTOOL_SLAB_ALLOC_MINIMAL = os.getenv('TARANTOOL_SLAB_ALLOC_MINIMAL') - file_cfg.TARANTOOL_SLAB_ALLOC_MAXIMAL = os.getenv('TARANTOOL_SLAB_ALLOC_MAXIMAL') - file_cfg.TARANTOOL_PORT = os.getenv('TARANTOOL_PORT') - file_cfg.TARANTOOL_WAL_MODE = os.getenv('TARANTOOL_WAL_MODE') - file_cfg.TARANTOOL_REPLICATION_SOURCE = os.getenv('TARANTOOL_REPLICATION_SOURCE') - file_cfg.TARANTOOL_REPLICATION = os.getenv('TARANTOOL_REPLICATION') - file_cfg.TARANTOOL_SNAPSHOT_PERIOD = os.getenv('TARANTOOL_SNAPSHOT_PERIOD') - file_cfg.TARANTOOL_MEMTX_MEMORY = os.getenv('TARANTOOL_MEMTX_MEMORY') - file_cfg.TARANTOOL_CHECKPOINT_INTERVAL = os.getenv('TARANTOOL_CHECKPOINT_INTERVAL') - file_cfg.TARANTOOL_MEMTX_MIN_TUPLE_SIZE = os.getenv('TARANTOOL_MEMTX_MIN_TUPLE_SIZE') - file_cfg.TARANTOOL_MEMTX_MAX_TUPLE_SIZE = os.getenv('TARANTOOL_MEMTX_MAX_TUPLE_SIZE') - - write_config(file_cfg) - else - log.info("Loading existing configuration file: " .. CFG_FILE_PATH) - - file_cfg = read_config() - end - - local user_name = file_cfg.TARANTOOL_USER_NAME or - os.getenv('TARANTOOL_USER_NAME') or 'guest' - local user_password = file_cfg.TARANTOOL_USER_PASSWORD or - os.getenv('TARANTOOL_USER_PASSWORD') - - - local cfg = override or {} - -- Placeholders for deprecated options - cfg.slab_alloc_arena = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_ARENA) or - override.slab_alloc_arena - cfg.slab_alloc_maximal = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_MAXIMAL) or - override.slab_alloc_maximal - cfg.slab_alloc_minimal = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_MINIMAL) or - override.slab_alloc_minimal - cfg.snapshot_period = tonumber(file_cfg.TARANTOOL_SNAPSHOT_PERIOD) or - override.snapshot_period - -- Replacements for deprecated options - cfg.memtx_memory = tonumber(file_cfg.TARANTOOL_MEMTX_MEMORY) or - override.memtx_memory - cfg.memtx_min_tuple_size = tonumber(file_cfg.TARANTOOL_MEMTX_MIN_TUPLE_SIZE) or - override.memtx_min_tuple_size - cfg.memtx_max_tuple_size = tonumber(file_cfg.TARANTOOL_MEMTX_MAX_TUPLE_SIZE) or - override.memtx_max_tuple_size - cfg.checkpoint_interval = tonumber(file_cfg.TARANTOOL_CHECKPOINT_INTERVAL) or - override.checkpoint_interval - -- Deprecated options with default values - local choice = choose_option('memtx_dir', 'snap_dir', override) - cfg[choice] = override[choice] or '/var/lib/tarantool' - - -- Remaining configuration - cfg.slab_alloc_factor = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_FACTOR) or - override.slab_alloc_factor - cfg.listen = tonumber(file_cfg.TARANTOOL_PORT) or - override.listen or TARANTOOL_DEFAULT_PORT - cfg.wal_mode = file_cfg.TARANTOOL_WAL_MODE or - override.wal_mode - - cfg.wal_dir = override.wal_dir or '/var/lib/tarantool' - cfg.vinyl_dir = override.vinyl_dir or '/var/lib/tarantool' - cfg.pid_file = override.pid_file or '/var/run/tarantool/tarantool.pid' - - local choice = choose_option('TARANTOOL_REPLICATION', 'TARANTOOL_REPLICATION_SOURCE', file_cfg) - local replication_source_table = parse_replication_source(file_cfg[choice], - user_name, - user_password) - - if replication_source_table then - cfg.replication = replication_source_table - else - local choice = choose_option('replication', 'replication_source', override) - cfg[choice] = override[choice] - end - - log.info("Config:\n" .. yaml.encode(cfg)) - - orig_cfg(cfg) - - box.once('tarantool-entrypoint', function () - if first_run then - log.info("Initializing database") - - create_user(user_name, user_password) - end - end) - - console.listen(CONSOLE_SOCKET_PATH) - -end - -box.cfg = wrapper_cfg - --- re-run the script passed as parameter with all arguments that follow -execute_script = arg[1] -if execute_script == nil then - box.cfg {} - - if term.isatty(io.stdout) then - console.start() - os.exit(0) - end -else - narg = 0 - while true do - arg[narg] = arg[narg + 1] - if arg[narg] == nil then - break - end - narg = narg + 1 - end - - dofile(execute_script) -end diff --git a/1.x-centos7/tarantool.default b/1.x-centos7/tarantool.default deleted file mode 100644 index fffe3b0..0000000 --- a/1.x-centos7/tarantool.default +++ /dev/null @@ -1,22 +0,0 @@ --- --- System-wide settings for tarantoolctl and init scripts --- --- This file is meant to enable the usage of tarantoolctl inside --- docker containers. Since there is no init system, most of its --- functionality will not work, except 'tarantoolctl enter' or --- 'tarantoolctl status'. --- - -default_cfg = { - pid_file = "/var/run/tarantool", -- /var/run/tarantool/${INSTANCE}.pid - wal_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE}/ - snap_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE} - vinyl_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE} - logger = "/var/log/tarantool", -- /var/log/tarantool/${INSTANCE}.log - username = "tarantool", -} - --- instances.available - all available instances --- instances.enabled - instances to autostart by sysvinit -instance_dir = "/usr/local/etc/tarantool/instances.enabled" --- vim: set ft=lua : diff --git a/1.x-centos7/tarantool_is_up b/1.x-centos7/tarantool_is_up deleted file mode 100755 index 71148d5..0000000 --- a/1.x-centos7/tarantool_is_up +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -status=$( (tarantool <<-'EOF' -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local console = require('console') -local os = require("os") -local yaml = require("yaml") - -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - os.exit(1) - end - - cmd = 'box.info.status' - local res = self:eval(cmd) - if res ~= nil then - res = yaml.decode(res) - print(res[1]) - end - - os.exit(0) -end) - -console.on_client_disconnect(function(self) self.running = false end) -console.start() - -os.exit(0) -EOF -) 2>/dev/null) - - -echo "$status" - -if [ "$status" = "running" ]; then - exit 0 -else - exit 1 -fi diff --git a/1.x-centos7/tarantool_set_config.lua b/1.x-centos7/tarantool_set_config.lua deleted file mode 100755 index ddca36c..0000000 --- a/1.x-centos7/tarantool_set_config.lua +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env tarantool - -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local CFG_FILE_PATH = '/etc/tarantool/config.yml' - -local fio = require('fio') -local yaml = require('yaml') -local console = require('console') -local errno = require('errno') - -local function read_config() - local f = io.open(CFG_FILE_PATH, "rb") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = f:read("*all") - f:close() - return yaml.decode(content) -end - -local function write_config(cfg) - local f = io.open(CFG_FILE_PATH, "w+") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = yaml.encode(cfg) - f:write(content) - f:close() -end - -local function nop(console, cfg, value) -end - -local function update_replication_source(console, cfg, value) - local user_name = "nil" - if cfg['TARANTOOL_USER_NAME'] then - user_name = "'" .. cfg['TARANTOOL_USER_NAME'] .. "'" - end - - local user_password = "nil" - if cfg['TARANTOOL_USER_PASSWORD'] then - user_password = "'" .. cfg['TARANTOOL_USER_PASSWORD'] .. "'" - end - - local cmd = "set_replication_source('"..value.."', " .. user_name .. "," .. user_password .. ")" - print("cmd: ", cmd) - - local res = console:eval(cmd) - - if res ~= nil then - print(res) - end -end - -local function update_credentials(console, cfg, value) - local user_name = "nil" - if cfg['TARANTOOL_USER_NAME'] then - user_name = "'" .. cfg['TARANTOOL_USER_NAME'] .. "'" - end - - local user_password = "nil" - if cfg['TARANTOOL_USER_PASSWORD'] then - user_password = "'" .. cfg['TARANTOOL_USER_PASSWORD'] .. "'" - end - - local cmd = "set_credentials(" .. user_name .. "," .. user_password .. ")" - - local res = console:eval(cmd) - - if res ~= nil then - print(res) - end - - local replication_source = cfg['TARANTOOL_REPLICATION_SOURCE'] - - if replication_source ~= nil then - update_replication_source(console, cfg, replication_source) - end -end - - -local vars = { - TARANTOOL_SLAB_ALLOC_ARENA=nop, - TARANTOOL_SLAB_ALLOC_FACTOR=nop, - TARANTOOL_SLAB_ALLOC_MAXIMAL=nop, - TARANTOOL_SLAB_ALLOC_MINIMAL=nop, - TARANTOOL_PORT=nop, - TARANTOOL_WAL_MODE=nop, - TARANTOOL_USER_NAME=update_credentials, - TARANTOOL_USER_PASSWORD=update_credentials, - TARANTOOL_REPLICATION_SOURCE=update_replication_source, - TARANTOOL_REPLICATION=update_replication_source, -} - -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - os.exit(1) - end - - if arg[1] == nil or arg[2] == nil then - self:print("Usage: " .. arg[0] .. " ") - os.exit(1) - end - - if vars[arg[1]] == nil then - self:print("Unknown var: " .. arg[1]) - os.exit(1) - end - - local cfg = read_config() - cfg[arg[1]] = arg[2] - - local func = vars[arg[1]] - func(self, cfg, arg[2]) - - write_config(cfg) - - self.running = false - os.exit(0) -end) - -console.on_client_disconnect(function(self) self.running = false end) -console.start() - -os.exit(0) diff --git a/1.x/console b/1.x/console deleted file mode 100755 index d6fb192..0000000 --- a/1.x/console +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env tarantool - -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' - -console = require('console') -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - self.running = false - end -end) -console.on_client_disconnect(function(self) self.running = false end) -console.start() diff --git a/1.x/docker-entrypoint.sh b/1.x/docker-entrypoint.sh deleted file mode 100755 index 3a9f5e4..0000000 --- a/1.x/docker-entrypoint.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -# or first arg is `something.conf` -if [ "${1:0:1}" = '-' ]; then - set -- tarantool "$@" -fi - -# allow the container to be started with `--user` -if [ "$1" = 'tarantool' -a "$(id -u)" = '0' ]; then - chown -R tarantool /var/lib/tarantool - exec su-exec tarantool "$0" "$@" -fi - -# entry point wraps the passed script to do basic setup -if [ "$1" = 'tarantool' ]; then - shift - exec tarantool "/usr/local/bin/tarantool-entrypoint.lua" "$@" -fi - -exec "$@" diff --git a/1.x/gperftools_alpine.diff b/1.x/gperftools_alpine.diff deleted file mode 100644 index e768381..0000000 --- a/1.x/gperftools_alpine.diff +++ /dev/null @@ -1,110 +0,0 @@ -diff --git a/src/base/linux_syscall_support.h b/src/base/linux_syscall_support.h -index 5d578cd..fceebe2 100644 ---- a/src/base/linux_syscall_support.h -+++ b/src/base/linux_syscall_support.h -@@ -2432,9 +2432,9 @@ struct kernel_stat { - #if defined(__s390x__) - LSS_INLINE _syscall1(void*, mmap, void*, a) - #else -- /* Need to make sure __off64_t isn't truncated to 32-bits under x32. */ -+ /* Need to make sure off64_t isn't truncated to 32-bits under x32. */ - LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d, -- __off64_t o) { -+ off64_t o) { - LSS_BODY(6, void*, mmap, LSS_SYSCALL_ARG(s), LSS_SYSCALL_ARG(l), - LSS_SYSCALL_ARG(p), LSS_SYSCALL_ARG(f), - LSS_SYSCALL_ARG(d), (uint64_t)(o)); -@@ -2475,7 +2475,7 @@ struct kernel_stat { - LSS_INLINE _syscall6(void*, mmap, void*, s, - size_t, l, int, p, - int, f, int, d, -- __off64_t, o) -+ off64_t, o) - LSS_INLINE int LSS_NAME(sigaction)(int signum, - const struct kernel_sigaction *act, - struct kernel_sigaction *oldact) { -diff --git a/src/malloc_hook_mmap_linux.h b/src/malloc_hook_mmap_linux.h -index 1c4c766..b2aa8ed 100755 ---- a/src/malloc_hook_mmap_linux.h -+++ b/src/malloc_hook_mmap_linux.h -@@ -56,7 +56,7 @@ - - static inline void* do_mmap64(void *start, size_t length, - int prot, int flags, -- int fd, __off64_t offset) __THROW { -+ int fd, off64_t offset) __THROW { - return sys_mmap(start, length, prot, flags, fd, offset); - } - -@@ -67,7 +67,7 @@ static inline void* do_mmap64(void *start, size_t length, - - static inline void* do_mmap64(void *start, size_t length, - int prot, int flags, -- int fd, __off64_t offset) __THROW { -+ int fd, off64_t offset) __THROW { - void *result; - - // Try mmap2() unless it's not supported -@@ -151,9 +151,11 @@ static inline void* do_mmap64(void *start, size_t length, - # undef mmap - - extern "C" { -+ #ifndef mmap64 - void* mmap64(void *start, size_t length, int prot, int flags, -- int fd, __off64_t offset ) __THROW -+ int fd, off64_t offset ) __THROW - ATTRIBUTE_SECTION(malloc_hook); -+ #endif - void* mmap(void *start, size_t length,int prot, int flags, - int fd, off_t offset) __THROW - ATTRIBUTE_SECTION(malloc_hook); -@@ -166,8 +168,9 @@ extern "C" { - ATTRIBUTE_SECTION(malloc_hook); - } - -+#ifndef mmap64 - extern "C" void* mmap64(void *start, size_t length, int prot, int flags, -- int fd, __off64_t offset) __THROW { -+ int fd, off64_t offset) __THROW { - MallocHook::InvokePreMmapHook(start, length, prot, flags, fd, offset); - void *result; - if (!MallocHook::InvokeMmapReplacement( -@@ -177,6 +180,7 @@ extern "C" void* mmap64(void *start, size_t length, int prot, int flags, - MallocHook::InvokeMmapHook(result, start, length, prot, flags, fd, offset); - return result; - } -+#endif - - # if !defined(__USE_FILE_OFFSET64) || !defined(__REDIRECT_NTH) - -@@ -216,7 +220,7 @@ extern "C" void* mremap(void* old_addr, size_t old_size, size_t new_size, - return result; - } - --#ifndef __UCLIBC__ -+#if defined(__GLIBC__) && ! defined(__UCLIBC__) - // libc's version: - extern "C" void* __sbrk(ptrdiff_t increment); - -diff --git a/src/tests/stacktrace_unittest.cc b/src/tests/stacktrace_unittest.cc -index 3c9f735..2d39ad9 100644 ---- a/src/tests/stacktrace_unittest.cc -+++ b/src/tests/stacktrace_unittest.cc -@@ -120,17 +120,6 @@ void ATTRIBUTE_NOINLINE CheckStackTraceLeaf(void) { - CHECK_GE(size, 1); - CHECK_LE(size, STACK_LEN); - --#ifdef HAVE_EXECINFO_H -- { -- char **strings = backtrace_symbols(stack, size); -- printf("Obtained %d stack frames.\n", size); -- for (int i = 0; i < size; i++) -- printf("%s %p\n", strings[i], stack[i]); -- printf("CheckStackTrace() addr: %p\n", &CheckStackTrace); -- free(strings); -- } --#endif -- - for (int i = 0; i < BACKTRACE_STEPS; i++) { - printf("Backtrace %d: expected: %p..%p actual: %p ... ", - i, expected_range[i].start, expected_range[i].end, stack[i]); diff --git a/1.x/luarocks-config.lua b/1.x/luarocks-config.lua deleted file mode 100644 index 111f955..0000000 --- a/1.x/luarocks-config.lua +++ /dev/null @@ -1,9 +0,0 @@ -rocks_trees = { - { name = [[user]], root = home..[[/.luarocks]] }, - { name = [[system]], root = [[/usr/local]] } -} - -rocks_servers = { - [[http://rocks.tarantool.org/]], - [[http://luarocks.org/repositories/rocks]] -} diff --git a/1.x/tarantool-entrypoint.lua b/1.x/tarantool-entrypoint.lua deleted file mode 100755 index ffbf2fc..0000000 --- a/1.x/tarantool-entrypoint.lua +++ /dev/null @@ -1,292 +0,0 @@ -#!/usr/bin/env tarantool - -local fio = require('fio') -local errno = require('errno') -local fun = require('fun') -local urilib = require('uri') -local console = require('console') -local term = require('term') -local log = require('log') -local yaml = require('yaml') - -local TARANTOOL_DEFAULT_PORT = 3301 -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local CFG_FILE_PATH = '/etc/tarantool/config.yml' - - -local orig_cfg = box.cfg - -local function read_config() - local f = io.open(CFG_FILE_PATH, "rb") - if f == nil then - log.error("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = f:read("*all") - f:close() - return yaml.decode(content) -end - -local function write_config(cfg) - local f = io.open(CFG_FILE_PATH, "w+") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = yaml.encode(cfg) - f:write(content) - f:close() -end - -local function parse_replication_source(replication_source, user_name, user_password) - if replication_source == nil then - return nil - end - - local replication_source_table = {} - for uri in string.gmatch(replication_source, "[^,]+") do - local parsed_uri = urilib.parse(uri) - if parsed_uri == nil then - error("Incorrect replication source URI format: '"..uri.."'") - end - local host = parsed_uri.host - local port = parsed_uri.service or TARANTOOL_DEFAULT_PORT - local user = parsed_uri.login or user_name - local password = parsed_uri.password or user_password - - if user == 'guest' or user == nil then - replication_source = string.format("%s:%s", host, port) - elseif password == nil then - replication_source = string.format("%s:@%s:%s", user, host, port) - else - replication_source = string.format("%s:%s@%s:%s", user, password, - host, port) - end - - table.insert(replication_source_table, replication_source) - end - - return replication_source_table -end - -local function choose_option(main, substitute, cfg) - if cfg[main] then - return main - end - if cfg[substitute] then - return substitute - end - return main -end - -function set_replication_source(replication_source, user_name, user_password) - local replication_source_table = parse_replication_source( - replication_source, user_name, user_password - ) - local choice = choose_option('replication', 'replication_source', box.cfg) - box.cfg{[choice] = replication_source_table} - log.info("Updated box.cfg.%s to %s", choice, replication_source) -end - -local function create_user(user_name, user_password) - if user_name ~= 'guest' and user_password == nil then - user_password = "" - - local warn_str = [[**************************************************** -WARNING: No password has been set for the database. - This will allow anyone with access to the - Tarantool port to access your database. In - Docker's default configuration, this is - effectively any other container on the same - system. - Use "-e TARANTOOL_USER_PASSWORD=password" - to set it in "docker run". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name == 'guest' and user_password == nil then - local warn_str = [[**************************************************** -WARNING: 'guest' is chosen as primary user. - Since it is not allowed to set a password for - guest user, your instance will be accessible - by anyone having direct access to the Tarantool - port. - If you wanted to create an authenticated user, - specify "-e TARANTOOL_USER_NAME=username" and - pick a user name other than "guest". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name == 'guest' and user_password ~= nil then - user_password = nil - - local warn_str = [[**************************************************** -WARNING: A password for guest user has been specified. - In Tarantool, guest user can't have a password - and is always allowed to login, if it has - enough privileges. - If you wanted to create an authenticated user, - specify "-e TARANTOOL_USER_NAME=username" and - pick a user name other than "guest". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name ~= 'admin' and user_name ~= 'guest' then - if not box.schema.user.exists(user_name) then - log.info("Creating user '%s'", user_name) - box.schema.user.create(user_name) - end - end - - if user_name ~= 'admin' then - log.info("Granting admin privileges to user '%s'", user_name) - box.schema.user.grant(user_name, 'read,write,execute,create,drop', - 'universe', nil, {if_not_exists = true}) - box.schema.user.grant(user_name, 'replication', - nil, nil, {if_not_exists = true}) - end - - if user_name ~= 'guest' then - log.info("Setting password for user '%s'", user_name) - box.schema.user.passwd(user_name, user_password) - end -end - -function set_credentials(user_name, user_password) - create_user(user_name, user_password) -end - -local function wrapper_cfg(override) - local work_dir = '/var/lib/tarantool' - local snap_filename = "*.snap" - local snap_path = work_dir..'/'..snap_filename - - local first_run = false - if next(fio.glob(snap_path)) == nil then - first_run = true - end - - - local file_cfg = {} - local config_file_exists = fio.stat(CFG_FILE_PATH) ~= nil - if not config_file_exists then - log.info("Creating configuration file: " .. CFG_FILE_PATH) - - file_cfg.TARANTOOL_USER_NAME = os.getenv('TARANTOOL_USER_NAME') - file_cfg.TARANTOOL_USER_PASSWORD = os.getenv('TARANTOOL_USER_PASSWORD') - file_cfg.TARANTOOL_SLAB_ALLOC_ARENA = os.getenv('TARANTOOL_SLAB_ALLOC_ARENA') - file_cfg.TARANTOOL_SLAB_ALLOC_FACTOR = os.getenv('TARANTOOL_SLAB_ALLOC_FACTOR') - file_cfg.TARANTOOL_SLAB_ALLOC_MINIMAL = os.getenv('TARANTOOL_SLAB_ALLOC_MINIMAL') - file_cfg.TARANTOOL_SLAB_ALLOC_MAXIMAL = os.getenv('TARANTOOL_SLAB_ALLOC_MAXIMAL') - file_cfg.TARANTOOL_PORT = os.getenv('TARANTOOL_PORT') - file_cfg.TARANTOOL_WAL_MODE = os.getenv('TARANTOOL_WAL_MODE') - file_cfg.TARANTOOL_REPLICATION_SOURCE = os.getenv('TARANTOOL_REPLICATION_SOURCE') - file_cfg.TARANTOOL_REPLICATION = os.getenv('TARANTOOL_REPLICATION') - file_cfg.TARANTOOL_SNAPSHOT_PERIOD = os.getenv('TARANTOOL_SNAPSHOT_PERIOD') - file_cfg.TARANTOOL_MEMTX_MEMORY = os.getenv('TARANTOOL_MEMTX_MEMORY') - file_cfg.TARANTOOL_CHECKPOINT_INTERVAL = os.getenv('TARANTOOL_CHECKPOINT_INTERVAL') - file_cfg.TARANTOOL_MEMTX_MIN_TUPLE_SIZE = os.getenv('TARANTOOL_MEMTX_MIN_TUPLE_SIZE') - file_cfg.TARANTOOL_MEMTX_MAX_TUPLE_SIZE = os.getenv('TARANTOOL_MEMTX_MAX_TUPLE_SIZE') - - write_config(file_cfg) - else - log.info("Loading existing configuration file: " .. CFG_FILE_PATH) - - file_cfg = read_config() - end - - local user_name = file_cfg.TARANTOOL_USER_NAME or - os.getenv('TARANTOOL_USER_NAME') or 'guest' - local user_password = file_cfg.TARANTOOL_USER_PASSWORD or - os.getenv('TARANTOOL_USER_PASSWORD') - - - local cfg = override or {} - -- Placeholders for deprecated options - cfg.slab_alloc_arena = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_ARENA) or - override.slab_alloc_arena - cfg.slab_alloc_maximal = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_MAXIMAL) or - override.slab_alloc_maximal - cfg.slab_alloc_minimal = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_MINIMAL) or - override.slab_alloc_minimal - cfg.snapshot_period = tonumber(file_cfg.TARANTOOL_SNAPSHOT_PERIOD) or - override.snapshot_period - -- Replacements for deprecated options - cfg.memtx_memory = tonumber(file_cfg.TARANTOOL_MEMTX_MEMORY) or - override.memtx_memory - cfg.memtx_min_tuple_size = tonumber(file_cfg.TARANTOOL_MEMTX_MIN_TUPLE_SIZE) or - override.memtx_min_tuple_size - cfg.memtx_max_tuple_size = tonumber(file_cfg.TARANTOOL_MEMTX_MAX_TUPLE_SIZE) or - override.memtx_max_tuple_size - cfg.checkpoint_interval = tonumber(file_cfg.TARANTOOL_CHECKPOINT_INTERVAL) or - override.checkpoint_interval - -- Deprecated options with default values - local choice = choose_option('memtx_dir', 'snap_dir', override) - cfg[choice] = override[choice] or '/var/lib/tarantool' - - -- Remaining configuration - cfg.slab_alloc_factor = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_FACTOR) or - override.slab_alloc_factor - cfg.listen = tonumber(file_cfg.TARANTOOL_PORT) or - override.listen or TARANTOOL_DEFAULT_PORT - cfg.wal_mode = file_cfg.TARANTOOL_WAL_MODE or - override.wal_mode - - cfg.wal_dir = override.wal_dir or '/var/lib/tarantool' - cfg.vinyl_dir = override.vinyl_dir or '/var/lib/tarantool' - cfg.pid_file = override.pid_file or '/var/run/tarantool/tarantool.pid' - - local choice = choose_option('TARANTOOL_REPLICATION', 'TARANTOOL_REPLICATION_SOURCE', file_cfg) - local replication_source_table = parse_replication_source(file_cfg[choice], - user_name, - user_password) - - if replication_source_table then - cfg.replication = replication_source_table - else - local choice = choose_option('replication', 'replication_source', override) - cfg[choice] = override[choice] - end - - log.info("Config:\n" .. yaml.encode(cfg)) - - orig_cfg(cfg) - - box.once('tarantool-entrypoint', function () - if first_run then - log.info("Initializing database") - - create_user(user_name, user_password) - end - end) - - console.listen(CONSOLE_SOCKET_PATH) - -end - -box.cfg = wrapper_cfg - --- re-run the script passed as parameter with all arguments that follow -execute_script = arg[1] -if execute_script == nil then - box.cfg {} - - if term.isatty(io.stdout) then - console.start() - os.exit(0) - end -else - narg = 0 - while true do - arg[narg] = arg[narg + 1] - if arg[narg] == nil then - break - end - narg = narg + 1 - end - - dofile(execute_script) -end diff --git a/1.x/tarantool.default b/1.x/tarantool.default deleted file mode 100644 index fffe3b0..0000000 --- a/1.x/tarantool.default +++ /dev/null @@ -1,22 +0,0 @@ --- --- System-wide settings for tarantoolctl and init scripts --- --- This file is meant to enable the usage of tarantoolctl inside --- docker containers. Since there is no init system, most of its --- functionality will not work, except 'tarantoolctl enter' or --- 'tarantoolctl status'. --- - -default_cfg = { - pid_file = "/var/run/tarantool", -- /var/run/tarantool/${INSTANCE}.pid - wal_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE}/ - snap_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE} - vinyl_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE} - logger = "/var/log/tarantool", -- /var/log/tarantool/${INSTANCE}.log - username = "tarantool", -} - --- instances.available - all available instances --- instances.enabled - instances to autostart by sysvinit -instance_dir = "/usr/local/etc/tarantool/instances.enabled" --- vim: set ft=lua : diff --git a/1.x/tarantool_is_up b/1.x/tarantool_is_up deleted file mode 100755 index 71148d5..0000000 --- a/1.x/tarantool_is_up +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -status=$( (tarantool <<-'EOF' -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local console = require('console') -local os = require("os") -local yaml = require("yaml") - -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - os.exit(1) - end - - cmd = 'box.info.status' - local res = self:eval(cmd) - if res ~= nil then - res = yaml.decode(res) - print(res[1]) - end - - os.exit(0) -end) - -console.on_client_disconnect(function(self) self.running = false end) -console.start() - -os.exit(0) -EOF -) 2>/dev/null) - - -echo "$status" - -if [ "$status" = "running" ]; then - exit 0 -else - exit 1 -fi diff --git a/1.x/tarantool_set_config.lua b/1.x/tarantool_set_config.lua deleted file mode 100755 index ddca36c..0000000 --- a/1.x/tarantool_set_config.lua +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env tarantool - -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local CFG_FILE_PATH = '/etc/tarantool/config.yml' - -local fio = require('fio') -local yaml = require('yaml') -local console = require('console') -local errno = require('errno') - -local function read_config() - local f = io.open(CFG_FILE_PATH, "rb") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = f:read("*all") - f:close() - return yaml.decode(content) -end - -local function write_config(cfg) - local f = io.open(CFG_FILE_PATH, "w+") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = yaml.encode(cfg) - f:write(content) - f:close() -end - -local function nop(console, cfg, value) -end - -local function update_replication_source(console, cfg, value) - local user_name = "nil" - if cfg['TARANTOOL_USER_NAME'] then - user_name = "'" .. cfg['TARANTOOL_USER_NAME'] .. "'" - end - - local user_password = "nil" - if cfg['TARANTOOL_USER_PASSWORD'] then - user_password = "'" .. cfg['TARANTOOL_USER_PASSWORD'] .. "'" - end - - local cmd = "set_replication_source('"..value.."', " .. user_name .. "," .. user_password .. ")" - print("cmd: ", cmd) - - local res = console:eval(cmd) - - if res ~= nil then - print(res) - end -end - -local function update_credentials(console, cfg, value) - local user_name = "nil" - if cfg['TARANTOOL_USER_NAME'] then - user_name = "'" .. cfg['TARANTOOL_USER_NAME'] .. "'" - end - - local user_password = "nil" - if cfg['TARANTOOL_USER_PASSWORD'] then - user_password = "'" .. cfg['TARANTOOL_USER_PASSWORD'] .. "'" - end - - local cmd = "set_credentials(" .. user_name .. "," .. user_password .. ")" - - local res = console:eval(cmd) - - if res ~= nil then - print(res) - end - - local replication_source = cfg['TARANTOOL_REPLICATION_SOURCE'] - - if replication_source ~= nil then - update_replication_source(console, cfg, replication_source) - end -end - - -local vars = { - TARANTOOL_SLAB_ALLOC_ARENA=nop, - TARANTOOL_SLAB_ALLOC_FACTOR=nop, - TARANTOOL_SLAB_ALLOC_MAXIMAL=nop, - TARANTOOL_SLAB_ALLOC_MINIMAL=nop, - TARANTOOL_PORT=nop, - TARANTOOL_WAL_MODE=nop, - TARANTOOL_USER_NAME=update_credentials, - TARANTOOL_USER_PASSWORD=update_credentials, - TARANTOOL_REPLICATION_SOURCE=update_replication_source, - TARANTOOL_REPLICATION=update_replication_source, -} - -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - os.exit(1) - end - - if arg[1] == nil or arg[2] == nil then - self:print("Usage: " .. arg[0] .. " ") - os.exit(1) - end - - if vars[arg[1]] == nil then - self:print("Unknown var: " .. arg[1]) - os.exit(1) - end - - local cfg = read_config() - cfg[arg[1]] = arg[2] - - local func = vars[arg[1]] - func(self, cfg, arg[2]) - - write_config(cfg) - - self.running = false - os.exit(0) -end) - -console.on_client_disconnect(function(self) self.running = false end) -console.start() - -os.exit(0) diff --git a/2.1/Dockerfile b/2.1/Dockerfile deleted file mode 100644 index d52cd9f..0000000 --- a/2.1/Dockerfile +++ /dev/null @@ -1,246 +0,0 @@ -FROM alpine:3.5 -MAINTAINER mail@racktear.com - -RUN addgroup -S tarantool \ - && adduser -S -G tarantool tarantool \ - && apk add --no-cache 'su-exec>=0.2' - -ENV TARANTOOL_VERSION=2.1.2-143-g3edaaed6c \ - TARANTOOL_DOWNLOAD_URL=https://github.com/tarantool/tarantool.git \ - TARANTOOL_INSTALL_LUADIR=/usr/local/share/tarantool \ - CURL_REPO=https://github.com/curl/curl.git \ - CURL_TAG=curl-7_59_0 \ - GPERFTOOLS_REPO=https://github.com/gperftools/gperftools.git \ - GPERFTOOLS_TAG=gperftools-2.5 \ - LUAROCKS_URL=https://github.com/tarantool/luarocks/archive/6e6fe62d9409fe2103c0fd091cccb3da0451faf5.tar.gz \ - LUAROCK_SHARD_REPO=https://github.com/tarantool/shard.git \ - LUAROCK_SHARD_TAG=8f8c5a7 \ - LUAROCK_AVRO_SCHEMA_VERSION=2.0.1 \ - LUAROCK_EXPERATIOND_VERSION=1.0.1 \ - LUAROCK_QUEUE_VERSION=1.0.2 \ - LUAROCK_CONNPOOL_VERSION=1.1.1 \ - LUAROCK_HTTP_VERSION=1.0.1 \ - LUAROCK_MEMCACHED_VERSION=1.0.0 \ - LUAROCK_TARANTOOL_PG_VERSION=2.0.1 \ - LUAROCK_TARANTOOL_MYSQL_VERSION=2.0.1 \ - LUAROCK_TARANTOOL_MQTT_VERSION=1.2.1 \ - LUAROCK_TARANTOOL_GIS_VERSION=1.0.0 \ - LUAROCK_TARANTOOL_PROMETHEUS_VERSION=1.0.0 \ - LUAROCK_TARANTOOL_GPERFTOOLS_VERSION=1.0.1 - -COPY gperftools_alpine.diff / - -RUN set -x \ - && apk add --no-cache --virtual .run-deps \ - libstdc++ \ - readline \ - libressl \ - yaml \ - lz4 \ - binutils \ - ncurses \ - libgomp \ - lua \ - tar \ - zip \ - libunwind \ - icu \ - ca-certificates \ - && apk add --no-cache --virtual .build-deps \ - perl \ - gcc \ - g++ \ - cmake \ - readline-dev \ - libressl-dev \ - yaml-dev \ - lz4-dev \ - binutils-dev \ - ncurses-dev \ - lua-dev \ - musl-dev \ - make \ - git \ - libunwind-dev \ - autoconf \ - automake \ - libtool \ - linux-headers \ - go \ - tcl \ - icu-dev \ - wget \ - && : "---------- curl ----------" \ - && mkdir -p /usr/src/curl \ - && git clone "$CURL_REPO" /usr/src/curl \ - && git -C /usr/src/curl checkout "$CURL_TAG" \ - && (cd /usr/src/curl \ - && ./buildconf \ - && ./configure --prefix "/usr/local" \ - && make -j \ - && make install) \ - && : "---------- gperftools ----------" \ - && mkdir -p /usr/src/gperftools \ - && git clone "$GPERFTOOLS_REPO" /usr/src/gperftools \ - && git -C /usr/src/gperftools checkout "$GPERFTOOLS_TAG" \ - && (cd /usr/src/gperftools; \ - patch -p1 < /gperftools_alpine.diff; \ - rm /gperftools_alpine.diff; \ - ./autogen.sh; \ - ./configure; \ - make; \ - cp .libs/libprofiler.so* /usr/local/lib;) \ - && (GOPATH=/usr/src/go go get github.com/google/pprof; \ - cp /usr/src/go/bin/pprof /usr/local/bin) \ - && : "---------- tarantool ----------" \ - && mkdir -p /usr/src/tarantool \ - && git clone "$TARANTOOL_DOWNLOAD_URL" /usr/src/tarantool \ - && git -C /usr/src/tarantool checkout "$TARANTOOL_VERSION" \ - && git -C /usr/src/tarantool submodule update --init --recursive \ - && (cd /usr/src/tarantool; \ - cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo\ - -DENABLE_BUNDLED_LIBYAML:BOOL=OFF\ - -DENABLE_BACKTRACE:BOOL=ON\ - -DENABLE_DIST:BOOL=ON\ - .) \ - && make -C /usr/src/tarantool -j\ - && make -C /usr/src/tarantool install \ - && make -C /usr/src/tarantool clean \ - && : "---------- small ----------" \ - && (cd /usr/src/tarantool/src/lib/small; \ - cmake -DCMAKE_INSTALL_PREFIX=/usr \ - -DCMAKE_INSTALL_LIBDIR=lib \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - .) \ - && make -C /usr/src/tarantool/src/lib/small \ - && make -C /usr/src/tarantool/src/lib/small install \ - && make -C /usr/src/tarantool/src/lib/small clean \ - && : "---------- msgpuck ----------" \ - && (cd /usr/src/tarantool/src/lib/msgpuck; \ - cmake -DCMAKE_INSTALL_PREFIX=/usr \ - -DCMAKE_INSTALL_LIBDIR=lib \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - .) \ - && make -C /usr/src/tarantool/src/lib/msgpuck \ - && make -C /usr/src/tarantool/src/lib/msgpuck install \ - && make -C /usr/src/tarantool/src/lib/msgpuck clean \ - && : "---------- luarocks ----------" \ - && wget -O luarocks.tar.gz "$LUAROCKS_URL" \ - && mkdir -p /usr/src/luarocks \ - && tar -xzf luarocks.tar.gz -C /usr/src/luarocks --strip-components=1 \ - && (cd /usr/src/luarocks; \ - ./configure; \ - make build; \ - make install) \ - && rm -r /usr/src/luarocks \ - && rm -rf /usr/src/tarantool \ - && rm -rf /usr/src/gperftools \ - && rm -rf /usr/src/go \ - && : "---------- remove build deps ----------" \ - && apk del .build-deps - -COPY luarocks-config.lua /usr/local/etc/luarocks/config-5.1.lua - -RUN set -x \ - && apk add --no-cache --virtual .run-deps \ - mariadb-client-libs \ - libpq \ - cyrus-sasl \ - mosquitto-libs \ - libev \ - && apk add --no-cache --virtual .build-deps \ - git \ - cmake \ - make \ - coreutils \ - gcc \ - g++ \ - postgresql-dev \ - lua-dev \ - musl-dev \ - cyrus-sasl-dev \ - mosquitto-dev \ - libev-dev \ - libressl-dev \ - && mkdir -p /rocks \ - && : "---------- proj (for gis module) ----------" \ - && wget -O proj.tar.gz http://download.osgeo.org/proj/proj-4.9.3.tar.gz \ - && mkdir -p /usr/src/proj \ - && tar -xzf proj.tar.gz -C /usr/src/proj --strip-components=1 \ - && (cd /usr/src/proj; \ - ./configure; \ - make; \ - make install) \ - && rm -r /usr/src/proj \ - && rm -rf /usr/src/proj \ - && : "---------- geos (for gis module) ----------" \ - && wget -O geos.tar.bz2 http://download.osgeo.org/geos/geos-3.6.0.tar.bz2 \ - && mkdir -p /usr/src/geos \ - && tar -xjf geos.tar.bz2 -C /usr/src/geos --strip-components=1 \ - && (cd /usr/src/geos; \ - ./configure; \ - make; \ - make install) \ - && rm -r /usr/src/geos \ - && rm -rf /usr/src/geos \ - && : "---------- luarocks ----------" \ - && luarocks install lua-term \ - && luarocks install ldoc \ - && : "avro" \ - && luarocks install avro-schema $LUAROCK_AVRO_SCHEMA_VERSION \ - && : "expirationd" \ - && luarocks install expirationd $LUAROCK_EXPERATIOND_VERSION \ - && : "queue" \ - && luarocks install queue $LUAROCK_QUEUE_VERSION \ - && : "connpool" \ - && luarocks install connpool $LUAROCK_CONNPOOL_VERSION \ - && : "shard" \ - && git clone $LUAROCK_SHARD_REPO /rocks/shard \ - && git -C /rocks/shard checkout $LUAROCK_SHARD_TAG \ - && (cd /rocks/shard && luarocks make *rockspec) \ - && : "http" \ - && luarocks install http $LUAROCK_HTTP_VERSION \ - && : "pg" \ - && luarocks install pg $LUAROCK_TARANTOOL_PG_VERSION \ - && : "mysql" \ - && luarocks install mysql $LUAROCK_TARANTOOL_MYSQL_VERSION \ - && : "memcached" \ - && luarocks install memcached $LUAROCK_MEMCACHED_VERSION \ - && : "prometheus" \ - && luarocks install prometheus $LUAROCK_TARANTOOL_PROMETHEUS_VERSION \ - && : "mqtt" \ - && luarocks install mqtt $LUAROCK_TARANTOOL_MQTT_VERSION \ - && : "gis" \ - && luarocks install gis $LUAROCK_TARANTOOL_GIS_VERSION \ - && : "gperftools" \ - && luarocks install gperftools $LUAROCK_TARANTOOL_GPERFTOOLS_VERSION \ - && : "---------- remove build deps ----------" \ - && apk del .build-deps \ - && rm -rf /rocks - -RUN mkdir -p /var/lib/tarantool \ - && chown tarantool:tarantool /var/lib/tarantool \ - && mkdir -p /opt/tarantool \ - && chown tarantool:tarantool /opt/tarantool \ - && mkdir -p /var/run/tarantool \ - && chown tarantool:tarantool /var/run/tarantool \ - && mkdir /etc/tarantool \ - && chown tarantool:tarantool /etc/tarantool - -VOLUME /var/lib/tarantool -WORKDIR /opt/tarantool - -COPY tarantool-entrypoint.lua /usr/local/bin/ -COPY tarantool_set_config.lua /usr/local/bin/ -COPY docker-entrypoint.sh /usr/local/bin/ -COPY console /usr/local/bin/ -COPY tarantool_is_up /usr/local/bin/ -COPY tarantool.default /usr/local/etc/default/tarantool - -RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat -ENTRYPOINT ["docker-entrypoint.sh"] - -HEALTHCHECK CMD tarantool_is_up - -EXPOSE 3301 -CMD [ "tarantool" ] diff --git a/2.1/console b/2.1/console deleted file mode 100755 index d6fb192..0000000 --- a/2.1/console +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env tarantool - -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' - -console = require('console') -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - self.running = false - end -end) -console.on_client_disconnect(function(self) self.running = false end) -console.start() diff --git a/2.1/docker-entrypoint.sh b/2.1/docker-entrypoint.sh deleted file mode 100755 index 3a9f5e4..0000000 --- a/2.1/docker-entrypoint.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -# or first arg is `something.conf` -if [ "${1:0:1}" = '-' ]; then - set -- tarantool "$@" -fi - -# allow the container to be started with `--user` -if [ "$1" = 'tarantool' -a "$(id -u)" = '0' ]; then - chown -R tarantool /var/lib/tarantool - exec su-exec tarantool "$0" "$@" -fi - -# entry point wraps the passed script to do basic setup -if [ "$1" = 'tarantool' ]; then - shift - exec tarantool "/usr/local/bin/tarantool-entrypoint.lua" "$@" -fi - -exec "$@" diff --git a/2.1/gperftools_alpine.diff b/2.1/gperftools_alpine.diff deleted file mode 100644 index e768381..0000000 --- a/2.1/gperftools_alpine.diff +++ /dev/null @@ -1,110 +0,0 @@ -diff --git a/src/base/linux_syscall_support.h b/src/base/linux_syscall_support.h -index 5d578cd..fceebe2 100644 ---- a/src/base/linux_syscall_support.h -+++ b/src/base/linux_syscall_support.h -@@ -2432,9 +2432,9 @@ struct kernel_stat { - #if defined(__s390x__) - LSS_INLINE _syscall1(void*, mmap, void*, a) - #else -- /* Need to make sure __off64_t isn't truncated to 32-bits under x32. */ -+ /* Need to make sure off64_t isn't truncated to 32-bits under x32. */ - LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d, -- __off64_t o) { -+ off64_t o) { - LSS_BODY(6, void*, mmap, LSS_SYSCALL_ARG(s), LSS_SYSCALL_ARG(l), - LSS_SYSCALL_ARG(p), LSS_SYSCALL_ARG(f), - LSS_SYSCALL_ARG(d), (uint64_t)(o)); -@@ -2475,7 +2475,7 @@ struct kernel_stat { - LSS_INLINE _syscall6(void*, mmap, void*, s, - size_t, l, int, p, - int, f, int, d, -- __off64_t, o) -+ off64_t, o) - LSS_INLINE int LSS_NAME(sigaction)(int signum, - const struct kernel_sigaction *act, - struct kernel_sigaction *oldact) { -diff --git a/src/malloc_hook_mmap_linux.h b/src/malloc_hook_mmap_linux.h -index 1c4c766..b2aa8ed 100755 ---- a/src/malloc_hook_mmap_linux.h -+++ b/src/malloc_hook_mmap_linux.h -@@ -56,7 +56,7 @@ - - static inline void* do_mmap64(void *start, size_t length, - int prot, int flags, -- int fd, __off64_t offset) __THROW { -+ int fd, off64_t offset) __THROW { - return sys_mmap(start, length, prot, flags, fd, offset); - } - -@@ -67,7 +67,7 @@ static inline void* do_mmap64(void *start, size_t length, - - static inline void* do_mmap64(void *start, size_t length, - int prot, int flags, -- int fd, __off64_t offset) __THROW { -+ int fd, off64_t offset) __THROW { - void *result; - - // Try mmap2() unless it's not supported -@@ -151,9 +151,11 @@ static inline void* do_mmap64(void *start, size_t length, - # undef mmap - - extern "C" { -+ #ifndef mmap64 - void* mmap64(void *start, size_t length, int prot, int flags, -- int fd, __off64_t offset ) __THROW -+ int fd, off64_t offset ) __THROW - ATTRIBUTE_SECTION(malloc_hook); -+ #endif - void* mmap(void *start, size_t length,int prot, int flags, - int fd, off_t offset) __THROW - ATTRIBUTE_SECTION(malloc_hook); -@@ -166,8 +168,9 @@ extern "C" { - ATTRIBUTE_SECTION(malloc_hook); - } - -+#ifndef mmap64 - extern "C" void* mmap64(void *start, size_t length, int prot, int flags, -- int fd, __off64_t offset) __THROW { -+ int fd, off64_t offset) __THROW { - MallocHook::InvokePreMmapHook(start, length, prot, flags, fd, offset); - void *result; - if (!MallocHook::InvokeMmapReplacement( -@@ -177,6 +180,7 @@ extern "C" void* mmap64(void *start, size_t length, int prot, int flags, - MallocHook::InvokeMmapHook(result, start, length, prot, flags, fd, offset); - return result; - } -+#endif - - # if !defined(__USE_FILE_OFFSET64) || !defined(__REDIRECT_NTH) - -@@ -216,7 +220,7 @@ extern "C" void* mremap(void* old_addr, size_t old_size, size_t new_size, - return result; - } - --#ifndef __UCLIBC__ -+#if defined(__GLIBC__) && ! defined(__UCLIBC__) - // libc's version: - extern "C" void* __sbrk(ptrdiff_t increment); - -diff --git a/src/tests/stacktrace_unittest.cc b/src/tests/stacktrace_unittest.cc -index 3c9f735..2d39ad9 100644 ---- a/src/tests/stacktrace_unittest.cc -+++ b/src/tests/stacktrace_unittest.cc -@@ -120,17 +120,6 @@ void ATTRIBUTE_NOINLINE CheckStackTraceLeaf(void) { - CHECK_GE(size, 1); - CHECK_LE(size, STACK_LEN); - --#ifdef HAVE_EXECINFO_H -- { -- char **strings = backtrace_symbols(stack, size); -- printf("Obtained %d stack frames.\n", size); -- for (int i = 0; i < size; i++) -- printf("%s %p\n", strings[i], stack[i]); -- printf("CheckStackTrace() addr: %p\n", &CheckStackTrace); -- free(strings); -- } --#endif -- - for (int i = 0; i < BACKTRACE_STEPS; i++) { - printf("Backtrace %d: expected: %p..%p actual: %p ... ", - i, expected_range[i].start, expected_range[i].end, stack[i]); diff --git a/2.1/luarocks-config.lua b/2.1/luarocks-config.lua deleted file mode 100644 index 111f955..0000000 --- a/2.1/luarocks-config.lua +++ /dev/null @@ -1,9 +0,0 @@ -rocks_trees = { - { name = [[user]], root = home..[[/.luarocks]] }, - { name = [[system]], root = [[/usr/local]] } -} - -rocks_servers = { - [[http://rocks.tarantool.org/]], - [[http://luarocks.org/repositories/rocks]] -} diff --git a/2.1/tarantool-entrypoint.lua b/2.1/tarantool-entrypoint.lua deleted file mode 100755 index ffbf2fc..0000000 --- a/2.1/tarantool-entrypoint.lua +++ /dev/null @@ -1,292 +0,0 @@ -#!/usr/bin/env tarantool - -local fio = require('fio') -local errno = require('errno') -local fun = require('fun') -local urilib = require('uri') -local console = require('console') -local term = require('term') -local log = require('log') -local yaml = require('yaml') - -local TARANTOOL_DEFAULT_PORT = 3301 -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local CFG_FILE_PATH = '/etc/tarantool/config.yml' - - -local orig_cfg = box.cfg - -local function read_config() - local f = io.open(CFG_FILE_PATH, "rb") - if f == nil then - log.error("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = f:read("*all") - f:close() - return yaml.decode(content) -end - -local function write_config(cfg) - local f = io.open(CFG_FILE_PATH, "w+") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = yaml.encode(cfg) - f:write(content) - f:close() -end - -local function parse_replication_source(replication_source, user_name, user_password) - if replication_source == nil then - return nil - end - - local replication_source_table = {} - for uri in string.gmatch(replication_source, "[^,]+") do - local parsed_uri = urilib.parse(uri) - if parsed_uri == nil then - error("Incorrect replication source URI format: '"..uri.."'") - end - local host = parsed_uri.host - local port = parsed_uri.service or TARANTOOL_DEFAULT_PORT - local user = parsed_uri.login or user_name - local password = parsed_uri.password or user_password - - if user == 'guest' or user == nil then - replication_source = string.format("%s:%s", host, port) - elseif password == nil then - replication_source = string.format("%s:@%s:%s", user, host, port) - else - replication_source = string.format("%s:%s@%s:%s", user, password, - host, port) - end - - table.insert(replication_source_table, replication_source) - end - - return replication_source_table -end - -local function choose_option(main, substitute, cfg) - if cfg[main] then - return main - end - if cfg[substitute] then - return substitute - end - return main -end - -function set_replication_source(replication_source, user_name, user_password) - local replication_source_table = parse_replication_source( - replication_source, user_name, user_password - ) - local choice = choose_option('replication', 'replication_source', box.cfg) - box.cfg{[choice] = replication_source_table} - log.info("Updated box.cfg.%s to %s", choice, replication_source) -end - -local function create_user(user_name, user_password) - if user_name ~= 'guest' and user_password == nil then - user_password = "" - - local warn_str = [[**************************************************** -WARNING: No password has been set for the database. - This will allow anyone with access to the - Tarantool port to access your database. In - Docker's default configuration, this is - effectively any other container on the same - system. - Use "-e TARANTOOL_USER_PASSWORD=password" - to set it in "docker run". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name == 'guest' and user_password == nil then - local warn_str = [[**************************************************** -WARNING: 'guest' is chosen as primary user. - Since it is not allowed to set a password for - guest user, your instance will be accessible - by anyone having direct access to the Tarantool - port. - If you wanted to create an authenticated user, - specify "-e TARANTOOL_USER_NAME=username" and - pick a user name other than "guest". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name == 'guest' and user_password ~= nil then - user_password = nil - - local warn_str = [[**************************************************** -WARNING: A password for guest user has been specified. - In Tarantool, guest user can't have a password - and is always allowed to login, if it has - enough privileges. - If you wanted to create an authenticated user, - specify "-e TARANTOOL_USER_NAME=username" and - pick a user name other than "guest". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name ~= 'admin' and user_name ~= 'guest' then - if not box.schema.user.exists(user_name) then - log.info("Creating user '%s'", user_name) - box.schema.user.create(user_name) - end - end - - if user_name ~= 'admin' then - log.info("Granting admin privileges to user '%s'", user_name) - box.schema.user.grant(user_name, 'read,write,execute,create,drop', - 'universe', nil, {if_not_exists = true}) - box.schema.user.grant(user_name, 'replication', - nil, nil, {if_not_exists = true}) - end - - if user_name ~= 'guest' then - log.info("Setting password for user '%s'", user_name) - box.schema.user.passwd(user_name, user_password) - end -end - -function set_credentials(user_name, user_password) - create_user(user_name, user_password) -end - -local function wrapper_cfg(override) - local work_dir = '/var/lib/tarantool' - local snap_filename = "*.snap" - local snap_path = work_dir..'/'..snap_filename - - local first_run = false - if next(fio.glob(snap_path)) == nil then - first_run = true - end - - - local file_cfg = {} - local config_file_exists = fio.stat(CFG_FILE_PATH) ~= nil - if not config_file_exists then - log.info("Creating configuration file: " .. CFG_FILE_PATH) - - file_cfg.TARANTOOL_USER_NAME = os.getenv('TARANTOOL_USER_NAME') - file_cfg.TARANTOOL_USER_PASSWORD = os.getenv('TARANTOOL_USER_PASSWORD') - file_cfg.TARANTOOL_SLAB_ALLOC_ARENA = os.getenv('TARANTOOL_SLAB_ALLOC_ARENA') - file_cfg.TARANTOOL_SLAB_ALLOC_FACTOR = os.getenv('TARANTOOL_SLAB_ALLOC_FACTOR') - file_cfg.TARANTOOL_SLAB_ALLOC_MINIMAL = os.getenv('TARANTOOL_SLAB_ALLOC_MINIMAL') - file_cfg.TARANTOOL_SLAB_ALLOC_MAXIMAL = os.getenv('TARANTOOL_SLAB_ALLOC_MAXIMAL') - file_cfg.TARANTOOL_PORT = os.getenv('TARANTOOL_PORT') - file_cfg.TARANTOOL_WAL_MODE = os.getenv('TARANTOOL_WAL_MODE') - file_cfg.TARANTOOL_REPLICATION_SOURCE = os.getenv('TARANTOOL_REPLICATION_SOURCE') - file_cfg.TARANTOOL_REPLICATION = os.getenv('TARANTOOL_REPLICATION') - file_cfg.TARANTOOL_SNAPSHOT_PERIOD = os.getenv('TARANTOOL_SNAPSHOT_PERIOD') - file_cfg.TARANTOOL_MEMTX_MEMORY = os.getenv('TARANTOOL_MEMTX_MEMORY') - file_cfg.TARANTOOL_CHECKPOINT_INTERVAL = os.getenv('TARANTOOL_CHECKPOINT_INTERVAL') - file_cfg.TARANTOOL_MEMTX_MIN_TUPLE_SIZE = os.getenv('TARANTOOL_MEMTX_MIN_TUPLE_SIZE') - file_cfg.TARANTOOL_MEMTX_MAX_TUPLE_SIZE = os.getenv('TARANTOOL_MEMTX_MAX_TUPLE_SIZE') - - write_config(file_cfg) - else - log.info("Loading existing configuration file: " .. CFG_FILE_PATH) - - file_cfg = read_config() - end - - local user_name = file_cfg.TARANTOOL_USER_NAME or - os.getenv('TARANTOOL_USER_NAME') or 'guest' - local user_password = file_cfg.TARANTOOL_USER_PASSWORD or - os.getenv('TARANTOOL_USER_PASSWORD') - - - local cfg = override or {} - -- Placeholders for deprecated options - cfg.slab_alloc_arena = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_ARENA) or - override.slab_alloc_arena - cfg.slab_alloc_maximal = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_MAXIMAL) or - override.slab_alloc_maximal - cfg.slab_alloc_minimal = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_MINIMAL) or - override.slab_alloc_minimal - cfg.snapshot_period = tonumber(file_cfg.TARANTOOL_SNAPSHOT_PERIOD) or - override.snapshot_period - -- Replacements for deprecated options - cfg.memtx_memory = tonumber(file_cfg.TARANTOOL_MEMTX_MEMORY) or - override.memtx_memory - cfg.memtx_min_tuple_size = tonumber(file_cfg.TARANTOOL_MEMTX_MIN_TUPLE_SIZE) or - override.memtx_min_tuple_size - cfg.memtx_max_tuple_size = tonumber(file_cfg.TARANTOOL_MEMTX_MAX_TUPLE_SIZE) or - override.memtx_max_tuple_size - cfg.checkpoint_interval = tonumber(file_cfg.TARANTOOL_CHECKPOINT_INTERVAL) or - override.checkpoint_interval - -- Deprecated options with default values - local choice = choose_option('memtx_dir', 'snap_dir', override) - cfg[choice] = override[choice] or '/var/lib/tarantool' - - -- Remaining configuration - cfg.slab_alloc_factor = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_FACTOR) or - override.slab_alloc_factor - cfg.listen = tonumber(file_cfg.TARANTOOL_PORT) or - override.listen or TARANTOOL_DEFAULT_PORT - cfg.wal_mode = file_cfg.TARANTOOL_WAL_MODE or - override.wal_mode - - cfg.wal_dir = override.wal_dir or '/var/lib/tarantool' - cfg.vinyl_dir = override.vinyl_dir or '/var/lib/tarantool' - cfg.pid_file = override.pid_file or '/var/run/tarantool/tarantool.pid' - - local choice = choose_option('TARANTOOL_REPLICATION', 'TARANTOOL_REPLICATION_SOURCE', file_cfg) - local replication_source_table = parse_replication_source(file_cfg[choice], - user_name, - user_password) - - if replication_source_table then - cfg.replication = replication_source_table - else - local choice = choose_option('replication', 'replication_source', override) - cfg[choice] = override[choice] - end - - log.info("Config:\n" .. yaml.encode(cfg)) - - orig_cfg(cfg) - - box.once('tarantool-entrypoint', function () - if first_run then - log.info("Initializing database") - - create_user(user_name, user_password) - end - end) - - console.listen(CONSOLE_SOCKET_PATH) - -end - -box.cfg = wrapper_cfg - --- re-run the script passed as parameter with all arguments that follow -execute_script = arg[1] -if execute_script == nil then - box.cfg {} - - if term.isatty(io.stdout) then - console.start() - os.exit(0) - end -else - narg = 0 - while true do - arg[narg] = arg[narg + 1] - if arg[narg] == nil then - break - end - narg = narg + 1 - end - - dofile(execute_script) -end diff --git a/2.1/tarantool.default b/2.1/tarantool.default deleted file mode 100644 index fffe3b0..0000000 --- a/2.1/tarantool.default +++ /dev/null @@ -1,22 +0,0 @@ --- --- System-wide settings for tarantoolctl and init scripts --- --- This file is meant to enable the usage of tarantoolctl inside --- docker containers. Since there is no init system, most of its --- functionality will not work, except 'tarantoolctl enter' or --- 'tarantoolctl status'. --- - -default_cfg = { - pid_file = "/var/run/tarantool", -- /var/run/tarantool/${INSTANCE}.pid - wal_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE}/ - snap_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE} - vinyl_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE} - logger = "/var/log/tarantool", -- /var/log/tarantool/${INSTANCE}.log - username = "tarantool", -} - --- instances.available - all available instances --- instances.enabled - instances to autostart by sysvinit -instance_dir = "/usr/local/etc/tarantool/instances.enabled" --- vim: set ft=lua : diff --git a/2.1/tarantool_is_up b/2.1/tarantool_is_up deleted file mode 100755 index 71148d5..0000000 --- a/2.1/tarantool_is_up +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -status=$( (tarantool <<-'EOF' -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local console = require('console') -local os = require("os") -local yaml = require("yaml") - -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - os.exit(1) - end - - cmd = 'box.info.status' - local res = self:eval(cmd) - if res ~= nil then - res = yaml.decode(res) - print(res[1]) - end - - os.exit(0) -end) - -console.on_client_disconnect(function(self) self.running = false end) -console.start() - -os.exit(0) -EOF -) 2>/dev/null) - - -echo "$status" - -if [ "$status" = "running" ]; then - exit 0 -else - exit 1 -fi diff --git a/2.1/tarantool_set_config.lua b/2.1/tarantool_set_config.lua deleted file mode 100755 index ddca36c..0000000 --- a/2.1/tarantool_set_config.lua +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env tarantool - -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local CFG_FILE_PATH = '/etc/tarantool/config.yml' - -local fio = require('fio') -local yaml = require('yaml') -local console = require('console') -local errno = require('errno') - -local function read_config() - local f = io.open(CFG_FILE_PATH, "rb") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = f:read("*all") - f:close() - return yaml.decode(content) -end - -local function write_config(cfg) - local f = io.open(CFG_FILE_PATH, "w+") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = yaml.encode(cfg) - f:write(content) - f:close() -end - -local function nop(console, cfg, value) -end - -local function update_replication_source(console, cfg, value) - local user_name = "nil" - if cfg['TARANTOOL_USER_NAME'] then - user_name = "'" .. cfg['TARANTOOL_USER_NAME'] .. "'" - end - - local user_password = "nil" - if cfg['TARANTOOL_USER_PASSWORD'] then - user_password = "'" .. cfg['TARANTOOL_USER_PASSWORD'] .. "'" - end - - local cmd = "set_replication_source('"..value.."', " .. user_name .. "," .. user_password .. ")" - print("cmd: ", cmd) - - local res = console:eval(cmd) - - if res ~= nil then - print(res) - end -end - -local function update_credentials(console, cfg, value) - local user_name = "nil" - if cfg['TARANTOOL_USER_NAME'] then - user_name = "'" .. cfg['TARANTOOL_USER_NAME'] .. "'" - end - - local user_password = "nil" - if cfg['TARANTOOL_USER_PASSWORD'] then - user_password = "'" .. cfg['TARANTOOL_USER_PASSWORD'] .. "'" - end - - local cmd = "set_credentials(" .. user_name .. "," .. user_password .. ")" - - local res = console:eval(cmd) - - if res ~= nil then - print(res) - end - - local replication_source = cfg['TARANTOOL_REPLICATION_SOURCE'] - - if replication_source ~= nil then - update_replication_source(console, cfg, replication_source) - end -end - - -local vars = { - TARANTOOL_SLAB_ALLOC_ARENA=nop, - TARANTOOL_SLAB_ALLOC_FACTOR=nop, - TARANTOOL_SLAB_ALLOC_MAXIMAL=nop, - TARANTOOL_SLAB_ALLOC_MINIMAL=nop, - TARANTOOL_PORT=nop, - TARANTOOL_WAL_MODE=nop, - TARANTOOL_USER_NAME=update_credentials, - TARANTOOL_USER_PASSWORD=update_credentials, - TARANTOOL_REPLICATION_SOURCE=update_replication_source, - TARANTOOL_REPLICATION=update_replication_source, -} - -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - os.exit(1) - end - - if arg[1] == nil or arg[2] == nil then - self:print("Usage: " .. arg[0] .. " ") - os.exit(1) - end - - if vars[arg[1]] == nil then - self:print("Unknown var: " .. arg[1]) - os.exit(1) - end - - local cfg = read_config() - cfg[arg[1]] = arg[2] - - local func = vars[arg[1]] - func(self, cfg, arg[2]) - - write_config(cfg) - - self.running = false - os.exit(0) -end) - -console.on_client_disconnect(function(self) self.running = false end) -console.start() - -os.exit(0) diff --git a/2.2/console b/2.2/console deleted file mode 100755 index d6fb192..0000000 --- a/2.2/console +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env tarantool - -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' - -console = require('console') -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - self.running = false - end -end) -console.on_client_disconnect(function(self) self.running = false end) -console.start() diff --git a/2.2/docker-entrypoint.sh b/2.2/docker-entrypoint.sh deleted file mode 100755 index 3a9f5e4..0000000 --- a/2.2/docker-entrypoint.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -# or first arg is `something.conf` -if [ "${1:0:1}" = '-' ]; then - set -- tarantool "$@" -fi - -# allow the container to be started with `--user` -if [ "$1" = 'tarantool' -a "$(id -u)" = '0' ]; then - chown -R tarantool /var/lib/tarantool - exec su-exec tarantool "$0" "$@" -fi - -# entry point wraps the passed script to do basic setup -if [ "$1" = 'tarantool' ]; then - shift - exec tarantool "/usr/local/bin/tarantool-entrypoint.lua" "$@" -fi - -exec "$@" diff --git a/2.2/gperftools_alpine.diff b/2.2/gperftools_alpine.diff deleted file mode 100644 index e768381..0000000 --- a/2.2/gperftools_alpine.diff +++ /dev/null @@ -1,110 +0,0 @@ -diff --git a/src/base/linux_syscall_support.h b/src/base/linux_syscall_support.h -index 5d578cd..fceebe2 100644 ---- a/src/base/linux_syscall_support.h -+++ b/src/base/linux_syscall_support.h -@@ -2432,9 +2432,9 @@ struct kernel_stat { - #if defined(__s390x__) - LSS_INLINE _syscall1(void*, mmap, void*, a) - #else -- /* Need to make sure __off64_t isn't truncated to 32-bits under x32. */ -+ /* Need to make sure off64_t isn't truncated to 32-bits under x32. */ - LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d, -- __off64_t o) { -+ off64_t o) { - LSS_BODY(6, void*, mmap, LSS_SYSCALL_ARG(s), LSS_SYSCALL_ARG(l), - LSS_SYSCALL_ARG(p), LSS_SYSCALL_ARG(f), - LSS_SYSCALL_ARG(d), (uint64_t)(o)); -@@ -2475,7 +2475,7 @@ struct kernel_stat { - LSS_INLINE _syscall6(void*, mmap, void*, s, - size_t, l, int, p, - int, f, int, d, -- __off64_t, o) -+ off64_t, o) - LSS_INLINE int LSS_NAME(sigaction)(int signum, - const struct kernel_sigaction *act, - struct kernel_sigaction *oldact) { -diff --git a/src/malloc_hook_mmap_linux.h b/src/malloc_hook_mmap_linux.h -index 1c4c766..b2aa8ed 100755 ---- a/src/malloc_hook_mmap_linux.h -+++ b/src/malloc_hook_mmap_linux.h -@@ -56,7 +56,7 @@ - - static inline void* do_mmap64(void *start, size_t length, - int prot, int flags, -- int fd, __off64_t offset) __THROW { -+ int fd, off64_t offset) __THROW { - return sys_mmap(start, length, prot, flags, fd, offset); - } - -@@ -67,7 +67,7 @@ static inline void* do_mmap64(void *start, size_t length, - - static inline void* do_mmap64(void *start, size_t length, - int prot, int flags, -- int fd, __off64_t offset) __THROW { -+ int fd, off64_t offset) __THROW { - void *result; - - // Try mmap2() unless it's not supported -@@ -151,9 +151,11 @@ static inline void* do_mmap64(void *start, size_t length, - # undef mmap - - extern "C" { -+ #ifndef mmap64 - void* mmap64(void *start, size_t length, int prot, int flags, -- int fd, __off64_t offset ) __THROW -+ int fd, off64_t offset ) __THROW - ATTRIBUTE_SECTION(malloc_hook); -+ #endif - void* mmap(void *start, size_t length,int prot, int flags, - int fd, off_t offset) __THROW - ATTRIBUTE_SECTION(malloc_hook); -@@ -166,8 +168,9 @@ extern "C" { - ATTRIBUTE_SECTION(malloc_hook); - } - -+#ifndef mmap64 - extern "C" void* mmap64(void *start, size_t length, int prot, int flags, -- int fd, __off64_t offset) __THROW { -+ int fd, off64_t offset) __THROW { - MallocHook::InvokePreMmapHook(start, length, prot, flags, fd, offset); - void *result; - if (!MallocHook::InvokeMmapReplacement( -@@ -177,6 +180,7 @@ extern "C" void* mmap64(void *start, size_t length, int prot, int flags, - MallocHook::InvokeMmapHook(result, start, length, prot, flags, fd, offset); - return result; - } -+#endif - - # if !defined(__USE_FILE_OFFSET64) || !defined(__REDIRECT_NTH) - -@@ -216,7 +220,7 @@ extern "C" void* mremap(void* old_addr, size_t old_size, size_t new_size, - return result; - } - --#ifndef __UCLIBC__ -+#if defined(__GLIBC__) && ! defined(__UCLIBC__) - // libc's version: - extern "C" void* __sbrk(ptrdiff_t increment); - -diff --git a/src/tests/stacktrace_unittest.cc b/src/tests/stacktrace_unittest.cc -index 3c9f735..2d39ad9 100644 ---- a/src/tests/stacktrace_unittest.cc -+++ b/src/tests/stacktrace_unittest.cc -@@ -120,17 +120,6 @@ void ATTRIBUTE_NOINLINE CheckStackTraceLeaf(void) { - CHECK_GE(size, 1); - CHECK_LE(size, STACK_LEN); - --#ifdef HAVE_EXECINFO_H -- { -- char **strings = backtrace_symbols(stack, size); -- printf("Obtained %d stack frames.\n", size); -- for (int i = 0; i < size; i++) -- printf("%s %p\n", strings[i], stack[i]); -- printf("CheckStackTrace() addr: %p\n", &CheckStackTrace); -- free(strings); -- } --#endif -- - for (int i = 0; i < BACKTRACE_STEPS; i++) { - printf("Backtrace %d: expected: %p..%p actual: %p ... ", - i, expected_range[i].start, expected_range[i].end, stack[i]); diff --git a/2.2/luarocks-config.lua b/2.2/luarocks-config.lua deleted file mode 100644 index 111f955..0000000 --- a/2.2/luarocks-config.lua +++ /dev/null @@ -1,9 +0,0 @@ -rocks_trees = { - { name = [[user]], root = home..[[/.luarocks]] }, - { name = [[system]], root = [[/usr/local]] } -} - -rocks_servers = { - [[http://rocks.tarantool.org/]], - [[http://luarocks.org/repositories/rocks]] -} diff --git a/2.2/tarantool-entrypoint.lua b/2.2/tarantool-entrypoint.lua deleted file mode 100755 index ffbf2fc..0000000 --- a/2.2/tarantool-entrypoint.lua +++ /dev/null @@ -1,292 +0,0 @@ -#!/usr/bin/env tarantool - -local fio = require('fio') -local errno = require('errno') -local fun = require('fun') -local urilib = require('uri') -local console = require('console') -local term = require('term') -local log = require('log') -local yaml = require('yaml') - -local TARANTOOL_DEFAULT_PORT = 3301 -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local CFG_FILE_PATH = '/etc/tarantool/config.yml' - - -local orig_cfg = box.cfg - -local function read_config() - local f = io.open(CFG_FILE_PATH, "rb") - if f == nil then - log.error("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = f:read("*all") - f:close() - return yaml.decode(content) -end - -local function write_config(cfg) - local f = io.open(CFG_FILE_PATH, "w+") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = yaml.encode(cfg) - f:write(content) - f:close() -end - -local function parse_replication_source(replication_source, user_name, user_password) - if replication_source == nil then - return nil - end - - local replication_source_table = {} - for uri in string.gmatch(replication_source, "[^,]+") do - local parsed_uri = urilib.parse(uri) - if parsed_uri == nil then - error("Incorrect replication source URI format: '"..uri.."'") - end - local host = parsed_uri.host - local port = parsed_uri.service or TARANTOOL_DEFAULT_PORT - local user = parsed_uri.login or user_name - local password = parsed_uri.password or user_password - - if user == 'guest' or user == nil then - replication_source = string.format("%s:%s", host, port) - elseif password == nil then - replication_source = string.format("%s:@%s:%s", user, host, port) - else - replication_source = string.format("%s:%s@%s:%s", user, password, - host, port) - end - - table.insert(replication_source_table, replication_source) - end - - return replication_source_table -end - -local function choose_option(main, substitute, cfg) - if cfg[main] then - return main - end - if cfg[substitute] then - return substitute - end - return main -end - -function set_replication_source(replication_source, user_name, user_password) - local replication_source_table = parse_replication_source( - replication_source, user_name, user_password - ) - local choice = choose_option('replication', 'replication_source', box.cfg) - box.cfg{[choice] = replication_source_table} - log.info("Updated box.cfg.%s to %s", choice, replication_source) -end - -local function create_user(user_name, user_password) - if user_name ~= 'guest' and user_password == nil then - user_password = "" - - local warn_str = [[**************************************************** -WARNING: No password has been set for the database. - This will allow anyone with access to the - Tarantool port to access your database. In - Docker's default configuration, this is - effectively any other container on the same - system. - Use "-e TARANTOOL_USER_PASSWORD=password" - to set it in "docker run". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name == 'guest' and user_password == nil then - local warn_str = [[**************************************************** -WARNING: 'guest' is chosen as primary user. - Since it is not allowed to set a password for - guest user, your instance will be accessible - by anyone having direct access to the Tarantool - port. - If you wanted to create an authenticated user, - specify "-e TARANTOOL_USER_NAME=username" and - pick a user name other than "guest". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name == 'guest' and user_password ~= nil then - user_password = nil - - local warn_str = [[**************************************************** -WARNING: A password for guest user has been specified. - In Tarantool, guest user can't have a password - and is always allowed to login, if it has - enough privileges. - If you wanted to create an authenticated user, - specify "-e TARANTOOL_USER_NAME=username" and - pick a user name other than "guest". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name ~= 'admin' and user_name ~= 'guest' then - if not box.schema.user.exists(user_name) then - log.info("Creating user '%s'", user_name) - box.schema.user.create(user_name) - end - end - - if user_name ~= 'admin' then - log.info("Granting admin privileges to user '%s'", user_name) - box.schema.user.grant(user_name, 'read,write,execute,create,drop', - 'universe', nil, {if_not_exists = true}) - box.schema.user.grant(user_name, 'replication', - nil, nil, {if_not_exists = true}) - end - - if user_name ~= 'guest' then - log.info("Setting password for user '%s'", user_name) - box.schema.user.passwd(user_name, user_password) - end -end - -function set_credentials(user_name, user_password) - create_user(user_name, user_password) -end - -local function wrapper_cfg(override) - local work_dir = '/var/lib/tarantool' - local snap_filename = "*.snap" - local snap_path = work_dir..'/'..snap_filename - - local first_run = false - if next(fio.glob(snap_path)) == nil then - first_run = true - end - - - local file_cfg = {} - local config_file_exists = fio.stat(CFG_FILE_PATH) ~= nil - if not config_file_exists then - log.info("Creating configuration file: " .. CFG_FILE_PATH) - - file_cfg.TARANTOOL_USER_NAME = os.getenv('TARANTOOL_USER_NAME') - file_cfg.TARANTOOL_USER_PASSWORD = os.getenv('TARANTOOL_USER_PASSWORD') - file_cfg.TARANTOOL_SLAB_ALLOC_ARENA = os.getenv('TARANTOOL_SLAB_ALLOC_ARENA') - file_cfg.TARANTOOL_SLAB_ALLOC_FACTOR = os.getenv('TARANTOOL_SLAB_ALLOC_FACTOR') - file_cfg.TARANTOOL_SLAB_ALLOC_MINIMAL = os.getenv('TARANTOOL_SLAB_ALLOC_MINIMAL') - file_cfg.TARANTOOL_SLAB_ALLOC_MAXIMAL = os.getenv('TARANTOOL_SLAB_ALLOC_MAXIMAL') - file_cfg.TARANTOOL_PORT = os.getenv('TARANTOOL_PORT') - file_cfg.TARANTOOL_WAL_MODE = os.getenv('TARANTOOL_WAL_MODE') - file_cfg.TARANTOOL_REPLICATION_SOURCE = os.getenv('TARANTOOL_REPLICATION_SOURCE') - file_cfg.TARANTOOL_REPLICATION = os.getenv('TARANTOOL_REPLICATION') - file_cfg.TARANTOOL_SNAPSHOT_PERIOD = os.getenv('TARANTOOL_SNAPSHOT_PERIOD') - file_cfg.TARANTOOL_MEMTX_MEMORY = os.getenv('TARANTOOL_MEMTX_MEMORY') - file_cfg.TARANTOOL_CHECKPOINT_INTERVAL = os.getenv('TARANTOOL_CHECKPOINT_INTERVAL') - file_cfg.TARANTOOL_MEMTX_MIN_TUPLE_SIZE = os.getenv('TARANTOOL_MEMTX_MIN_TUPLE_SIZE') - file_cfg.TARANTOOL_MEMTX_MAX_TUPLE_SIZE = os.getenv('TARANTOOL_MEMTX_MAX_TUPLE_SIZE') - - write_config(file_cfg) - else - log.info("Loading existing configuration file: " .. CFG_FILE_PATH) - - file_cfg = read_config() - end - - local user_name = file_cfg.TARANTOOL_USER_NAME or - os.getenv('TARANTOOL_USER_NAME') or 'guest' - local user_password = file_cfg.TARANTOOL_USER_PASSWORD or - os.getenv('TARANTOOL_USER_PASSWORD') - - - local cfg = override or {} - -- Placeholders for deprecated options - cfg.slab_alloc_arena = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_ARENA) or - override.slab_alloc_arena - cfg.slab_alloc_maximal = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_MAXIMAL) or - override.slab_alloc_maximal - cfg.slab_alloc_minimal = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_MINIMAL) or - override.slab_alloc_minimal - cfg.snapshot_period = tonumber(file_cfg.TARANTOOL_SNAPSHOT_PERIOD) or - override.snapshot_period - -- Replacements for deprecated options - cfg.memtx_memory = tonumber(file_cfg.TARANTOOL_MEMTX_MEMORY) or - override.memtx_memory - cfg.memtx_min_tuple_size = tonumber(file_cfg.TARANTOOL_MEMTX_MIN_TUPLE_SIZE) or - override.memtx_min_tuple_size - cfg.memtx_max_tuple_size = tonumber(file_cfg.TARANTOOL_MEMTX_MAX_TUPLE_SIZE) or - override.memtx_max_tuple_size - cfg.checkpoint_interval = tonumber(file_cfg.TARANTOOL_CHECKPOINT_INTERVAL) or - override.checkpoint_interval - -- Deprecated options with default values - local choice = choose_option('memtx_dir', 'snap_dir', override) - cfg[choice] = override[choice] or '/var/lib/tarantool' - - -- Remaining configuration - cfg.slab_alloc_factor = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_FACTOR) or - override.slab_alloc_factor - cfg.listen = tonumber(file_cfg.TARANTOOL_PORT) or - override.listen or TARANTOOL_DEFAULT_PORT - cfg.wal_mode = file_cfg.TARANTOOL_WAL_MODE or - override.wal_mode - - cfg.wal_dir = override.wal_dir or '/var/lib/tarantool' - cfg.vinyl_dir = override.vinyl_dir or '/var/lib/tarantool' - cfg.pid_file = override.pid_file or '/var/run/tarantool/tarantool.pid' - - local choice = choose_option('TARANTOOL_REPLICATION', 'TARANTOOL_REPLICATION_SOURCE', file_cfg) - local replication_source_table = parse_replication_source(file_cfg[choice], - user_name, - user_password) - - if replication_source_table then - cfg.replication = replication_source_table - else - local choice = choose_option('replication', 'replication_source', override) - cfg[choice] = override[choice] - end - - log.info("Config:\n" .. yaml.encode(cfg)) - - orig_cfg(cfg) - - box.once('tarantool-entrypoint', function () - if first_run then - log.info("Initializing database") - - create_user(user_name, user_password) - end - end) - - console.listen(CONSOLE_SOCKET_PATH) - -end - -box.cfg = wrapper_cfg - --- re-run the script passed as parameter with all arguments that follow -execute_script = arg[1] -if execute_script == nil then - box.cfg {} - - if term.isatty(io.stdout) then - console.start() - os.exit(0) - end -else - narg = 0 - while true do - arg[narg] = arg[narg + 1] - if arg[narg] == nil then - break - end - narg = narg + 1 - end - - dofile(execute_script) -end diff --git a/2.2/tarantool.default b/2.2/tarantool.default deleted file mode 100644 index fffe3b0..0000000 --- a/2.2/tarantool.default +++ /dev/null @@ -1,22 +0,0 @@ --- --- System-wide settings for tarantoolctl and init scripts --- --- This file is meant to enable the usage of tarantoolctl inside --- docker containers. Since there is no init system, most of its --- functionality will not work, except 'tarantoolctl enter' or --- 'tarantoolctl status'. --- - -default_cfg = { - pid_file = "/var/run/tarantool", -- /var/run/tarantool/${INSTANCE}.pid - wal_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE}/ - snap_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE} - vinyl_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE} - logger = "/var/log/tarantool", -- /var/log/tarantool/${INSTANCE}.log - username = "tarantool", -} - --- instances.available - all available instances --- instances.enabled - instances to autostart by sysvinit -instance_dir = "/usr/local/etc/tarantool/instances.enabled" --- vim: set ft=lua : diff --git a/2.2/tarantool_is_up b/2.2/tarantool_is_up deleted file mode 100755 index 71148d5..0000000 --- a/2.2/tarantool_is_up +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -status=$( (tarantool <<-'EOF' -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local console = require('console') -local os = require("os") -local yaml = require("yaml") - -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - os.exit(1) - end - - cmd = 'box.info.status' - local res = self:eval(cmd) - if res ~= nil then - res = yaml.decode(res) - print(res[1]) - end - - os.exit(0) -end) - -console.on_client_disconnect(function(self) self.running = false end) -console.start() - -os.exit(0) -EOF -) 2>/dev/null) - - -echo "$status" - -if [ "$status" = "running" ]; then - exit 0 -else - exit 1 -fi diff --git a/2.2/tarantool_set_config.lua b/2.2/tarantool_set_config.lua deleted file mode 100755 index ddca36c..0000000 --- a/2.2/tarantool_set_config.lua +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env tarantool - -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local CFG_FILE_PATH = '/etc/tarantool/config.yml' - -local fio = require('fio') -local yaml = require('yaml') -local console = require('console') -local errno = require('errno') - -local function read_config() - local f = io.open(CFG_FILE_PATH, "rb") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = f:read("*all") - f:close() - return yaml.decode(content) -end - -local function write_config(cfg) - local f = io.open(CFG_FILE_PATH, "w+") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = yaml.encode(cfg) - f:write(content) - f:close() -end - -local function nop(console, cfg, value) -end - -local function update_replication_source(console, cfg, value) - local user_name = "nil" - if cfg['TARANTOOL_USER_NAME'] then - user_name = "'" .. cfg['TARANTOOL_USER_NAME'] .. "'" - end - - local user_password = "nil" - if cfg['TARANTOOL_USER_PASSWORD'] then - user_password = "'" .. cfg['TARANTOOL_USER_PASSWORD'] .. "'" - end - - local cmd = "set_replication_source('"..value.."', " .. user_name .. "," .. user_password .. ")" - print("cmd: ", cmd) - - local res = console:eval(cmd) - - if res ~= nil then - print(res) - end -end - -local function update_credentials(console, cfg, value) - local user_name = "nil" - if cfg['TARANTOOL_USER_NAME'] then - user_name = "'" .. cfg['TARANTOOL_USER_NAME'] .. "'" - end - - local user_password = "nil" - if cfg['TARANTOOL_USER_PASSWORD'] then - user_password = "'" .. cfg['TARANTOOL_USER_PASSWORD'] .. "'" - end - - local cmd = "set_credentials(" .. user_name .. "," .. user_password .. ")" - - local res = console:eval(cmd) - - if res ~= nil then - print(res) - end - - local replication_source = cfg['TARANTOOL_REPLICATION_SOURCE'] - - if replication_source ~= nil then - update_replication_source(console, cfg, replication_source) - end -end - - -local vars = { - TARANTOOL_SLAB_ALLOC_ARENA=nop, - TARANTOOL_SLAB_ALLOC_FACTOR=nop, - TARANTOOL_SLAB_ALLOC_MAXIMAL=nop, - TARANTOOL_SLAB_ALLOC_MINIMAL=nop, - TARANTOOL_PORT=nop, - TARANTOOL_WAL_MODE=nop, - TARANTOOL_USER_NAME=update_credentials, - TARANTOOL_USER_PASSWORD=update_credentials, - TARANTOOL_REPLICATION_SOURCE=update_replication_source, - TARANTOOL_REPLICATION=update_replication_source, -} - -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - os.exit(1) - end - - if arg[1] == nil or arg[2] == nil then - self:print("Usage: " .. arg[0] .. " ") - os.exit(1) - end - - if vars[arg[1]] == nil then - self:print("Unknown var: " .. arg[1]) - os.exit(1) - end - - local cfg = read_config() - cfg[arg[1]] = arg[2] - - local func = vars[arg[1]] - func(self, cfg, arg[2]) - - write_config(cfg) - - self.running = false - os.exit(0) -end) - -console.on_client_disconnect(function(self) self.running = false end) -console.start() - -os.exit(0) diff --git a/2.x-centos7/.dockerignore b/2.x-centos7/.dockerignore deleted file mode 100644 index e69de29..0000000 diff --git a/2.x-centos7/console b/2.x-centos7/console deleted file mode 100755 index d6fb192..0000000 --- a/2.x-centos7/console +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env tarantool - -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' - -console = require('console') -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - self.running = false - end -end) -console.on_client_disconnect(function(self) self.running = false end) -console.start() diff --git a/2.x-centos7/docker-entrypoint.sh b/2.x-centos7/docker-entrypoint.sh deleted file mode 100755 index 6d48fdd..0000000 --- a/2.x-centos7/docker-entrypoint.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -# or first arg is `something.conf` -if [ "${1:0:1}" = '-' ]; then - set -- tarantool "$@" -fi - -# allow the container to be started with `--user` -if [ "$1" = 'tarantool' -a "$(id -u)" = '0' ]; then - chown -R tarantool /var/lib/tarantool - exec gosu tarantool "$0" "$@" -fi - -# entry point wraps the passed script to do basic setup -if [ "$1" = 'tarantool' ]; then - shift - exec tarantool "/usr/local/bin/tarantool-entrypoint.lua" "$@" -fi - -exec "$@" diff --git a/2.x-centos7/mosquitto.repo b/2.x-centos7/mosquitto.repo deleted file mode 100644 index 4df10dc..0000000 --- a/2.x-centos7/mosquitto.repo +++ /dev/null @@ -1,7 +0,0 @@ -[home_oojah_mqtt] -name=mqtt (CentOS_CentOS-7) -type=rpm-md -baseurl=http://download.opensuse.org/repositories/home:/oojah:/mqtt/CentOS_CentOS-7/ -gpgcheck=1 -gpgkey=http://download.opensuse.org/repositories/home:/oojah:/mqtt/CentOS_CentOS-7//repodata/repomd.xml.key -enabled=1 \ No newline at end of file diff --git a/2.x-centos7/tarantool.default b/2.x-centos7/tarantool.default deleted file mode 100644 index fffe3b0..0000000 --- a/2.x-centos7/tarantool.default +++ /dev/null @@ -1,22 +0,0 @@ --- --- System-wide settings for tarantoolctl and init scripts --- --- This file is meant to enable the usage of tarantoolctl inside --- docker containers. Since there is no init system, most of its --- functionality will not work, except 'tarantoolctl enter' or --- 'tarantoolctl status'. --- - -default_cfg = { - pid_file = "/var/run/tarantool", -- /var/run/tarantool/${INSTANCE}.pid - wal_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE}/ - snap_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE} - vinyl_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE} - logger = "/var/log/tarantool", -- /var/log/tarantool/${INSTANCE}.log - username = "tarantool", -} - --- instances.available - all available instances --- instances.enabled - instances to autostart by sysvinit -instance_dir = "/usr/local/etc/tarantool/instances.enabled" --- vim: set ft=lua : diff --git a/2.x-centos7/tarantool_is_up b/2.x-centos7/tarantool_is_up deleted file mode 100755 index 71148d5..0000000 --- a/2.x-centos7/tarantool_is_up +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -status=$( (tarantool <<-'EOF' -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local console = require('console') -local os = require("os") -local yaml = require("yaml") - -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - os.exit(1) - end - - cmd = 'box.info.status' - local res = self:eval(cmd) - if res ~= nil then - res = yaml.decode(res) - print(res[1]) - end - - os.exit(0) -end) - -console.on_client_disconnect(function(self) self.running = false end) -console.start() - -os.exit(0) -EOF -) 2>/dev/null) - - -echo "$status" - -if [ "$status" = "running" ]; then - exit 0 -else - exit 1 -fi diff --git a/2.x/console b/2.x/console deleted file mode 100755 index d6fb192..0000000 --- a/2.x/console +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env tarantool - -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' - -console = require('console') -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - self.running = false - end -end) -console.on_client_disconnect(function(self) self.running = false end) -console.start() diff --git a/2.x/docker-entrypoint.sh b/2.x/docker-entrypoint.sh deleted file mode 100755 index 3a9f5e4..0000000 --- a/2.x/docker-entrypoint.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -# or first arg is `something.conf` -if [ "${1:0:1}" = '-' ]; then - set -- tarantool "$@" -fi - -# allow the container to be started with `--user` -if [ "$1" = 'tarantool' -a "$(id -u)" = '0' ]; then - chown -R tarantool /var/lib/tarantool - exec su-exec tarantool "$0" "$@" -fi - -# entry point wraps the passed script to do basic setup -if [ "$1" = 'tarantool' ]; then - shift - exec tarantool "/usr/local/bin/tarantool-entrypoint.lua" "$@" -fi - -exec "$@" diff --git a/2.x/gperftools_alpine.diff b/2.x/gperftools_alpine.diff deleted file mode 100644 index e768381..0000000 --- a/2.x/gperftools_alpine.diff +++ /dev/null @@ -1,110 +0,0 @@ -diff --git a/src/base/linux_syscall_support.h b/src/base/linux_syscall_support.h -index 5d578cd..fceebe2 100644 ---- a/src/base/linux_syscall_support.h -+++ b/src/base/linux_syscall_support.h -@@ -2432,9 +2432,9 @@ struct kernel_stat { - #if defined(__s390x__) - LSS_INLINE _syscall1(void*, mmap, void*, a) - #else -- /* Need to make sure __off64_t isn't truncated to 32-bits under x32. */ -+ /* Need to make sure off64_t isn't truncated to 32-bits under x32. */ - LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d, -- __off64_t o) { -+ off64_t o) { - LSS_BODY(6, void*, mmap, LSS_SYSCALL_ARG(s), LSS_SYSCALL_ARG(l), - LSS_SYSCALL_ARG(p), LSS_SYSCALL_ARG(f), - LSS_SYSCALL_ARG(d), (uint64_t)(o)); -@@ -2475,7 +2475,7 @@ struct kernel_stat { - LSS_INLINE _syscall6(void*, mmap, void*, s, - size_t, l, int, p, - int, f, int, d, -- __off64_t, o) -+ off64_t, o) - LSS_INLINE int LSS_NAME(sigaction)(int signum, - const struct kernel_sigaction *act, - struct kernel_sigaction *oldact) { -diff --git a/src/malloc_hook_mmap_linux.h b/src/malloc_hook_mmap_linux.h -index 1c4c766..b2aa8ed 100755 ---- a/src/malloc_hook_mmap_linux.h -+++ b/src/malloc_hook_mmap_linux.h -@@ -56,7 +56,7 @@ - - static inline void* do_mmap64(void *start, size_t length, - int prot, int flags, -- int fd, __off64_t offset) __THROW { -+ int fd, off64_t offset) __THROW { - return sys_mmap(start, length, prot, flags, fd, offset); - } - -@@ -67,7 +67,7 @@ static inline void* do_mmap64(void *start, size_t length, - - static inline void* do_mmap64(void *start, size_t length, - int prot, int flags, -- int fd, __off64_t offset) __THROW { -+ int fd, off64_t offset) __THROW { - void *result; - - // Try mmap2() unless it's not supported -@@ -151,9 +151,11 @@ static inline void* do_mmap64(void *start, size_t length, - # undef mmap - - extern "C" { -+ #ifndef mmap64 - void* mmap64(void *start, size_t length, int prot, int flags, -- int fd, __off64_t offset ) __THROW -+ int fd, off64_t offset ) __THROW - ATTRIBUTE_SECTION(malloc_hook); -+ #endif - void* mmap(void *start, size_t length,int prot, int flags, - int fd, off_t offset) __THROW - ATTRIBUTE_SECTION(malloc_hook); -@@ -166,8 +168,9 @@ extern "C" { - ATTRIBUTE_SECTION(malloc_hook); - } - -+#ifndef mmap64 - extern "C" void* mmap64(void *start, size_t length, int prot, int flags, -- int fd, __off64_t offset) __THROW { -+ int fd, off64_t offset) __THROW { - MallocHook::InvokePreMmapHook(start, length, prot, flags, fd, offset); - void *result; - if (!MallocHook::InvokeMmapReplacement( -@@ -177,6 +180,7 @@ extern "C" void* mmap64(void *start, size_t length, int prot, int flags, - MallocHook::InvokeMmapHook(result, start, length, prot, flags, fd, offset); - return result; - } -+#endif - - # if !defined(__USE_FILE_OFFSET64) || !defined(__REDIRECT_NTH) - -@@ -216,7 +220,7 @@ extern "C" void* mremap(void* old_addr, size_t old_size, size_t new_size, - return result; - } - --#ifndef __UCLIBC__ -+#if defined(__GLIBC__) && ! defined(__UCLIBC__) - // libc's version: - extern "C" void* __sbrk(ptrdiff_t increment); - -diff --git a/src/tests/stacktrace_unittest.cc b/src/tests/stacktrace_unittest.cc -index 3c9f735..2d39ad9 100644 ---- a/src/tests/stacktrace_unittest.cc -+++ b/src/tests/stacktrace_unittest.cc -@@ -120,17 +120,6 @@ void ATTRIBUTE_NOINLINE CheckStackTraceLeaf(void) { - CHECK_GE(size, 1); - CHECK_LE(size, STACK_LEN); - --#ifdef HAVE_EXECINFO_H -- { -- char **strings = backtrace_symbols(stack, size); -- printf("Obtained %d stack frames.\n", size); -- for (int i = 0; i < size; i++) -- printf("%s %p\n", strings[i], stack[i]); -- printf("CheckStackTrace() addr: %p\n", &CheckStackTrace); -- free(strings); -- } --#endif -- - for (int i = 0; i < BACKTRACE_STEPS; i++) { - printf("Backtrace %d: expected: %p..%p actual: %p ... ", - i, expected_range[i].start, expected_range[i].end, stack[i]); diff --git a/2.x/tarantool-entrypoint.lua b/2.x/tarantool-entrypoint.lua deleted file mode 100755 index 512163a..0000000 --- a/2.x/tarantool-entrypoint.lua +++ /dev/null @@ -1,291 +0,0 @@ -#!/usr/bin/env tarantool - -local fio = require('fio') -local errno = require('errno') -local urilib = require('uri') -local console = require('console') -local term = require('term') -local log = require('log') -local yaml = require('yaml') - -local TARANTOOL_DEFAULT_PORT = 3301 -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local CFG_FILE_PATH = '/etc/tarantool/config.yml' - - -local orig_cfg = box.cfg - -local function read_config() - local f = io.open(CFG_FILE_PATH, "rb") - if f == nil then - log.error("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = f:read("*all") - f:close() - return yaml.decode(content) -end - -local function write_config(cfg) - local f = io.open(CFG_FILE_PATH, "w+") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = yaml.encode(cfg) - f:write(content) - f:close() -end - -local function parse_replication_source(replication_source, user_name, user_password) - if replication_source == nil then - return nil - end - - local replication_source_table = {} - for uri in string.gmatch(replication_source, "[^,]+") do - local parsed_uri = urilib.parse(uri) - if parsed_uri == nil then - error("Incorrect replication source URI format: '"..uri.."'") - end - local host = parsed_uri.host - local port = parsed_uri.service or TARANTOOL_DEFAULT_PORT - local user = parsed_uri.login or user_name - local password = parsed_uri.password or user_password - - if user == 'guest' or user == nil then - replication_source = string.format("%s:%s", host, port) - elseif password == nil then - replication_source = string.format("%s:@%s:%s", user, host, port) - else - replication_source = string.format("%s:%s@%s:%s", user, password, - host, port) - end - - table.insert(replication_source_table, replication_source) - end - - return replication_source_table -end - -local function choose_option(main, substitute, cfg) - if cfg[main] then - return main - end - if cfg[substitute] then - return substitute - end - return main -end - -function set_replication_source(replication_source, user_name, user_password) - local replication_source_table = parse_replication_source( - replication_source, user_name, user_password - ) - local choice = choose_option('replication', 'replication_source', box.cfg) - box.cfg{[choice] = replication_source_table} - log.info("Updated box.cfg.%s to %s", choice, replication_source) -end - -local function create_user(user_name, user_password) - if user_name ~= 'guest' and user_password == nil then - user_password = "" - - local warn_str = [[**************************************************** -WARNING: No password has been set for the database. - This will allow anyone with access to the - Tarantool port to access your database. In - Docker's default configuration, this is - effectively any other container on the same - system. - Use "-e TARANTOOL_USER_PASSWORD=password" - to set it in "docker run". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name == 'guest' and user_password == nil then - local warn_str = [[**************************************************** -WARNING: 'guest' is chosen as primary user. - Since it is not allowed to set a password for - guest user, your instance will be accessible - by anyone having direct access to the Tarantool - port. - If you wanted to create an authenticated user, - specify "-e TARANTOOL_USER_NAME=username" and - pick a user name other than "guest". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name == 'guest' and user_password ~= nil then - user_password = nil - - local warn_str = [[**************************************************** -WARNING: A password for guest user has been specified. - In Tarantool, guest user can't have a password - and is always allowed to login, if it has - enough privileges. - If you wanted to create an authenticated user, - specify "-e TARANTOOL_USER_NAME=username" and - pick a user name other than "guest". -****************************************************]] - log.warn('\n'..warn_str) - end - - if user_name ~= 'admin' and user_name ~= 'guest' then - if not box.schema.user.exists(user_name) then - log.info("Creating user '%s'", user_name) - box.schema.user.create(user_name) - end - end - - if user_name ~= 'admin' then - log.info("Granting admin privileges to user '%s'", user_name) - box.schema.user.grant(user_name, 'read,write,execute,create,drop', - 'universe', nil, {if_not_exists = true}) - box.schema.user.grant(user_name, 'replication', - nil, nil, {if_not_exists = true}) - end - - if user_name ~= 'guest' then - log.info("Setting password for user '%s'", user_name) - box.schema.user.passwd(user_name, user_password) - end -end - -function set_credentials(user_name, user_password) - create_user(user_name, user_password) -end - -local function wrapper_cfg(override) - local work_dir = '/var/lib/tarantool' - local snap_filename = "*.snap" - local snap_path = work_dir..'/'..snap_filename - - local first_run = false - if next(fio.glob(snap_path)) == nil then - first_run = true - end - - - local file_cfg = {} - local config_file_exists = fio.stat(CFG_FILE_PATH) ~= nil - if not config_file_exists then - log.info("Creating configuration file: " .. CFG_FILE_PATH) - - file_cfg.TARANTOOL_USER_NAME = os.getenv('TARANTOOL_USER_NAME') - file_cfg.TARANTOOL_USER_PASSWORD = os.getenv('TARANTOOL_USER_PASSWORD') - file_cfg.TARANTOOL_SLAB_ALLOC_ARENA = os.getenv('TARANTOOL_SLAB_ALLOC_ARENA') - file_cfg.TARANTOOL_SLAB_ALLOC_FACTOR = os.getenv('TARANTOOL_SLAB_ALLOC_FACTOR') - file_cfg.TARANTOOL_SLAB_ALLOC_MINIMAL = os.getenv('TARANTOOL_SLAB_ALLOC_MINIMAL') - file_cfg.TARANTOOL_SLAB_ALLOC_MAXIMAL = os.getenv('TARANTOOL_SLAB_ALLOC_MAXIMAL') - file_cfg.TARANTOOL_PORT = os.getenv('TARANTOOL_PORT') - file_cfg.TARANTOOL_WAL_MODE = os.getenv('TARANTOOL_WAL_MODE') - file_cfg.TARANTOOL_REPLICATION_SOURCE = os.getenv('TARANTOOL_REPLICATION_SOURCE') - file_cfg.TARANTOOL_REPLICATION = os.getenv('TARANTOOL_REPLICATION') - file_cfg.TARANTOOL_SNAPSHOT_PERIOD = os.getenv('TARANTOOL_SNAPSHOT_PERIOD') - file_cfg.TARANTOOL_MEMTX_MEMORY = os.getenv('TARANTOOL_MEMTX_MEMORY') - file_cfg.TARANTOOL_CHECKPOINT_INTERVAL = os.getenv('TARANTOOL_CHECKPOINT_INTERVAL') - file_cfg.TARANTOOL_MEMTX_MIN_TUPLE_SIZE = os.getenv('TARANTOOL_MEMTX_MIN_TUPLE_SIZE') - file_cfg.TARANTOOL_MEMTX_MAX_TUPLE_SIZE = os.getenv('TARANTOOL_MEMTX_MAX_TUPLE_SIZE') - - write_config(file_cfg) - else - log.info("Loading existing configuration file: " .. CFG_FILE_PATH) - - file_cfg = read_config() - end - - local user_name = file_cfg.TARANTOOL_USER_NAME or - os.getenv('TARANTOOL_USER_NAME') or 'guest' - local user_password = file_cfg.TARANTOOL_USER_PASSWORD or - os.getenv('TARANTOOL_USER_PASSWORD') - - - local cfg = override or {} - -- Placeholders for deprecated options - cfg.slab_alloc_arena = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_ARENA) or - override.slab_alloc_arena - cfg.slab_alloc_maximal = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_MAXIMAL) or - override.slab_alloc_maximal - cfg.slab_alloc_minimal = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_MINIMAL) or - override.slab_alloc_minimal - cfg.snapshot_period = tonumber(file_cfg.TARANTOOL_SNAPSHOT_PERIOD) or - override.snapshot_period - -- Replacements for deprecated options - cfg.memtx_memory = tonumber(file_cfg.TARANTOOL_MEMTX_MEMORY) or - override.memtx_memory - cfg.memtx_min_tuple_size = tonumber(file_cfg.TARANTOOL_MEMTX_MIN_TUPLE_SIZE) or - override.memtx_min_tuple_size - cfg.memtx_max_tuple_size = tonumber(file_cfg.TARANTOOL_MEMTX_MAX_TUPLE_SIZE) or - override.memtx_max_tuple_size - cfg.checkpoint_interval = tonumber(file_cfg.TARANTOOL_CHECKPOINT_INTERVAL) or - override.checkpoint_interval - -- Deprecated options with default values - local choice = choose_option('memtx_dir', 'snap_dir', override) - cfg[choice] = override[choice] or '/var/lib/tarantool' - - -- Remaining configuration - cfg.slab_alloc_factor = tonumber(file_cfg.TARANTOOL_SLAB_ALLOC_FACTOR) or - override.slab_alloc_factor - cfg.listen = tonumber(file_cfg.TARANTOOL_PORT) or - override.listen or TARANTOOL_DEFAULT_PORT - cfg.wal_mode = file_cfg.TARANTOOL_WAL_MODE or - override.wal_mode - - cfg.wal_dir = override.wal_dir or '/var/lib/tarantool' - cfg.vinyl_dir = override.vinyl_dir or '/var/lib/tarantool' - cfg.pid_file = override.pid_file or '/var/run/tarantool/tarantool.pid' - - local choice = choose_option('TARANTOOL_REPLICATION', 'TARANTOOL_REPLICATION_SOURCE', file_cfg) - local replication_source_table = parse_replication_source(file_cfg[choice], - user_name, - user_password) - - if replication_source_table then - cfg.replication = replication_source_table - else - local choice = choose_option('replication', 'replication_source', override) - cfg[choice] = override[choice] - end - - log.info("Config:\n" .. yaml.encode(cfg)) - - orig_cfg(cfg) - - box.once('tarantool-entrypoint', function () - if first_run then - log.info("Initializing database") - - create_user(user_name, user_password) - end - end) - - console.listen(CONSOLE_SOCKET_PATH) - -end - -box.cfg = wrapper_cfg - --- re-run the script passed as parameter with all arguments that follow -execute_script = arg[1] -if execute_script == nil then - box.cfg {} - - if term.isatty(io.stdout) then - console.start() - os.exit(0) - end -else - narg = 0 - while true do - arg[narg] = arg[narg + 1] - if arg[narg] == nil then - break - end - narg = narg + 1 - end - - dofile(execute_script) -end diff --git a/2.x/tarantool.default b/2.x/tarantool.default deleted file mode 100644 index fffe3b0..0000000 --- a/2.x/tarantool.default +++ /dev/null @@ -1,22 +0,0 @@ --- --- System-wide settings for tarantoolctl and init scripts --- --- This file is meant to enable the usage of tarantoolctl inside --- docker containers. Since there is no init system, most of its --- functionality will not work, except 'tarantoolctl enter' or --- 'tarantoolctl status'. --- - -default_cfg = { - pid_file = "/var/run/tarantool", -- /var/run/tarantool/${INSTANCE}.pid - wal_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE}/ - snap_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE} - vinyl_dir = "/var/lib/tarantool", -- /var/lib/tarantool/${INSTANCE} - logger = "/var/log/tarantool", -- /var/log/tarantool/${INSTANCE}.log - username = "tarantool", -} - --- instances.available - all available instances --- instances.enabled - instances to autostart by sysvinit -instance_dir = "/usr/local/etc/tarantool/instances.enabled" --- vim: set ft=lua : diff --git a/2.x/tarantool_is_up b/2.x/tarantool_is_up deleted file mode 100755 index 71148d5..0000000 --- a/2.x/tarantool_is_up +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -status=$( (tarantool <<-'EOF' -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local console = require('console') -local os = require("os") -local yaml = require("yaml") - -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - os.exit(1) - end - - cmd = 'box.info.status' - local res = self:eval(cmd) - if res ~= nil then - res = yaml.decode(res) - print(res[1]) - end - - os.exit(0) -end) - -console.on_client_disconnect(function(self) self.running = false end) -console.start() - -os.exit(0) -EOF -) 2>/dev/null) - - -echo "$status" - -if [ "$status" = "running" ]; then - exit 0 -else - exit 1 -fi diff --git a/2.x/tarantool_set_config.lua b/2.x/tarantool_set_config.lua deleted file mode 100755 index ddca36c..0000000 --- a/2.x/tarantool_set_config.lua +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env tarantool - -local CONSOLE_SOCKET_PATH = 'unix/:/var/run/tarantool/tarantool.sock' -local CFG_FILE_PATH = '/etc/tarantool/config.yml' - -local fio = require('fio') -local yaml = require('yaml') -local console = require('console') -local errno = require('errno') - -local function read_config() - local f = io.open(CFG_FILE_PATH, "rb") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = f:read("*all") - f:close() - return yaml.decode(content) -end - -local function write_config(cfg) - local f = io.open(CFG_FILE_PATH, "w+") - if f == nil then - print("Can't open " .. CFG_FILE_PATH ..": ", errno.strerror()) - os.exit(1) - end - local content = yaml.encode(cfg) - f:write(content) - f:close() -end - -local function nop(console, cfg, value) -end - -local function update_replication_source(console, cfg, value) - local user_name = "nil" - if cfg['TARANTOOL_USER_NAME'] then - user_name = "'" .. cfg['TARANTOOL_USER_NAME'] .. "'" - end - - local user_password = "nil" - if cfg['TARANTOOL_USER_PASSWORD'] then - user_password = "'" .. cfg['TARANTOOL_USER_PASSWORD'] .. "'" - end - - local cmd = "set_replication_source('"..value.."', " .. user_name .. "," .. user_password .. ")" - print("cmd: ", cmd) - - local res = console:eval(cmd) - - if res ~= nil then - print(res) - end -end - -local function update_credentials(console, cfg, value) - local user_name = "nil" - if cfg['TARANTOOL_USER_NAME'] then - user_name = "'" .. cfg['TARANTOOL_USER_NAME'] .. "'" - end - - local user_password = "nil" - if cfg['TARANTOOL_USER_PASSWORD'] then - user_password = "'" .. cfg['TARANTOOL_USER_PASSWORD'] .. "'" - end - - local cmd = "set_credentials(" .. user_name .. "," .. user_password .. ")" - - local res = console:eval(cmd) - - if res ~= nil then - print(res) - end - - local replication_source = cfg['TARANTOOL_REPLICATION_SOURCE'] - - if replication_source ~= nil then - update_replication_source(console, cfg, replication_source) - end -end - - -local vars = { - TARANTOOL_SLAB_ALLOC_ARENA=nop, - TARANTOOL_SLAB_ALLOC_FACTOR=nop, - TARANTOOL_SLAB_ALLOC_MAXIMAL=nop, - TARANTOOL_SLAB_ALLOC_MINIMAL=nop, - TARANTOOL_PORT=nop, - TARANTOOL_WAL_MODE=nop, - TARANTOOL_USER_NAME=update_credentials, - TARANTOOL_USER_PASSWORD=update_credentials, - TARANTOOL_REPLICATION_SOURCE=update_replication_source, - TARANTOOL_REPLICATION=update_replication_source, -} - -console.on_start(function(self) - local status, reason - status, reason = pcall(function() require('console').connect(CONSOLE_SOCKET_PATH) end) - if not status then - self:print(reason) - os.exit(1) - end - - if arg[1] == nil or arg[2] == nil then - self:print("Usage: " .. arg[0] .. " ") - os.exit(1) - end - - if vars[arg[1]] == nil then - self:print("Unknown var: " .. arg[1]) - os.exit(1) - end - - local cfg = read_config() - cfg[arg[1]] = arg[2] - - local func = vars[arg[1]] - func(self, cfg, arg[2]) - - write_config(cfg) - - self.running = false - os.exit(0) -end) - -console.on_client_disconnect(function(self) self.running = false end) -console.start() - -os.exit(0) diff --git a/README.md b/README.md index fc3872b..bba48ea 100644 --- a/README.md +++ b/README.md @@ -329,24 +329,18 @@ Fixed versions: Rolling versions: -| Branch | Dockerfile | Docker tag | -| ------ | ---------- | ---------- | -| master | 1.5/Dockerfile | 1.5 | -| master | 1.6/Dockerfile | 1.6 | -| master | 1.7/Dockerfile | 1.7 | -| master | 1.9/Dockerfile | 1.9 | -| master | 1.x/Dockerfile | 1 | -| master | 1.x/Dockerfile | latest | -| master | 2.1/Dockerfile | 2.1 | -| master | 2.2/Dockerfile | 2.2 | -| master | 2.x/Dockerfile | 2 | +| Branch | Dockerfile | Docker tags | +| ------ | ---------- | ----------- | +| master | dockerfile/alpine_3.5_1.x | 1 | +| master | dockerfile/alpine_3.5_2.2 | 2.1/2.2 | +| master | dockerfile/alpine_3.5_2.x | 2 | Special builds: -| Branch | Dockerfile | Docker tag | -| ------ | ---------- | ---------- | -| master | 1.x-centos7/Dockerfile | 1.x-centos7 | -| master | 2.x-centos7/Dockerfile | 2.x-centos7 | +| Branch | Dockerfile | Docker tag | +| ------ | ---------- | ---------- | +| master | dockerfile/centos_7_1.x | 1.x-centos7 | +| master | dockerfile/centos_7_2.x | 2.x-centos7 | ## How to push changes (for maintainers) diff --git a/1.x/Dockerfile b/dockerfiles/alpine_3.5_1.x similarity index 92% rename from 1.x/Dockerfile rename to dockerfiles/alpine_3.5_1.x index 7a3dee9..9ccab7f 100644 --- a/1.x/Dockerfile +++ b/dockerfiles/alpine_3.5_1.x @@ -5,7 +5,11 @@ RUN addgroup -S tarantool \ && adduser -S -G tarantool tarantool \ && apk add --no-cache 'su-exec>=0.2' -ENV TARANTOOL_VERSION=1.10.3-136-gc3c087d5c \ +# An ARG instruction goes out of scope at the end of the build +# stage where it was defined. To use an arg in multiple stages, +# each stage must include the ARG instruction +ARG TNT_VER +ENV TARANTOOL_VERSION=${TNT_VER} \ TARANTOOL_DOWNLOAD_URL=https://github.com/tarantool/tarantool.git \ TARANTOOL_INSTALL_LUADIR=/usr/local/share/tarantool \ GPERFTOOLS_REPO=https://github.com/gperftools/gperftools.git \ @@ -26,7 +30,7 @@ ENV TARANTOOL_VERSION=1.10.3-136-gc3c087d5c \ LUAROCK_TARANTOOL_PROMETHEUS_VERSION=1.0.0 \ LUAROCK_TARANTOOL_GPERFTOOLS_VERSION=1.0.1 -COPY gperftools_alpine.diff / +COPY files/gperftools_alpine.diff / RUN set -x \ && apk add --no-cache --virtual .run-deps \ @@ -130,7 +134,7 @@ RUN set -x \ && : "---------- remove build deps ----------" \ && apk del .build-deps -COPY luarocks-config.lua /usr/local/etc/luarocks/config-5.1.lua +COPY files/luarocks-config.lua /usr/local/etc/luarocks/config-5.1.lua RUN set -x \ && apk add --no-cache --virtual .run-deps \ @@ -221,12 +225,12 @@ RUN mkdir -p /var/lib/tarantool \ VOLUME /var/lib/tarantool WORKDIR /opt/tarantool -COPY tarantool-entrypoint.lua /usr/local/bin/ -COPY tarantool_set_config.lua /usr/local/bin/ -COPY docker-entrypoint.sh /usr/local/bin/ -COPY console /usr/local/bin/ -COPY tarantool_is_up /usr/local/bin/ -COPY tarantool.default /usr/local/etc/default/tarantool +COPY files/tarantool-entrypoint.lua /usr/local/bin/ +COPY files/tarantool_set_config.lua /usr/local/bin/ +COPY files/docker-entrypoint.sh /usr/local/bin/ +COPY files/console /usr/local/bin/ +COPY files/tarantool_is_up /usr/local/bin/ +COPY files/tarantool.default /usr/local/etc/default/tarantool RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/2.2/Dockerfile b/dockerfiles/alpine_3.5_2.2 similarity index 92% rename from 2.2/Dockerfile rename to dockerfiles/alpine_3.5_2.2 index 22102e6..8b2517b 100644 --- a/2.2/Dockerfile +++ b/dockerfiles/alpine_3.5_2.2 @@ -5,7 +5,11 @@ RUN addgroup -S tarantool \ && adduser -S -G tarantool tarantool \ && apk add --no-cache 'su-exec>=0.2' -ENV TARANTOOL_VERSION=2.2.2-4-g4f8ac5999 \ +# An ARG instruction goes out of scope at the end of the build +# stage where it was defined. To use an arg in multiple stages, +# each stage must include the ARG instruction +ARG TNT_VER +ENV TARANTOOL_VERSION=${TNT_VER} \ TARANTOOL_DOWNLOAD_URL=https://github.com/tarantool/tarantool.git \ TARANTOOL_INSTALL_LUADIR=/usr/local/share/tarantool \ CURL_REPO=https://github.com/curl/curl.git \ @@ -28,7 +32,7 @@ ENV TARANTOOL_VERSION=2.2.2-4-g4f8ac5999 \ LUAROCK_TARANTOOL_PROMETHEUS_VERSION=1.0.0 \ LUAROCK_TARANTOOL_GPERFTOOLS_VERSION=1.0.1 -COPY gperftools_alpine.diff / +COPY files/gperftools_alpine.diff / RUN set -x \ && apk add --no-cache --virtual .run-deps \ @@ -139,7 +143,7 @@ RUN set -x \ && : "---------- remove build deps ----------" \ && apk del .build-deps -COPY luarocks-config.lua /usr/local/etc/luarocks/config-5.1.lua +COPY files/luarocks-config.lua /usr/local/etc/luarocks/config-5.1.lua RUN set -x \ && apk add --no-cache --virtual .run-deps \ @@ -230,12 +234,12 @@ RUN mkdir -p /var/lib/tarantool \ VOLUME /var/lib/tarantool WORKDIR /opt/tarantool -COPY tarantool-entrypoint.lua /usr/local/bin/ -COPY tarantool_set_config.lua /usr/local/bin/ -COPY docker-entrypoint.sh /usr/local/bin/ -COPY console /usr/local/bin/ -COPY tarantool_is_up /usr/local/bin/ -COPY tarantool.default /usr/local/etc/default/tarantool +COPY files/tarantool-entrypoint.lua /usr/local/bin/ +COPY files/tarantool_set_config.lua /usr/local/bin/ +COPY files/docker-entrypoint.sh /usr/local/bin/ +COPY files/console /usr/local/bin/ +COPY files/tarantool_is_up /usr/local/bin/ +COPY files/tarantool.default /usr/local/etc/default/tarantool RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/2.x/Dockerfile b/dockerfiles/alpine_3.5_2.x similarity index 92% rename from 2.x/Dockerfile rename to dockerfiles/alpine_3.5_2.x index c877e7f..d1d331e 100644 --- a/2.x/Dockerfile +++ b/dockerfiles/alpine_3.5_2.x @@ -5,7 +5,11 @@ RUN addgroup -S tarantool \ && adduser -S -G tarantool tarantool \ && apk add --no-cache 'su-exec>=0.2' -ENV TARANTOOL_VERSION=2.3.1-1-g4137134c0 \ +# An ARG instruction goes out of scope at the end of the build +# stage where it was defined. To use an arg in multiple stages, +# each stage must include the ARG instruction +ARG TNT_VER +ENV TARANTOOL_VERSION=${TNT_VER} \ TARANTOOL_DOWNLOAD_URL=https://github.com/tarantool/tarantool.git \ GPERFTOOLS_REPO=https://github.com/gperftools/gperftools.git \ GPERFTOOLS_TAG=gperftools-2.5 \ @@ -23,7 +27,7 @@ ENV TARANTOOL_VERSION=2.3.1-1-g4137134c0 \ LUAROCK_TARANTOOL_PROMETHEUS_VERSION=1.0.0 \ LUAROCK_TARANTOOL_GPERFTOOLS_VERSION=1.0.1 -COPY gperftools_alpine.diff / +COPY files/gperftools_alpine.diff / RUN set -x \ && apk add --no-cache --virtual .run-deps \ @@ -189,12 +193,12 @@ RUN mkdir -p /var/lib/tarantool \ VOLUME /var/lib/tarantool WORKDIR /opt/tarantool -COPY tarantool-entrypoint.lua /usr/local/bin/ -COPY tarantool_set_config.lua /usr/local/bin/ -COPY docker-entrypoint.sh /usr/local/bin/ -COPY console /usr/local/bin/ -COPY tarantool_is_up /usr/local/bin/ -COPY tarantool.default /usr/local/etc/default/tarantool +COPY files/tarantool-entrypoint.lua /usr/local/bin/ +COPY files/tarantool_set_config.lua /usr/local/bin/ +COPY files/docker-entrypoint.sh /usr/local/bin/ +COPY files/console /usr/local/bin/ +COPY files/tarantool_is_up /usr/local/bin/ +COPY files/tarantool.default /usr/local/etc/default/tarantool RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/1.x-centos7/Dockerfile b/dockerfiles/centos_7_1.x similarity index 95% rename from 1.x-centos7/Dockerfile rename to dockerfiles/centos_7_1.x index c387b09..7405c79 100644 --- a/1.x-centos7/Dockerfile +++ b/dockerfiles/centos_7_1.x @@ -1,10 +1,12 @@ +ARG TNT_VER + FROM centos:7 MAINTAINER mail@racktear.com RUN groupadd tarantool \ && adduser -g tarantool tarantool -ENV TARANTOOL_VERSION=1.10.3-136-gc3c087d5c \ +ENV TARANTOOL_VERSION=${TNT_VER} \ TARANTOOL_DOWNLOAD_URL=https://github.com/tarantool/tarantool.git \ TARANTOOL_INSTALL_LUADIR=/usr/local/share/tarantool \ LUAROCKS_URL=https://github.com/tarantool/luarocks/archive/6e6fe62d9409fe2103c0fd091cccb3da0451faf5.tar.gz \ @@ -155,7 +157,7 @@ RUN set -x \ && rm -rf /var/cache/yum -COPY luarocks-config.lua /usr/local/etc/luarocks/config-5.1.lua +COPY files/luarocks-config_centos.lua /usr/local/etc/luarocks/config-5.1.lua RUN set -x \ && yum -y install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm \ @@ -261,12 +263,12 @@ RUN mkdir -p /var/lib/tarantool \ VOLUME /var/lib/tarantool WORKDIR /opt/tarantool -COPY tarantool-entrypoint.lua /usr/local/bin/ -COPY tarantool_set_config.lua /usr/local/bin/ -COPY docker-entrypoint.sh /usr/local/bin/ -COPY console /usr/local/bin/ -COPY tarantool_is_up /usr/local/bin/ -COPY tarantool.default /usr/local/etc/default/tarantool +COPY files/tarantool-entrypoint.lua /usr/local/bin/ +COPY files/tarantool_set_config.lua /usr/local/bin/ +COPY files/docker-entrypoint_centos.sh /usr/local/bin/docker-entrypoint.sh +COPY files/console /usr/local/bin/ +COPY files/tarantool_is_up /usr/local/bin/ +COPY files/tarantool.default /usr/local/etc/default/tarantool RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/2.x-centos7/Dockerfile b/dockerfiles/centos_7_2.x similarity index 94% rename from 2.x-centos7/Dockerfile rename to dockerfiles/centos_7_2.x index 7316a1b..8871562 100644 --- a/2.x-centos7/Dockerfile +++ b/dockerfiles/centos_7_2.x @@ -1,12 +1,13 @@ +ARG TNT_VER + FROM centos:7 MAINTAINER mail@racktear.com RUN groupadd tarantool \ && adduser -g tarantool tarantool -ARG TARANTOOL_VERSION=2.3.1-1-g4137134c0 - -ENV TARANTOOL_DOWNLOAD_URL=https://github.com/tarantool/tarantool.git \ +ENV TARANTOOL_VERSION=${TNT_VER} \ + TARANTOOL_DOWNLOAD_URL=https://github.com/tarantool/tarantool.git \ LUAROCK_VSHARD_VERSION=0.1.14 \ LUAROCK_CHECKS_VERSION=3.0.1 \ LUAROCK_AVRO_SCHEMA_VERSION=3.0.3 \ @@ -118,7 +119,6 @@ RUN set -x \ && rpm -qa | grep devel | xargs yum -y remove \ && rm -rf /var/cache/yum - RUN set -x \ && yum -y install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm \ && yum -y install \ @@ -222,12 +222,12 @@ RUN mkdir -p /var/lib/tarantool \ VOLUME /var/lib/tarantool WORKDIR /opt/tarantool -COPY tarantool-entrypoint.lua /usr/local/bin/ -COPY tarantool_set_config.lua /usr/local/bin/ -COPY docker-entrypoint.sh /usr/local/bin/ -COPY console /usr/local/bin/ -COPY tarantool_is_up /usr/local/bin/ -COPY tarantool.default /usr/local/etc/default/tarantool +COPY files/tarantool-entrypoint.lua /usr/local/bin/ +COPY files/tarantool_set_config.lua /usr/local/bin/ +COPY files/docker-entrypoint_centos.sh /usr/local/bin/docker-entrypoint.sh +COPY files/console /usr/local/bin/ +COPY files/tarantool_is_up /usr/local/bin/ +COPY files/tarantool.default /usr/local/etc/default/tarantool RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/1.6/console b/files/console similarity index 100% rename from 1.6/console rename to files/console diff --git a/1.6/docker-entrypoint.sh b/files/docker-entrypoint.sh similarity index 100% rename from 1.6/docker-entrypoint.sh rename to files/docker-entrypoint.sh diff --git a/1.x-centos7/docker-entrypoint.sh b/files/docker-entrypoint_centos.sh similarity index 100% rename from 1.x-centos7/docker-entrypoint.sh rename to files/docker-entrypoint_centos.sh diff --git a/1.6/gperftools_alpine.diff b/files/gperftools_alpine.diff similarity index 100% rename from 1.6/gperftools_alpine.diff rename to files/gperftools_alpine.diff diff --git a/1.5/luarocks-config.lua b/files/luarocks-config.lua similarity index 100% rename from 1.5/luarocks-config.lua rename to files/luarocks-config.lua diff --git a/1.x-centos7/luarocks-config.lua b/files/luarocks-config_centos.lua similarity index 100% rename from 1.x-centos7/luarocks-config.lua rename to files/luarocks-config_centos.lua diff --git a/1.x-centos7/mosquitto.repo b/files/mosquitto.repo similarity index 100% rename from 1.x-centos7/mosquitto.repo rename to files/mosquitto.repo diff --git a/2.x-centos7/tarantool-entrypoint.lua b/files/tarantool-entrypoint.lua similarity index 100% rename from 2.x-centos7/tarantool-entrypoint.lua rename to files/tarantool-entrypoint.lua diff --git a/1.7/tarantool.default b/files/tarantool.default similarity index 100% rename from 1.7/tarantool.default rename to files/tarantool.default diff --git a/1.6/tarantool_is_up b/files/tarantool_is_up similarity index 100% rename from 1.6/tarantool_is_up rename to files/tarantool_is_up diff --git a/2.x-centos7/tarantool_set_config.lua b/files/tarantool_set_config.lua similarity index 100% rename from 2.x-centos7/tarantool_set_config.lua rename to files/tarantool_set_config.lua diff --git a/versions/alpine_3.5_1.x b/versions/alpine_3.5_1.x new file mode 100644 index 0000000..e57a593 --- /dev/null +++ b/versions/alpine_3.5_1.x @@ -0,0 +1 @@ +1.10.3-136-gc3c087d5c diff --git a/versions/alpine_3.5_2.1 b/versions/alpine_3.5_2.1 new file mode 100644 index 0000000..d97a56a --- /dev/null +++ b/versions/alpine_3.5_2.1 @@ -0,0 +1 @@ +2.1.2-143-g3edaaed6c diff --git a/versions/alpine_3.5_2.2 b/versions/alpine_3.5_2.2 new file mode 100644 index 0000000..243a7ec --- /dev/null +++ b/versions/alpine_3.5_2.2 @@ -0,0 +1 @@ +2.2.2-4-g4f8ac5999 diff --git a/versions/alpine_3.5_2.x b/versions/alpine_3.5_2.x new file mode 100644 index 0000000..7158865 --- /dev/null +++ b/versions/alpine_3.5_2.x @@ -0,0 +1 @@ +2.3.1-1-g4137134c0 diff --git a/versions/centos_7_1.x b/versions/centos_7_1.x new file mode 100644 index 0000000..e57a593 --- /dev/null +++ b/versions/centos_7_1.x @@ -0,0 +1 @@ +1.10.3-136-gc3c087d5c diff --git a/versions/centos_7_2.x b/versions/centos_7_2.x new file mode 100644 index 0000000..4b74589 --- /dev/null +++ b/versions/centos_7_2.x @@ -0,0 +1 @@ +2.3.0-117-g4c2d1eff2 -- 2.17.1