From 3c9c0d2bab5c67df7bf4abab4c21e13e3b64d8d2 Mon Sep 17 00:00:00 2001 From: mcoberly2 Date: Tue, 17 Oct 2023 22:02:29 +0000 Subject: [PATCH] 6.4.0.6_1 --- community/debian12/Dockerfile | 190 ++++++++++++++++++++ community/debian12/README.md | 5 + community/debian12/aerospike.template.conf | 67 +++++++ community/debian12/entrypoint.sh | 83 +++++++++ enterprise/debian12/Dockerfile | 190 ++++++++++++++++++++ enterprise/debian12/README.md | 5 + enterprise/debian12/aerospike.template.conf | 67 +++++++ enterprise/debian12/entrypoint.sh | 83 +++++++++ federal/debian12/Dockerfile | 190 ++++++++++++++++++++ federal/debian12/README.md | 5 + federal/debian12/aerospike.template.conf | 67 +++++++ federal/debian12/entrypoint.sh | 83 +++++++++ 12 files changed, 1035 insertions(+) create mode 100644 community/debian12/Dockerfile create mode 100644 community/debian12/README.md create mode 100644 community/debian12/aerospike.template.conf create mode 100755 community/debian12/entrypoint.sh create mode 100644 enterprise/debian12/Dockerfile create mode 100644 enterprise/debian12/README.md create mode 100644 enterprise/debian12/aerospike.template.conf create mode 100755 enterprise/debian12/entrypoint.sh create mode 100644 federal/debian12/Dockerfile create mode 100644 federal/debian12/README.md create mode 100644 federal/debian12/aerospike.template.conf create mode 100755 federal/debian12/entrypoint.sh diff --git a/community/debian12/Dockerfile b/community/debian12/Dockerfile new file mode 100644 index 00000000..cf810f97 --- /dev/null +++ b/community/debian12/Dockerfile @@ -0,0 +1,190 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM debian:bookworm-slim + +# AEROSPIKE_EDITION - required - must be "community", "enterprise", or +# "federal". +# By selecting "community" you agree to the "COMMUNITY_LICENSE". +# By selecting "enterprise" you agree to the "ENTERPRISE_LICENSE". +# By selecting "federal" you agree to the "FEDERAL_LICENSE" +ARG AEROSPIKE_EDITION="community" + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-community/6.4.0.6/aerospike-server-community_6.4.0.6_tools-9.2.1_debian12_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="052a6632009589505a07685334285cca2ce6111643877f4e1196d40b8a52e8fb" +ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-community/6.4.0.6/aerospike-server-community_6.4.0.6_tools-9.2.1_debian12_aarch64.tgz" +ARG AEROSPIKE_SHA_AARCH64="62bc0c5ad4f1f4ed3b4ebb3690e7481b3e4442522d098dbb2210f6d1fccd88f6" + +SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"] + +# Install Aerospike Server and Tools +RUN \ + { \ + # 00-prelude-deb.part - Setup dependencies for scripts. + export DEBIAN_FRONTEND=noninteractive; \ + apt-get update -y; \ + apt-get install -y --no-install-recommends apt-utils; \ + apt-get install -y --no-install-recommends \ + binutils \ + ca-certificates \ + curl \ + xz-utils; \ + }; \ + { \ + # 00-prelude-deb.part - Install procps for tests. + apt-get install -y --no-install-recommends procps; \ + }; \ + { \ + # 10-download.part - Vars used for tini and tools. + VERSION="$(grep -oE "/[0-9]+[.][0-9]+[.][0-9]+([.][0-9]+)+(-rc[0-9]+)*/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/')"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(dpkg --print-architecture)"; \ + if [ "${ARCH}" = "amd64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "arm64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + curl -fsSL "https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}" --output /usr/bin/as-tini-static; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(dpkg --print-architecture)"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "amd64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "arm64" ]; then \ + pkg_link="${AEROSPIKE_AARCH64_LINK}"; \ + sha256="${AEROSPIKE_SHA_AARCH64}"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + if ! curl -fsSL "${pkg_link}" --output aerospike-server.tgz; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm aerospike-server.tgz; \ + # These directories are required for backward compatibility. + mkdir -p /var/{log,run}/aerospike; \ + # Copy license file to standard location. + mkdir -p /licenses; \ + cp aerospike/LICENSE /licenses; \ + }; \ + { \ + # 20-install-dependencies-deb.part - Install server and dependencies. + if [ "${AEROSPIKE_EDITION}" = "enterprise" ]; then \ + apt-get install -y --no-install-recommends \ + libcurl4 \ + libldap-2.4.2; \ + elif ! [ "$(printf "%s\n%s" "${VERSION}" "6.0" | sort -V | head -1)" != "${VERSION}" ]; then \ + apt-get install -y --no-install-recommends \ + libcurl4; \ + fi; \ + dpkg -i aerospike/aerospike-server-*.deb; \ + rm -rf /opt/aerospike/bin; \ + }; \ + { \ + # 20-install-dependencies-deb.part - Install tools dependencies. + if ! [ "$(printf "%s\n%s" "${VERSION}" "5.1" | sort -V | head -1)" != "${VERSION}" ]; then \ + # Tools before 5.1 need python2. + apt-get install -y --no-install-recommends \ + python2; \ + elif ! [ "$(printf "%s\n%s" "${VERSION}" "6.2.0.3" | sort -V | head -1)" != "${VERSION}" ]; then \ + # Tools before 6.0 need python3. + apt-get install -y --no-install-recommends \ + python3 \ + python3-distutils; \ + fi; \ + # Tools after 6.0 bundled their own python interpreter. + }; \ + { \ + # 20-install-dependencies-deb.part - Extract tools. + # ar on debian10 doesn't support '--output' + pushd aerospike/pkg || exit 1; \ + ar -x ../aerospike-tools*.deb; \ + popd || exit 1; \ + tar xf aerospike/pkg/data.tar.xz -C aerospike/pkg/; \ + }; \ + { \ + # 30-install-tools.part - install asinfo and asadm. + find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} +; \ + mv aerospike/pkg/etc/aerospike/astools.conf /etc/aerospike; \ + if ! [ "$(printf "%s\n%s" "${VERSION}" "6.2" | sort -V | head -1)" != "${VERSION}" ]; then \ + mv aerospike/pkg/opt/aerospike/bin/aql /usr/bin; \ + fi; \ + if [ -d 'aerospike/pkg/opt/aerospike/bin/asadm' ]; then \ + # Since tools release 7.0.5, asadm has been moved from + # /opt/aerospike/bin/asadm to /opt/aerospike/bin/asadm/asadm + # (inside an asadm directory). + mv aerospike/pkg/opt/aerospike/bin/asadm /usr/lib/; \ + else \ + mkdir /usr/lib/asadm; \ + mv aerospike/pkg/opt/aerospike/bin/asadm /usr/lib/asadm/; \ + fi; \ + ln -s /usr/lib/asadm/asadm /usr/bin/asadm; \ + if [ -f 'aerospike/pkg/opt/aerospike/bin/asinfo' ]; then \ + # Since tools release 7.1.1, asinfo has been moved from + # /opt/aerospike/bin/asinfo to /opt/aerospike/bin/asadm/asinfo + # (inside an asadm directory). + mv aerospike/pkg/opt/aerospike/bin/asinfo /usr/lib/asadm/; \ + fi; \ + ln -s /usr/lib/asadm/asinfo /usr/bin/asinfo; \ + }; \ + { \ + # 40-cleanup.part - remove extracted aerospike pkg directory. + rm -rf aerospike; \ + }; \ + { \ + # 50-remove-prelude-deb.part - Remove dependencies for scripts. + rm -rf /var/lib/apt/lists/*; \ + dpkg --purge \ + apt-utils \ + binutils \ + ca-certificates \ + curl \ + xz-utils 2>&1; \ + apt-get purge -y; \ + apt-get autoremove -y; \ + unset DEBIAN_FRONTEND; \ + }; \ + echo "done"; + +# Add the Aerospike configuration specific to this dockerfile +COPY aerospike.template.conf /etc/aerospike/aerospike.template.conf + +# Mount the Aerospike data directory +# VOLUME ["/opt/aerospike/data"] +# Mount the Aerospike config directory +# VOLUME ["/etc/aerospike/"] + +# Expose Aerospike ports +# +# 3000 – service port, for client connections +# 3001 – fabric port, for cluster communication +# 3002 – mesh port, for cluster heartbeat +# +EXPOSE 3000 3001 3002 + +COPY entrypoint.sh /entrypoint.sh + +# Tini init set to restart ASD on SIGUSR1 and terminate ASD on SIGTERM +ENTRYPOINT ["/usr/bin/as-tini-static", "-r", "SIGUSR1", "-t", "SIGTERM", "--", "/entrypoint.sh"] + +# Execute the run script in foreground mode +CMD ["asd"] diff --git a/community/debian12/README.md b/community/debian12/README.md new file mode 100644 index 00000000..a0bb028c --- /dev/null +++ b/community/debian12/README.md @@ -0,0 +1,5 @@ +# Dockerfile Template + +These files are managed by `update.sh`, do not edit files outside of the `template` directory. + +After updating files in the `template` directory, be sure to run `update.sh` before committing. diff --git a/community/debian12/aerospike.template.conf b/community/debian12/aerospike.template.conf new file mode 100644 index 00000000..6737692b --- /dev/null +++ b/community/debian12/aerospike.template.conf @@ -0,0 +1,67 @@ +# Aerospike database configuration file +# This template sets up a single-node, single namespace developer environment. +# +# Alternatively, you can pass in your own configuration file. +# You can see more examples at +# https://github.com/aerospike/aerospike-server/tree/master/as/etc + +# This stanza must come first. +service { + $([ -n "${FEATURE_KEY_FILE}" ] && echo "feature-key-file ${FEATURE_KEY_FILE}") +} + +logging { + $([ -n "${LOGFILE}" ] && echo "# Log file must be an absolute path.") + $([ -n "${LOGFILE}" ] && echo "file ${LOGFILE} {") + $([ -n "${LOGFILE}" ] && echo " context any info") + $([ -n "${LOGFILE}" ] && echo "}") + + # Send log messages to stdout + console { + context any info + } +} + +network { + service { + address ${SERVICE_ADDRESS} + port ${SERVICE_PORT} + + # Uncomment the following to set the 'access-address' parameter to the + # IP address of the Docker host. This will the allow the server to correctly + # publish the address which applications and other nodes in the cluster to + # use when addressing this node. + # access-address + } + + heartbeat { + # mesh is used for environments that do not support multicast + mode mesh + address local + port 3002 + interval 150 + timeout 10 + } + + fabric { + # Intra-cluster communication port (migrates, replication, etc) + # default to same address in 'service' + address local + port 3001 + } + +} + +namespace ${NAMESPACE} { + default-ttl ${DEFAULT_TTL} # use 0 to never expire/evict. + memory-size ${MEM_GB}G + nsup-period ${NSUP_PERIOD} + replication-factor 1 + storage-engine device { + data-in-memory ${DATA_IN_MEMORY} # if true, in-memory, persisted to the filesystem + file /opt/aerospike/data/${NAMESPACE}.dat + filesize ${STORAGE_GB}G + read-page-cache ${READ_PAGE_CACHE} + } +} + diff --git a/community/debian12/entrypoint.sh b/community/debian12/entrypoint.sh new file mode 100755 index 00000000..1aa9d0ea --- /dev/null +++ b/community/debian12/entrypoint.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash + +set -Eeuo pipefail + +export FEATURE_KEY_FILE=${FEATURE_KEY_FILE:-"/etc/aerospike/features.conf"} +export LOGFILE=${LOGFILE:-""} +export SERVICE_ADDRESS=${SERVICE_ADDRESS:-any} +export SERVICE_PORT=${SERVICE_PORT:-3000} +export NAMESPACE=${NAMESPACE:-test} +export DATA_IN_MEMORY=${DATA_IN_MEMORY:-false} +export DEFAULT_TTL=${DEFAULT_TTL:-30d} +export MEM_GB=${MEM_GB:-1} +export NSUP_PERIOD=${NSUP_PERIOD:-120} +export STORAGE_GB=${STORAGE_GB:-4} + +if [ "${DATA_IN_MEMORY}" = "true" ]; then + export READ_PAGE_CACHE="false" +else + export READ_PAGE_CACHE="true" +fi + +if asd --version | grep -q "Community"; then + FEATURE_KEY_FILE="" # invalid for community edition +fi + +function bash_eval_template() { + local template_file=$1 + local target_file=$2 + + echo "" >"${target_file}" + + while IFS= read -r line; do + if grep -qE "[$][(]|[{]" <<<"${line}"; then + local update + update=$(eval echo "\"${line}\"") || exit 1 + grep -qE "[^[:space:]]*" <<<"${update}" && echo "${update}" >>"${target_file}" + else + echo "${line}" >>"${target_file}" + fi + done <"${template_file}" + + # Ignore failure when template is mounted in a read-only filesystem. + rm "${template_file}" || true +} + +# Fill out conffile with above values +if [ -f /etc/aerospike/aerospike.template.conf ]; then + conf=/etc/aerospike/aerospike.conf + template=/etc/aerospike/aerospike.template.conf + + bash_eval_template "${template}" "${conf}" +fi + +# if command starts with an option, prepend asd +if [ "${1:0:1}" = '-' ]; then + set -- asd "$@" +fi + +# if asd is specified for the command, start it with any given options +if [ "$1" = 'asd' ]; then + NETLINK=${NETLINK:-eth0} + + # We will wait a bit for the network link to be up. + NETLINK_UP=0 + NETLINK_COUNT=0 + + echo "link ${NETLINK} state $(cat /sys/class/net/"${NETLINK}"/operstate)" + + while [ ${NETLINK_UP} -eq 0 ] && [ ${NETLINK_COUNT} -lt 20 ]; do + if grep -q "up" /sys/class/net/"${NETLINK}"/operstate; then + NETLINK_UP=1 + else + sleep 0.1 + ((++NETLINK_COUNT)) + fi + done + + echo "link ${NETLINK} state $(cat /sys/class/net/"${NETLINK}"/operstate) in ${NETLINK_COUNT}" + # asd should always run in the foreground. + set -- "$@" --foreground +fi + +exec "$@" diff --git a/enterprise/debian12/Dockerfile b/enterprise/debian12/Dockerfile new file mode 100644 index 00000000..828d59de --- /dev/null +++ b/enterprise/debian12/Dockerfile @@ -0,0 +1,190 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM debian:bookworm-slim + +# AEROSPIKE_EDITION - required - must be "community", "enterprise", or +# "federal". +# By selecting "community" you agree to the "COMMUNITY_LICENSE". +# By selecting "enterprise" you agree to the "ENTERPRISE_LICENSE". +# By selecting "federal" you agree to the "FEDERAL_LICENSE" +ARG AEROSPIKE_EDITION="enterprise" + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/6.4.0.6/aerospike-server-enterprise_6.4.0.6_tools-9.2.1_debian12_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="6e39fe0cc77498ed9384829a40cde3ee0d073391ecb8a4d9b39ec00375b9944d" +ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/6.4.0.6/aerospike-server-enterprise_6.4.0.6_tools-9.2.1_debian12_aarch64.tgz" +ARG AEROSPIKE_SHA_AARCH64="4437394bdf010b722bc0924b2cbc2938bf64ec617079c141a0df194cd75b76c3" + +SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"] + +# Install Aerospike Server and Tools +RUN \ + { \ + # 00-prelude-deb.part - Setup dependencies for scripts. + export DEBIAN_FRONTEND=noninteractive; \ + apt-get update -y; \ + apt-get install -y --no-install-recommends apt-utils; \ + apt-get install -y --no-install-recommends \ + binutils \ + ca-certificates \ + curl \ + xz-utils; \ + }; \ + { \ + # 00-prelude-deb.part - Install procps for tests. + apt-get install -y --no-install-recommends procps; \ + }; \ + { \ + # 10-download.part - Vars used for tini and tools. + VERSION="$(grep -oE "/[0-9]+[.][0-9]+[.][0-9]+([.][0-9]+)+(-rc[0-9]+)*/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/')"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(dpkg --print-architecture)"; \ + if [ "${ARCH}" = "amd64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "arm64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + curl -fsSL "https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}" --output /usr/bin/as-tini-static; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(dpkg --print-architecture)"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "amd64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "arm64" ]; then \ + pkg_link="${AEROSPIKE_AARCH64_LINK}"; \ + sha256="${AEROSPIKE_SHA_AARCH64}"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + if ! curl -fsSL "${pkg_link}" --output aerospike-server.tgz; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm aerospike-server.tgz; \ + # These directories are required for backward compatibility. + mkdir -p /var/{log,run}/aerospike; \ + # Copy license file to standard location. + mkdir -p /licenses; \ + cp aerospike/LICENSE /licenses; \ + }; \ + { \ + # 20-install-dependencies-deb.part - Install server and dependencies. + if [ "${AEROSPIKE_EDITION}" = "enterprise" ]; then \ + apt-get install -y --no-install-recommends \ + libcurl4 \ + libldap-2.4.2; \ + elif ! [ "$(printf "%s\n%s" "${VERSION}" "6.0" | sort -V | head -1)" != "${VERSION}" ]; then \ + apt-get install -y --no-install-recommends \ + libcurl4; \ + fi; \ + dpkg -i aerospike/aerospike-server-*.deb; \ + rm -rf /opt/aerospike/bin; \ + }; \ + { \ + # 20-install-dependencies-deb.part - Install tools dependencies. + if ! [ "$(printf "%s\n%s" "${VERSION}" "5.1" | sort -V | head -1)" != "${VERSION}" ]; then \ + # Tools before 5.1 need python2. + apt-get install -y --no-install-recommends \ + python2; \ + elif ! [ "$(printf "%s\n%s" "${VERSION}" "6.2.0.3" | sort -V | head -1)" != "${VERSION}" ]; then \ + # Tools before 6.0 need python3. + apt-get install -y --no-install-recommends \ + python3 \ + python3-distutils; \ + fi; \ + # Tools after 6.0 bundled their own python interpreter. + }; \ + { \ + # 20-install-dependencies-deb.part - Extract tools. + # ar on debian10 doesn't support '--output' + pushd aerospike/pkg || exit 1; \ + ar -x ../aerospike-tools*.deb; \ + popd || exit 1; \ + tar xf aerospike/pkg/data.tar.xz -C aerospike/pkg/; \ + }; \ + { \ + # 30-install-tools.part - install asinfo and asadm. + find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} +; \ + mv aerospike/pkg/etc/aerospike/astools.conf /etc/aerospike; \ + if ! [ "$(printf "%s\n%s" "${VERSION}" "6.2" | sort -V | head -1)" != "${VERSION}" ]; then \ + mv aerospike/pkg/opt/aerospike/bin/aql /usr/bin; \ + fi; \ + if [ -d 'aerospike/pkg/opt/aerospike/bin/asadm' ]; then \ + # Since tools release 7.0.5, asadm has been moved from + # /opt/aerospike/bin/asadm to /opt/aerospike/bin/asadm/asadm + # (inside an asadm directory). + mv aerospike/pkg/opt/aerospike/bin/asadm /usr/lib/; \ + else \ + mkdir /usr/lib/asadm; \ + mv aerospike/pkg/opt/aerospike/bin/asadm /usr/lib/asadm/; \ + fi; \ + ln -s /usr/lib/asadm/asadm /usr/bin/asadm; \ + if [ -f 'aerospike/pkg/opt/aerospike/bin/asinfo' ]; then \ + # Since tools release 7.1.1, asinfo has been moved from + # /opt/aerospike/bin/asinfo to /opt/aerospike/bin/asadm/asinfo + # (inside an asadm directory). + mv aerospike/pkg/opt/aerospike/bin/asinfo /usr/lib/asadm/; \ + fi; \ + ln -s /usr/lib/asadm/asinfo /usr/bin/asinfo; \ + }; \ + { \ + # 40-cleanup.part - remove extracted aerospike pkg directory. + rm -rf aerospike; \ + }; \ + { \ + # 50-remove-prelude-deb.part - Remove dependencies for scripts. + rm -rf /var/lib/apt/lists/*; \ + dpkg --purge \ + apt-utils \ + binutils \ + ca-certificates \ + curl \ + xz-utils 2>&1; \ + apt-get purge -y; \ + apt-get autoremove -y; \ + unset DEBIAN_FRONTEND; \ + }; \ + echo "done"; + +# Add the Aerospike configuration specific to this dockerfile +COPY aerospike.template.conf /etc/aerospike/aerospike.template.conf + +# Mount the Aerospike data directory +# VOLUME ["/opt/aerospike/data"] +# Mount the Aerospike config directory +# VOLUME ["/etc/aerospike/"] + +# Expose Aerospike ports +# +# 3000 – service port, for client connections +# 3001 – fabric port, for cluster communication +# 3002 – mesh port, for cluster heartbeat +# +EXPOSE 3000 3001 3002 + +COPY entrypoint.sh /entrypoint.sh + +# Tini init set to restart ASD on SIGUSR1 and terminate ASD on SIGTERM +ENTRYPOINT ["/usr/bin/as-tini-static", "-r", "SIGUSR1", "-t", "SIGTERM", "--", "/entrypoint.sh"] + +# Execute the run script in foreground mode +CMD ["asd"] diff --git a/enterprise/debian12/README.md b/enterprise/debian12/README.md new file mode 100644 index 00000000..a0bb028c --- /dev/null +++ b/enterprise/debian12/README.md @@ -0,0 +1,5 @@ +# Dockerfile Template + +These files are managed by `update.sh`, do not edit files outside of the `template` directory. + +After updating files in the `template` directory, be sure to run `update.sh` before committing. diff --git a/enterprise/debian12/aerospike.template.conf b/enterprise/debian12/aerospike.template.conf new file mode 100644 index 00000000..6737692b --- /dev/null +++ b/enterprise/debian12/aerospike.template.conf @@ -0,0 +1,67 @@ +# Aerospike database configuration file +# This template sets up a single-node, single namespace developer environment. +# +# Alternatively, you can pass in your own configuration file. +# You can see more examples at +# https://github.com/aerospike/aerospike-server/tree/master/as/etc + +# This stanza must come first. +service { + $([ -n "${FEATURE_KEY_FILE}" ] && echo "feature-key-file ${FEATURE_KEY_FILE}") +} + +logging { + $([ -n "${LOGFILE}" ] && echo "# Log file must be an absolute path.") + $([ -n "${LOGFILE}" ] && echo "file ${LOGFILE} {") + $([ -n "${LOGFILE}" ] && echo " context any info") + $([ -n "${LOGFILE}" ] && echo "}") + + # Send log messages to stdout + console { + context any info + } +} + +network { + service { + address ${SERVICE_ADDRESS} + port ${SERVICE_PORT} + + # Uncomment the following to set the 'access-address' parameter to the + # IP address of the Docker host. This will the allow the server to correctly + # publish the address which applications and other nodes in the cluster to + # use when addressing this node. + # access-address + } + + heartbeat { + # mesh is used for environments that do not support multicast + mode mesh + address local + port 3002 + interval 150 + timeout 10 + } + + fabric { + # Intra-cluster communication port (migrates, replication, etc) + # default to same address in 'service' + address local + port 3001 + } + +} + +namespace ${NAMESPACE} { + default-ttl ${DEFAULT_TTL} # use 0 to never expire/evict. + memory-size ${MEM_GB}G + nsup-period ${NSUP_PERIOD} + replication-factor 1 + storage-engine device { + data-in-memory ${DATA_IN_MEMORY} # if true, in-memory, persisted to the filesystem + file /opt/aerospike/data/${NAMESPACE}.dat + filesize ${STORAGE_GB}G + read-page-cache ${READ_PAGE_CACHE} + } +} + diff --git a/enterprise/debian12/entrypoint.sh b/enterprise/debian12/entrypoint.sh new file mode 100755 index 00000000..1aa9d0ea --- /dev/null +++ b/enterprise/debian12/entrypoint.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash + +set -Eeuo pipefail + +export FEATURE_KEY_FILE=${FEATURE_KEY_FILE:-"/etc/aerospike/features.conf"} +export LOGFILE=${LOGFILE:-""} +export SERVICE_ADDRESS=${SERVICE_ADDRESS:-any} +export SERVICE_PORT=${SERVICE_PORT:-3000} +export NAMESPACE=${NAMESPACE:-test} +export DATA_IN_MEMORY=${DATA_IN_MEMORY:-false} +export DEFAULT_TTL=${DEFAULT_TTL:-30d} +export MEM_GB=${MEM_GB:-1} +export NSUP_PERIOD=${NSUP_PERIOD:-120} +export STORAGE_GB=${STORAGE_GB:-4} + +if [ "${DATA_IN_MEMORY}" = "true" ]; then + export READ_PAGE_CACHE="false" +else + export READ_PAGE_CACHE="true" +fi + +if asd --version | grep -q "Community"; then + FEATURE_KEY_FILE="" # invalid for community edition +fi + +function bash_eval_template() { + local template_file=$1 + local target_file=$2 + + echo "" >"${target_file}" + + while IFS= read -r line; do + if grep -qE "[$][(]|[{]" <<<"${line}"; then + local update + update=$(eval echo "\"${line}\"") || exit 1 + grep -qE "[^[:space:]]*" <<<"${update}" && echo "${update}" >>"${target_file}" + else + echo "${line}" >>"${target_file}" + fi + done <"${template_file}" + + # Ignore failure when template is mounted in a read-only filesystem. + rm "${template_file}" || true +} + +# Fill out conffile with above values +if [ -f /etc/aerospike/aerospike.template.conf ]; then + conf=/etc/aerospike/aerospike.conf + template=/etc/aerospike/aerospike.template.conf + + bash_eval_template "${template}" "${conf}" +fi + +# if command starts with an option, prepend asd +if [ "${1:0:1}" = '-' ]; then + set -- asd "$@" +fi + +# if asd is specified for the command, start it with any given options +if [ "$1" = 'asd' ]; then + NETLINK=${NETLINK:-eth0} + + # We will wait a bit for the network link to be up. + NETLINK_UP=0 + NETLINK_COUNT=0 + + echo "link ${NETLINK} state $(cat /sys/class/net/"${NETLINK}"/operstate)" + + while [ ${NETLINK_UP} -eq 0 ] && [ ${NETLINK_COUNT} -lt 20 ]; do + if grep -q "up" /sys/class/net/"${NETLINK}"/operstate; then + NETLINK_UP=1 + else + sleep 0.1 + ((++NETLINK_COUNT)) + fi + done + + echo "link ${NETLINK} state $(cat /sys/class/net/"${NETLINK}"/operstate) in ${NETLINK_COUNT}" + # asd should always run in the foreground. + set -- "$@" --foreground +fi + +exec "$@" diff --git a/federal/debian12/Dockerfile b/federal/debian12/Dockerfile new file mode 100644 index 00000000..d1ec0e27 --- /dev/null +++ b/federal/debian12/Dockerfile @@ -0,0 +1,190 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM debian:bookworm-slim + +# AEROSPIKE_EDITION - required - must be "community", "enterprise", or +# "federal". +# By selecting "community" you agree to the "COMMUNITY_LICENSE". +# By selecting "enterprise" you agree to the "ENTERPRISE_LICENSE". +# By selecting "federal" you agree to the "FEDERAL_LICENSE" +ARG AEROSPIKE_EDITION="federal" + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-federal/6.4.0.6/aerospike-server-federal_6.4.0.6_tools-9.2.1_debian12_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="20b243368fb7b2b8598a85419141b55725bc2df100e78567dece01254b13f3ed" +ARG AEROSPIKE_AARCH64_LINK="" +ARG AEROSPIKE_SHA_AARCH64="" + +SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"] + +# Install Aerospike Server and Tools +RUN \ + { \ + # 00-prelude-deb.part - Setup dependencies for scripts. + export DEBIAN_FRONTEND=noninteractive; \ + apt-get update -y; \ + apt-get install -y --no-install-recommends apt-utils; \ + apt-get install -y --no-install-recommends \ + binutils \ + ca-certificates \ + curl \ + xz-utils; \ + }; \ + { \ + # 00-prelude-deb.part - Install procps for tests. + apt-get install -y --no-install-recommends procps; \ + }; \ + { \ + # 10-download.part - Vars used for tini and tools. + VERSION="$(grep -oE "/[0-9]+[.][0-9]+[.][0-9]+([.][0-9]+)+(-rc[0-9]+)*/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/')"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(dpkg --print-architecture)"; \ + if [ "${ARCH}" = "amd64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "arm64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + curl -fsSL "https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}" --output /usr/bin/as-tini-static; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(dpkg --print-architecture)"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "amd64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "arm64" ]; then \ + pkg_link="${AEROSPIKE_AARCH64_LINK}"; \ + sha256="${AEROSPIKE_SHA_AARCH64}"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + if ! curl -fsSL "${pkg_link}" --output aerospike-server.tgz; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm aerospike-server.tgz; \ + # These directories are required for backward compatibility. + mkdir -p /var/{log,run}/aerospike; \ + # Copy license file to standard location. + mkdir -p /licenses; \ + cp aerospike/LICENSE /licenses; \ + }; \ + { \ + # 20-install-dependencies-deb.part - Install server and dependencies. + if [ "${AEROSPIKE_EDITION}" = "enterprise" ]; then \ + apt-get install -y --no-install-recommends \ + libcurl4 \ + libldap-2.4.2; \ + elif ! [ "$(printf "%s\n%s" "${VERSION}" "6.0" | sort -V | head -1)" != "${VERSION}" ]; then \ + apt-get install -y --no-install-recommends \ + libcurl4; \ + fi; \ + dpkg -i aerospike/aerospike-server-*.deb; \ + rm -rf /opt/aerospike/bin; \ + }; \ + { \ + # 20-install-dependencies-deb.part - Install tools dependencies. + if ! [ "$(printf "%s\n%s" "${VERSION}" "5.1" | sort -V | head -1)" != "${VERSION}" ]; then \ + # Tools before 5.1 need python2. + apt-get install -y --no-install-recommends \ + python2; \ + elif ! [ "$(printf "%s\n%s" "${VERSION}" "6.2.0.3" | sort -V | head -1)" != "${VERSION}" ]; then \ + # Tools before 6.0 need python3. + apt-get install -y --no-install-recommends \ + python3 \ + python3-distutils; \ + fi; \ + # Tools after 6.0 bundled their own python interpreter. + }; \ + { \ + # 20-install-dependencies-deb.part - Extract tools. + # ar on debian10 doesn't support '--output' + pushd aerospike/pkg || exit 1; \ + ar -x ../aerospike-tools*.deb; \ + popd || exit 1; \ + tar xf aerospike/pkg/data.tar.xz -C aerospike/pkg/; \ + }; \ + { \ + # 30-install-tools.part - install asinfo and asadm. + find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} +; \ + mv aerospike/pkg/etc/aerospike/astools.conf /etc/aerospike; \ + if ! [ "$(printf "%s\n%s" "${VERSION}" "6.2" | sort -V | head -1)" != "${VERSION}" ]; then \ + mv aerospike/pkg/opt/aerospike/bin/aql /usr/bin; \ + fi; \ + if [ -d 'aerospike/pkg/opt/aerospike/bin/asadm' ]; then \ + # Since tools release 7.0.5, asadm has been moved from + # /opt/aerospike/bin/asadm to /opt/aerospike/bin/asadm/asadm + # (inside an asadm directory). + mv aerospike/pkg/opt/aerospike/bin/asadm /usr/lib/; \ + else \ + mkdir /usr/lib/asadm; \ + mv aerospike/pkg/opt/aerospike/bin/asadm /usr/lib/asadm/; \ + fi; \ + ln -s /usr/lib/asadm/asadm /usr/bin/asadm; \ + if [ -f 'aerospike/pkg/opt/aerospike/bin/asinfo' ]; then \ + # Since tools release 7.1.1, asinfo has been moved from + # /opt/aerospike/bin/asinfo to /opt/aerospike/bin/asadm/asinfo + # (inside an asadm directory). + mv aerospike/pkg/opt/aerospike/bin/asinfo /usr/lib/asadm/; \ + fi; \ + ln -s /usr/lib/asadm/asinfo /usr/bin/asinfo; \ + }; \ + { \ + # 40-cleanup.part - remove extracted aerospike pkg directory. + rm -rf aerospike; \ + }; \ + { \ + # 50-remove-prelude-deb.part - Remove dependencies for scripts. + rm -rf /var/lib/apt/lists/*; \ + dpkg --purge \ + apt-utils \ + binutils \ + ca-certificates \ + curl \ + xz-utils 2>&1; \ + apt-get purge -y; \ + apt-get autoremove -y; \ + unset DEBIAN_FRONTEND; \ + }; \ + echo "done"; + +# Add the Aerospike configuration specific to this dockerfile +COPY aerospike.template.conf /etc/aerospike/aerospike.template.conf + +# Mount the Aerospike data directory +# VOLUME ["/opt/aerospike/data"] +# Mount the Aerospike config directory +# VOLUME ["/etc/aerospike/"] + +# Expose Aerospike ports +# +# 3000 – service port, for client connections +# 3001 – fabric port, for cluster communication +# 3002 – mesh port, for cluster heartbeat +# +EXPOSE 3000 3001 3002 + +COPY entrypoint.sh /entrypoint.sh + +# Tini init set to restart ASD on SIGUSR1 and terminate ASD on SIGTERM +ENTRYPOINT ["/usr/bin/as-tini-static", "-r", "SIGUSR1", "-t", "SIGTERM", "--", "/entrypoint.sh"] + +# Execute the run script in foreground mode +CMD ["asd"] diff --git a/federal/debian12/README.md b/federal/debian12/README.md new file mode 100644 index 00000000..a0bb028c --- /dev/null +++ b/federal/debian12/README.md @@ -0,0 +1,5 @@ +# Dockerfile Template + +These files are managed by `update.sh`, do not edit files outside of the `template` directory. + +After updating files in the `template` directory, be sure to run `update.sh` before committing. diff --git a/federal/debian12/aerospike.template.conf b/federal/debian12/aerospike.template.conf new file mode 100644 index 00000000..6737692b --- /dev/null +++ b/federal/debian12/aerospike.template.conf @@ -0,0 +1,67 @@ +# Aerospike database configuration file +# This template sets up a single-node, single namespace developer environment. +# +# Alternatively, you can pass in your own configuration file. +# You can see more examples at +# https://github.com/aerospike/aerospike-server/tree/master/as/etc + +# This stanza must come first. +service { + $([ -n "${FEATURE_KEY_FILE}" ] && echo "feature-key-file ${FEATURE_KEY_FILE}") +} + +logging { + $([ -n "${LOGFILE}" ] && echo "# Log file must be an absolute path.") + $([ -n "${LOGFILE}" ] && echo "file ${LOGFILE} {") + $([ -n "${LOGFILE}" ] && echo " context any info") + $([ -n "${LOGFILE}" ] && echo "}") + + # Send log messages to stdout + console { + context any info + } +} + +network { + service { + address ${SERVICE_ADDRESS} + port ${SERVICE_PORT} + + # Uncomment the following to set the 'access-address' parameter to the + # IP address of the Docker host. This will the allow the server to correctly + # publish the address which applications and other nodes in the cluster to + # use when addressing this node. + # access-address + } + + heartbeat { + # mesh is used for environments that do not support multicast + mode mesh + address local + port 3002 + interval 150 + timeout 10 + } + + fabric { + # Intra-cluster communication port (migrates, replication, etc) + # default to same address in 'service' + address local + port 3001 + } + +} + +namespace ${NAMESPACE} { + default-ttl ${DEFAULT_TTL} # use 0 to never expire/evict. + memory-size ${MEM_GB}G + nsup-period ${NSUP_PERIOD} + replication-factor 1 + storage-engine device { + data-in-memory ${DATA_IN_MEMORY} # if true, in-memory, persisted to the filesystem + file /opt/aerospike/data/${NAMESPACE}.dat + filesize ${STORAGE_GB}G + read-page-cache ${READ_PAGE_CACHE} + } +} + diff --git a/federal/debian12/entrypoint.sh b/federal/debian12/entrypoint.sh new file mode 100755 index 00000000..1aa9d0ea --- /dev/null +++ b/federal/debian12/entrypoint.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash + +set -Eeuo pipefail + +export FEATURE_KEY_FILE=${FEATURE_KEY_FILE:-"/etc/aerospike/features.conf"} +export LOGFILE=${LOGFILE:-""} +export SERVICE_ADDRESS=${SERVICE_ADDRESS:-any} +export SERVICE_PORT=${SERVICE_PORT:-3000} +export NAMESPACE=${NAMESPACE:-test} +export DATA_IN_MEMORY=${DATA_IN_MEMORY:-false} +export DEFAULT_TTL=${DEFAULT_TTL:-30d} +export MEM_GB=${MEM_GB:-1} +export NSUP_PERIOD=${NSUP_PERIOD:-120} +export STORAGE_GB=${STORAGE_GB:-4} + +if [ "${DATA_IN_MEMORY}" = "true" ]; then + export READ_PAGE_CACHE="false" +else + export READ_PAGE_CACHE="true" +fi + +if asd --version | grep -q "Community"; then + FEATURE_KEY_FILE="" # invalid for community edition +fi + +function bash_eval_template() { + local template_file=$1 + local target_file=$2 + + echo "" >"${target_file}" + + while IFS= read -r line; do + if grep -qE "[$][(]|[{]" <<<"${line}"; then + local update + update=$(eval echo "\"${line}\"") || exit 1 + grep -qE "[^[:space:]]*" <<<"${update}" && echo "${update}" >>"${target_file}" + else + echo "${line}" >>"${target_file}" + fi + done <"${template_file}" + + # Ignore failure when template is mounted in a read-only filesystem. + rm "${template_file}" || true +} + +# Fill out conffile with above values +if [ -f /etc/aerospike/aerospike.template.conf ]; then + conf=/etc/aerospike/aerospike.conf + template=/etc/aerospike/aerospike.template.conf + + bash_eval_template "${template}" "${conf}" +fi + +# if command starts with an option, prepend asd +if [ "${1:0:1}" = '-' ]; then + set -- asd "$@" +fi + +# if asd is specified for the command, start it with any given options +if [ "$1" = 'asd' ]; then + NETLINK=${NETLINK:-eth0} + + # We will wait a bit for the network link to be up. + NETLINK_UP=0 + NETLINK_COUNT=0 + + echo "link ${NETLINK} state $(cat /sys/class/net/"${NETLINK}"/operstate)" + + while [ ${NETLINK_UP} -eq 0 ] && [ ${NETLINK_COUNT} -lt 20 ]; do + if grep -q "up" /sys/class/net/"${NETLINK}"/operstate; then + NETLINK_UP=1 + else + sleep 0.1 + ((++NETLINK_COUNT)) + fi + done + + echo "link ${NETLINK} state $(cat /sys/class/net/"${NETLINK}"/operstate) in ${NETLINK_COUNT}" + # asd should always run in the foreground. + set -- "$@" --foreground +fi + +exec "$@"