Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Aerospike 6.2.0.2 #13810

Merged
merged 1 commit into from
Dec 29, 2022
Merged

Aerospike 6.2.0.2 #13810

merged 1 commit into from
Dec 29, 2022

Conversation

pvinh-spike
Copy link
Contributor

@github-actions
Copy link

Diff for 0da7019:
diff --git a/_bashbrew-cat b/_bashbrew-cat
index 31cc9aa..5f7d1fb 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -1,9 +1,13 @@
-Maintainers: Lucien Volmar <lucien@aerospike.com> (@volmarl), Michael Coberly <mcoberly@aerospike.com> (@mcoberly2), Phuc Vinh <pvinh@aerospike.com> (@pvinh-spike)
+Maintainers: Lucien Volmar <lucien@aerospike.com> (@volmarl), Michael Coberly <mcoberly@aerospike.com> (@mcoberly2), Phuc Vinh <pvinh@aerospike.com> (@pvinh-spike), Kevin Porter <kporter@aerospike.com> (@kportertx)
 
-Tags: ce-6.1.0.3
+Tags: ce-6.2.0.2
+Architectures: amd64, arm64v8
 GitRepo: https://github.com/aerospike/aerospike-server.docker.git
-GitCommit: 4557452ca88bcad1929e91bd303b522a1c242b12
+GitCommit: 26089140713466195470d5d246fdd2bda5b82180
+Directory: community/debian11
 
