Skip to content

Commit

Permalink
6.4.0.6_1
Browse files Browse the repository at this point in the history
  • Loading branch information
mcoberly2 committed Oct 17, 2023
1 parent a7164c3 commit 3c9c0d2
Show file tree
Hide file tree
Showing 12 changed files with 1,035 additions and 0 deletions.
190 changes: 190 additions & 0 deletions community/debian12/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
5 changes: 5 additions & 0 deletions community/debian12/README.md
Original file line number Diff line number Diff line change
@@ -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.
67 changes: 67 additions & 0 deletions community/debian12/aerospike.template.conf
Original file line number Diff line number Diff line change
@@ -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 <IPADDR>
}

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}
}
}

83 changes: 83 additions & 0 deletions community/debian12/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
Loading

0 comments on commit 3c9c0d2

Please sign in to comment.