-Tags: ee-6.1.0.3
-GitRepo: https://github.com/aerospike/aerospike-server-enterprise.docker.git
-GitCommit: 01871453aad7390a02a51dee11efe8e6a55f95cf
+Tags: ee-6.2.0.2
+Architectures: amd64, arm64v8
+GitRepo: https://github.com/aerospike/aerospike-server.docker.git
+GitCommit: 26089140713466195470d5d246fdd2bda5b82180
+Directory: enterprise/debian11
diff --git a/_bashbrew-list b/_bashbrew-list
index a151121..add7c5f 100644
--- a/_bashbrew-list
+++ b/_bashbrew-list
@@ -1,2 +1,2 @@
-aerospike:ce-6.1.0.3
-aerospike:ee-6.1.0.3
+aerospike:ce-6.2.0.2
+aerospike:ee-6.2.0.2
diff --git a/_bashbrew-list-build-order b/_bashbrew-list-build-order
index a151121..add7c5f 100644
--- a/_bashbrew-list-build-order
+++ b/_bashbrew-list-build-order
@@ -1,2 +1,2 @@
-aerospike:ce-6.1.0.3
-aerospike:ee-6.1.0.3
+aerospike:ce-6.2.0.2
+aerospike:ee-6.2.0.2
diff --git a/aerospike_ce-6.1.0.3/.dockerignore b/aerospike_ce-6.1.0.3/.dockerignore
deleted file mode 100644
index e5b80c1..0000000
diff --git a/aerospike_ce-6.1.0.3/Dockerfile b/aerospike_ce-6.1.0.3/Dockerfile
deleted file mode 100644
index 45512a0..0000000
diff --git a/aerospike_ce-6.2.0.2/Dockerfile b/aerospike_ce-6.2.0.2/Dockerfile
new file mode 100644
index 0000000..b054101
--- /dev/null
+++ b/aerospike_ce-6.2.0.2/Dockerfile
@@ -0,0 +1,189 @@
+
+#
+# Aerospike Server Dockerfile
+#
+# http://github.com/aerospike/aerospike-server.docker
+#
+
+FROM debian:bullseye-slim
+
+ARG DEBUG="false"
+
+# 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.2.0.2/aerospike-server-community_6.2.0.2_tools-8.0.4_debian11_x86_64.tgz"
+ARG AEROSPIKE_SHA_X86_64="27a5bdbe844212dff4e319961b9b1387ff16360e9d5544a9de6e1d0e64dbbe78"
+ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-community/6.2.0.2/aerospike-server-community_6.2.0.2_tools-8.0.4_debian11_aarch64.tgz"
+ARG AEROSPIKE_SHA_AARCH64="bdd69acce22e9019e3c662d45f17e787f8570c80fc5dbecc0f8682cb511cb467"
+
+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]+){2,3}/" <<<"${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 [ -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/aerospike_ee-6.1.0.3/aerospike.template.conf b/aerospike_ce-6.2.0.2/aerospike.template.conf
similarity index 79%
rename from aerospike_ee-6.1.0.3/aerospike.template.conf
rename to aerospike_ce-6.2.0.2/aerospike.template.conf
index b382a00..6737692 100644
--- a/aerospike_ee-6.1.0.3/aerospike.template.conf
+++ b/aerospike_ce-6.2.0.2/aerospike.template.conf
@@ -7,14 +7,14 @@
 
 # This stanza must come first.
 service {
-	feature-key-file ${FEATURE_KEY_FILE}
+	$([ -n "${FEATURE_KEY_FILE}" ] && echo "feature-key-file ${FEATURE_KEY_FILE}")
 }
 
 logging {
-	# Log file must be an absolute path.
-	file ${LOGFILE} {
-		context any info
-	}
+	$([ -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 {
@@ -27,7 +27,7 @@ network {
 		address ${SERVICE_ADDRESS}
 		port ${SERVICE_PORT}
 
-		# Uncomment the following to set the `access-address` parameter to the
+		# 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.
diff --git a/aerospike_ee-6.1.0.3/entrypoint.sh b/aerospike_ce-6.2.0.2/entrypoint.sh
similarity index 33%
rename from aerospike_ee-6.1.0.3/entrypoint.sh
rename to aerospike_ce-6.2.0.2/entrypoint.sh
index 9a7ecaf..19ef72a 100755
--- a/aerospike_ee-6.1.0.3/entrypoint.sh
+++ b/aerospike_ce-6.2.0.2/entrypoint.sh
@@ -1,8 +1,9 @@
-#!/bin/bash
-set -e
+#!/usr/bin/env bash
 
-export FEATURE_KEY_FILE=${FEATURE_KEY_FILE:-/etc/aerospike/features.conf}
-export LOGFILE=${LOGFILE:-/dev/null}
+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}
@@ -11,15 +12,43 @@ 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
+
+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
+	unset FEATURE_KEY_FILE # invald 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
-        envsubst < /etc/aerospike/aerospike.template.conf > /etc/aerospike/aerospike.conf
+	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
@@ -29,27 +58,26 @@ 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.
+	# 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
+
+	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
-                	let NETLINK_COUNT=NETLINK_COUNT+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
+	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/aerospike_ee-6.1.0.3/.dockerignore b/aerospike_ee-6.1.0.3/.dockerignore
deleted file mode 100644
index f6acf05..0000000
diff --git a/aerospike_ee-6.1.0.3/Dockerfile b/aerospike_ee-6.1.0.3/Dockerfile
deleted file mode 100644
index 5462e3c..0000000
diff --git a/aerospike_ee-6.2.0.2/Dockerfile b/aerospike_ee-6.2.0.2/Dockerfile
new file mode 100644
index 0000000..b13f6b5
--- /dev/null
+++ b/aerospike_ee-6.2.0.2/Dockerfile
@@ -0,0 +1,189 @@
+
+#
+# Aerospike Server Dockerfile
+#
+# http://github.com/aerospike/aerospike-server.docker
+#
+
+FROM debian:bullseye-slim
+
+ARG DEBUG="false"
+
+# 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.2.0.2/aerospike-server-enterprise_6.2.0.2_tools-8.0.4_debian11_x86_64.tgz"
+ARG AEROSPIKE_SHA_X86_64="0eeb32a9b5da70dcc9f9e155e57ec0d8dfcc17c471ba6e844b2d7449cf577c34"
+ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/6.2.0.2/aerospike-server-enterprise_6.2.0.2_tools-8.0.4_debian11_aarch64.tgz"
+ARG AEROSPIKE_SHA_AARCH64="2d250ca285a7c5b30b9534888a462ce742b0d812f4f97b954a554884e8ede122"
+
+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]+){2,3}/" <<<"${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 [ -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/aerospike_ce-6.1.0.3/aerospike.template.conf b/aerospike_ee-6.2.0.2/aerospike.template.conf
similarity index 79%
rename from aerospike_ce-6.1.0.3/aerospike.template.conf
rename to aerospike_ee-6.2.0.2/aerospike.template.conf
index 6ec328b..6737692 100644
--- a/aerospike_ce-6.1.0.3/aerospike.template.conf
+++ b/aerospike_ee-6.2.0.2/aerospike.template.conf
@@ -7,13 +7,14 @@
 
 # This stanza must come first.
 service {
+	$([ -n "${FEATURE_KEY_FILE}" ] && echo "feature-key-file ${FEATURE_KEY_FILE}")
 }
 
 logging {
-	# Log file must be an absolute path.
-	file ${LOGFILE} {
-		context any info
-	}
+	$([ -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 {
@@ -26,7 +27,7 @@ network {
 		address ${SERVICE_ADDRESS}
 		port ${SERVICE_PORT}
 
-		# Uncomment the following to set the `access-address` parameter to the
+		# 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.
diff --git a/aerospike_ce-6.1.0.3/entrypoint.sh b/aerospike_ee-6.2.0.2/entrypoint.sh
similarity index 33%
rename from aerospike_ce-6.1.0.3/entrypoint.sh
rename to aerospike_ee-6.2.0.2/entrypoint.sh
index 2f07baf..19ef72a 100755
--- a/aerospike_ce-6.1.0.3/entrypoint.sh
+++ b/aerospike_ee-6.2.0.2/entrypoint.sh
@@ -1,7 +1,9 @@
-#!/bin/bash
-set -e
+#!/usr/bin/env bash
 
-export LOGFILE=${LOGFILE:-/dev/null}
+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}
@@ -10,15 +12,43 @@ 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
+
+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
+	unset FEATURE_KEY_FILE # invald 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
-        envsubst < /etc/aerospike/aerospike.template.conf > /etc/aerospike/aerospike.conf
+	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
@@ -28,27 +58,26 @@ 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.
+	# 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
+
+	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
-                	let NETLINK_COUNT=NETLINK_COUNT+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
+	echo "link ${NETLINK} state $(cat /sys/class/net/"${NETLINK}"/operstate) in ${NETLINK_COUNT}"
+	# asd should always run in the foreground.
 	set -- "$@" --foreground
-
 fi
 
 exec "$@"

Relevant Maintainers:

@tianon
Copy link
Member

tianon commented Dec 29, 2022

Diff from #13775:
$ git --no-pager diff 100a66c810a06e804315313a65f5affae465dfb8..26089140713466195470d5d246fdd2bda5b82180 -- community/ enterprise/
diff --git a/community/debian11/Dockerfile b/community/debian11/Dockerfile
index f62f8b2..b054101 100644
--- a/community/debian11/Dockerfile
+++ b/community/debian11/Dockerfile
@@ -21,7 +21,7 @@ ARG AEROSPIKE_SHA_X86_64="27a5bdbe844212dff4e319961b9b1387ff16360e9d5544a9de6e1d
 ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-community/6.2.0.2/aerospike-server-community_6.2.0.2_tools-8.0.4_debian11_aarch64.tgz"
 ARG AEROSPIKE_SHA_AARCH64="bdd69acce22e9019e3c662d45f17e787f8570c80fc5dbecc0f8682cb511cb467"
 
-SHELL ["/bin/bash", "-o", "pipefail", "-c"]
+SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"]
 
 # Install Aerospike Server and Tools
 RUN \
@@ -29,7 +29,7 @@ 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 2>&1 | grep -v "delaying package configuration"; \
+    apt-get install -y --no-install-recommends apt-utils; \
     apt-get install -y --no-install-recommends \
       binutils \
       ca-certificates \
@@ -42,15 +42,15 @@ RUN \
   }; \
   { \
     # 10-download.part - Vars used for tini and tools.
-    ARCH="$(uname -m)"; \
     VERSION="$(grep -oE "/[0-9]+([.][0-9]+){2,3}/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/')"; \
   }; \
   { \
     # 10-common.part - Install tini.
-    if [ "${ARCH}" = "x86_64" ]; then \
+    ARCH="$(dpkg --print-architecture)"; \
+    if [ "${ARCH}" = "amd64" ]; then \
       sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \
       suffix=""; \
-    elif [ "${ARCH}" = "aarch64" ]; then \
+    elif [ "${ARCH}" = "arm64" ]; then \
       sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \
       suffix="-arm64"; \
     else \
@@ -63,11 +63,12 @@ RUN \
   }; \
   { \
     # 10-download.part - Download server and tools.
+    ARCH="$(dpkg --print-architecture)"; \
     mkdir -p aerospike/pkg; \
-    if [ "${ARCH}" = "x86_64" ]; then \
+    if [ "${ARCH}" = "amd64" ]; then \
       pkg_link="${AEROSPIKE_X86_64_LINK}"; \
       sha256="${AEROSPIKE_SHA_X86_64}"; \
-    elif [ "${ARCH}" = "aarch64" ]; then \
+    elif [ "${ARCH}" = "arm64" ]; then \
       pkg_link="${AEROSPIKE_AARCH64_LINK}"; \
       sha256="${AEROSPIKE_SHA_AARCH64}"; \
     else \
@@ -106,7 +107,7 @@ RUN \
       # Tools before 5.1 need python2.
       apt-get install -y --no-install-recommends \
         python2; \
-    elif ! [ "$(printf "%s\n%s" "${VERSION}" "6.0" | sort -V | head -1)" != "${VERSION}" ]; then \
+    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 \
diff --git a/enterprise/debian11/Dockerfile b/enterprise/debian11/Dockerfile
index 5af12f7..b13f6b5 100644
--- a/enterprise/debian11/Dockerfile
+++ b/enterprise/debian11/Dockerfile
@@ -21,7 +21,7 @@ ARG AEROSPIKE_SHA_X86_64="0eeb32a9b5da70dcc9f9e155e57ec0d8dfcc17c471ba6e844b2d74
 ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/6.2.0.2/aerospike-server-enterprise_6.2.0.2_tools-8.0.4_debian11_aarch64.tgz"
 ARG AEROSPIKE_SHA_AARCH64="2d250ca285a7c5b30b9534888a462ce742b0d812f4f97b954a554884e8ede122"
 
-SHELL ["/bin/bash", "-o", "pipefail", "-c"]
+SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"]
 
 # Install Aerospike Server and Tools
 RUN \
@@ -29,7 +29,7 @@ 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 2>&1 | grep -v "delaying package configuration"; \
+    apt-get install -y --no-install-recommends apt-utils; \
     apt-get install -y --no-install-recommends \
       binutils \
       ca-certificates \
@@ -42,15 +42,15 @@ RUN \
   }; \
   { \
     # 10-download.part - Vars used for tini and tools.
-    ARCH="$(uname -m)"; \
     VERSION="$(grep -oE "/[0-9]+([.][0-9]+){2,3}/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/')"; \
   }; \
   { \
     # 10-common.part - Install tini.
-    if [ "${ARCH}" = "x86_64" ]; then \
+    ARCH="$(dpkg --print-architecture)"; \
+    if [ "${ARCH}" = "amd64" ]; then \
       sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \
       suffix=""; \
-    elif [ "${ARCH}" = "aarch64" ]; then \
+    elif [ "${ARCH}" = "arm64" ]; then \
       sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \
       suffix="-arm64"; \
     else \
@@ -63,11 +63,12 @@ RUN \
   }; \
   { \
     # 10-download.part - Download server and tools.
+    ARCH="$(dpkg --print-architecture)"; \
     mkdir -p aerospike/pkg; \
-    if [ "${ARCH}" = "x86_64" ]; then \
+    if [ "${ARCH}" = "amd64" ]; then \
       pkg_link="${AEROSPIKE_X86_64_LINK}"; \
       sha256="${AEROSPIKE_SHA_X86_64}"; \
-    elif [ "${ARCH}" = "aarch64" ]; then \
+    elif [ "${ARCH}" = "arm64" ]; then \
       pkg_link="${AEROSPIKE_AARCH64_LINK}"; \
       sha256="${AEROSPIKE_SHA_AARCH64}"; \
     else \
@@ -106,7 +107,7 @@ RUN \
       # Tools before 5.1 need python2.
       apt-get install -y --no-install-recommends \
         python2; \
-    elif ! [ "$(printf "%s\n%s" "${VERSION}" "6.0" | sort -V | head -1)" != "${VERSION}" ]; then \
+    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 \

@tianon
Copy link
Member

tianon commented Dec 29, 2022

It looks like everything from #13775 (comment) was implemented, so I'm going to go ahead with a merge.

However, I'll echo again what I noted in #13775 (comment):

In the future, can you please instead force push to your existing branch (which will then update the existing PR)? When you close the PR and open a new one, it splits the conversation, which makes it much harder to follow, and generates more separate email threads making it harder to sort through.

@tianon tianon merged commit a752dbe into docker-library:master Dec 29, 2022
@pvinh-spike pvinh-spike deleted the patch-7 branch January 23, 2025 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants