diff --git a/.editorconfig b/.editorconfig index 4a873e85..c1bd7aec 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,3 +7,6 @@ insert_final_newline = true trim_trailing_whitespace = true indent_size = 4 indent_style = space + +[*.yml] +indent_size = 2 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9c30ad53..eb4eb4d8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,8 +12,11 @@ jobs: with: fetch-depth: 0 - name: Should not change anything - run: "./update.sh -g && [ -z \"$(git diff --stat)\" ]" - build-tagged: + run: "./update.sh && [ -z \"$(git diff --stat)\" ]" + build: + strategy: + matrix: + registry: [dockerhub, redhat] runs-on: ubuntu-latest steps: - name: Set up QEMU @@ -22,34 +25,6 @@ jobs: uses: docker/setup-buildx-action@v3 - uses: actions/checkout@v4 - name: Build - run: "./build.sh -t" + run: "./build.sh -t -y ${{ matrix.registry }}" - name: Test - run: "./test.sh" - build-5-7: - runs-on: ubuntu-latest - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - uses: actions/checkout@v4 - - name: Update to 5.7.0.25 (ubuntu20) - run: "./update.sh -s 5.7.0.25" - - name: Build - run: "./build.sh -t" - - name: Test - run: "./test.sh" - build-6-0: - runs-on: ubuntu-latest - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - uses: actions/checkout@v4 - - name: Update to 6.0.0.9 (no fed) - run: "./update.sh -s 6.0.0.9" - - name: Build - run: "./build.sh -t" - - name: Test - run: "./test.sh" + run: "./test.sh -y ${{ matrix.registry }}" diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index e2dc6eb8..fc2063e4 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -76,6 +76,6 @@ jobs: reporter: ${{ steps.reporter.outputs.value }} filter_mode: file fail_on_error: true - hadolint_ignore: DL3008 + hadolint_ignore: DL3006 DL3008 DL3041 exclude: | - ^template/ + ^data/ diff --git a/.gitignore b/.gitignore index e43b0f98..19f29d1e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .DS_Store +./target/ +./images/internal diff --git a/README.md b/README.md index 6c45c60a..508971b0 100644 --- a/README.md +++ b/README.md @@ -332,7 +332,7 @@ Aerospike Telemetry is a feature that allows us to collect certain anonymized us ## Image Versions -These images are based on [debian:*-slim](https://hub.docker.com/_/debian). +These images are based on [ubuntu:\*](https://hub.docker.com/_/ubuntu). ## Reporting Issues diff --git a/bake.hcl b/bake.hcl deleted file mode 100644 index 4d3a7545..00000000 --- a/bake.hcl +++ /dev/null @@ -1,69 +0,0 @@ -# This file contains the targets for the test images. -# This file is auto-generated by the update.sh script and will be wiped out by the update.sh script. -# Please don't edit this file. -# -# Build all test/push images: -# docker buildx bake -f bake.hcl [test | push] --progressive plain [--load | --push] -# Build selected images: -# docker buildx bake -f bake.hcl [target name, ...] --progressive plain [--load | --push] - -#------------------------------------ test ----------------------------------- - -group "test" { - targets=["enterprise_ubuntu22-04_amd64", "enterprise_ubuntu22-04_arm64", "federal_ubuntu22-04_amd64", "community_ubuntu22-04_amd64", "community_ubuntu22-04_arm64"] -} - -target "enterprise_ubuntu22-04_amd64" { - tags=["aerospike/aerospike-server-enterprise-amd64:7.1.0.0", "aerospike/aerospike-server-enterprise-amd64:latest"] - platforms=["linux/amd64"] - context="./enterprise/ubuntu22.04" -} - -target "enterprise_ubuntu22-04_arm64" { - tags=["aerospike/aerospike-server-enterprise-arm64:7.1.0.0", "aerospike/aerospike-server-enterprise-arm64:latest"] - platforms=["linux/arm64"] - context="./enterprise/ubuntu22.04" -} - -target "federal_ubuntu22-04_amd64" { - tags=["aerospike/aerospike-server-federal-amd64:7.1.0.0", "aerospike/aerospike-server-federal-amd64:latest"] - platforms=["linux/amd64"] - context="./federal/ubuntu22.04" -} - -target "community_ubuntu22-04_amd64" { - tags=["aerospike/aerospike-server-community-amd64:7.1.0.0", "aerospike/aerospike-server-community-amd64:latest"] - platforms=["linux/amd64"] - context="./community/ubuntu22.04" -} - -target "community_ubuntu22-04_arm64" { - tags=["aerospike/aerospike-server-community-arm64:7.1.0.0", "aerospike/aerospike-server-community-arm64:latest"] - platforms=["linux/arm64"] - context="./community/ubuntu22.04" -} - -#------------------------------------ push ----------------------------------- - -group "push" { - targets=["enterprise_ubuntu22-04", "federal_ubuntu22-04", "community_ubuntu22-04"] -} - -target "enterprise_ubuntu22-04" { - tags=["aerospike/aerospike-server-enterprise:7.1.0.0", "aerospike/aerospike-server-enterprise:7.1.0.0_2", "aerospike/aerospike-server-enterprise:latest"] - platforms=["linux/amd64,linux/arm64"] - context="./enterprise/ubuntu22.04" -} - -target "federal_ubuntu22-04" { - tags=["aerospike/aerospike-server-federal:7.1.0.0", "aerospike/aerospike-server-federal:7.1.0.0_2", "aerospike/aerospike-server-federal:latest"] - platforms=["linux/amd64"] - context="./federal/ubuntu22.04" -} - -target "community_ubuntu22-04" { - tags=["aerospike/aerospike-server:7.1.0.0", "aerospike/aerospike-server:7.1.0.0_2", "aerospike/aerospike-server:latest"] - platforms=["linux/amd64,linux/arm64"] - context="./community/ubuntu22.04" -} - diff --git a/build.sh b/build.sh index 36e81bb0..9dfd9eee 100755 --- a/build.sh +++ b/build.sh @@ -5,52 +5,75 @@ # Samples: # build and push to docker repo: ./build.sh -p # build all images for test: ./build.sh -t -# build images for specific edition/distribution: ./build.sh -e community -d ubuntu20 #----------------------------------------------------------------------- set -Eeuo pipefail +source lib/globals.sh source lib/log.sh source lib/support.sh source lib/verbose_call.sh +source lib/version.sh function usage() { cat < -e +Usage: $0 [OPTION]... -h display this help. - -d (ubuntu20) only build for this distro. - -e (enterprise|federal|community) only build this server - edition. + + -c clean '${g_target_dir}'. + -r build '${g_target_dir}//bake.hcl' only. + + -p build for release/push to configured registry. -t build for invoking test in test.sh - -p build for release/push to dockerhub + + -y as it apprears in '${g_data_config_dir}. Default 'dockerhub'. + -d as it appears in 'config.sh'. May be repeated. + -e as it appears in 'config.sh'. May be repeated. + -v as they appear under '${g_data_config_dir}/'. May be repeated. EOF } function parse_args() { - g_linux_distro= - g_server_edition= - g_test_build='false' + g_registry='dockerhub' + g_dry_run='false' g_push_build='false' + g_test_build='false' + g_filter_versions=() + g_filter_editions=() + g_filter_distros=() - while getopts "hd:e:tp" opt; do + while getopts "cd:e:hprtv:y:" opt; do case "${opt}" in - h) - usage + c) + rm -rf "${g_target_dir}" exit 0 ;; d) - g_linux_distro="${OPTARG}" + g_filter_distros+=("${OPTARG}") ;; e) - g_server_edition="${OPTARG}" + g_filter_editions+=("${OPTARG}") ;; - t) - g_test_build='true' + h) + usage + exit 0 ;; p) g_push_build='true' ;; + r) + g_dry_run='true' + ;; + t) + g_test_build='true' + ;; + v) + g_filter_versions+=("${OPTARG}") + ;; + y) + g_registry="${OPTARG}" + ;; *) log_warn "** Invalid argument **" usage @@ -61,10 +84,22 @@ function parse_args() { shift $((OPTIND - 1)) - log_info "g_linux_distro: '${g_linux_distro}'" - log_info "g_server_edition: '${g_server_edition}'" - log_info "g_test_build: '${g_test_build}'" + log_info "g_dry_run: '${g_dry_run}'" log_info "g_push_build: '${g_push_build}'" + log_info "g_test_build: '${g_test_build}'" + log_info "g_registry: '${g_registry}" + + local temp + temp="$(printf "'%s' " "${g_filter_versions[@]}")" + log_info "g_filter_versions: (${temp%" "})" + temp="$(printf "'%s' " "${g_filter_editions[@]}")" + log_info "g_filter_editions: (${temp%" "})" + temp="$(printf "'%s' " "${g_filter_distros[@]}")" + log_info "g_filter_distros: (${temp%" "})" + + if [[ "${g_dry_run}" == "true" ]]; then + return + fi if [ "${g_test_build}" = "false" ] && [ "${g_push_build}" = "false" ]; then log_warn "Must provide either '-t' or '-p' option" @@ -77,40 +112,246 @@ function parse_args() { fi } -function main() { - parse_args "$@" +function get_target_name() { + local short_version=$1 + local distro=$2 + local edition=$3 + local short_platform=$4 - local distro_in=${g_linux_distro} - local targets= + local target="${edition}_${distro/\./-}_${short_version/\./-}" - if [ -z "${g_server_edition}" ]; then - if [ "${g_test_build}" = "true" ]; then - targets="test" - elif [ "${g_push_build}" = "true" ]; then - targets="push" - fi + if [ -n "${short_platform}" ]; then + target+="_${short_platform}" + fi + + echo "${target}" +} + +function do_bake_test_group_targets() { + local distro=$1 + local edition=$2 + local short_version=$3 + + local output="" + + for platform in "${c_platforms[@]}"; do + local short_platform=${platform#*/} + local target_str= + target_str="$(get_target_name "${short_version}" "${distro}" \ + "${edition}" "${short_platform}")" + + output+="\"${target_str}\", " + done + + echo "${output}" +} + +function do_bake_group() { + local group=$1 + local group_targets=$2 + + local output="#-------------------- ${group} --------------------\n\n" + + output+="group \"${group}\" {\n targets=[" + output+="${group_targets}" + output+="]\n}\n" + + echo "${output}" +} + +function get_product_tags() { + local product=$1 + local version=$2 + local distro=$3 + + if [ -z "${distro}" ]; then + local distro_prefix= else - local distribution_list=("${distro_in}") + local distro_prefix="-${distro}" + fi + + local output="\"${product}:${g_server_version}${distro_prefix}\"" + + output+=", \"${product}:${g_server_version}${distro_prefix}-${g_container_release}\"" + output+=", \"${product}:${version}${distro_prefix}\"" + + echo "${output}" +} + +function do_bake_test_target() { + local version=$1 + local distro=$2 + local distro_dir=$3 + local edition=$4 + + local version_path= + version_path="$(support_image_path "${g_registry}" "${version}" \ + "${edition}" "${distro_dir}")" + local output="" + + for platform in "${c_platforms[@]}"; do + local short_platform="${platform#*/}" + local target_str= + target_str="$(get_target_name "${version}" "${distro}" \ + "${edition}" "${short_platform}")" + local product="aerospike/aerospike-server-${edition}-${short_platform}" + + output+="target \"${target_str}\" {\n" + output+=" tags=[" + output+="$(get_product_tags "${product}" "${version}" "${distro}")" + output+="]\n" + output+=" platforms=[\"${platform}\"]\n" + output+=" context=\"./${version_path}\"\n" + output+="}\n\n" + done + + echo "${output}" +} + +function do_bake_push_target() { + local version=$1 + local distro=$2 + local distro_dir=$3 + local edition=$4 + + printf -v platforms_str '%s,' "${c_platforms[@]}" + platforms_str="${platforms_str%,}" + + # FIXME use get_target_name() + local target_str="${edition}_${distro/\./-}" + local output="target \"${target_str}\" {\n" + local product="aerospike/aerospike-server" + + if [ "${edition}" != "community" ]; then + product+="-${edition}" + fi + + output+=" tags=[" - if [ -z "${distro_in}" ]; then - tmp_list=("$(find "${g_server_edition}"/* -maxdepth 0 -type d)") - distribution_list=("${tmp_list[@]/#"${g_server_edition}"\//}") + if [ "${distro}" == "${c_distro_default}" ]; then + output+="$(get_product_tags "${product}" "${version}" "")" + + if [ "${g_latest_version}" = "${g_server_version}" ]; then + output+=", \"${product}:latest\"" fi - for distribution in "${distribution_list[@]}"; do - local version - version="$(get_version_from_dockerfile "${distribution}" "${g_server_edition}")" - IFS=' ' read -r -a platform_list <<<"$(support_platforms_for_asd "${version}" "${g_server_edition}")" - - if [ "${g_test_build}" = "true" ]; then - for platform in "${platform_list[@]}"; do - short_platform=${platform#*/} - targets+="${g_server_edition}_${distribution}_${short_platform} " - done - elif [ "${g_push_build}" = "true" ]; then - targets+="${g_server_edition}_${distribution} " + output+=",\n " + fi + + output+="$(get_product_tags "${product}" "${version}" "${distro}")" + + local version_path= + version_path="$(support_image_path "${g_registry}" "${version}" \ + "${edition}" "${distro_dir}")" + + output+="]\n" + output+=" platforms=[\"${platforms_str}\"]\n" + output+=" context=\"./${version_path}\"\n" + output+="}\n\n" + + echo "${output}" +} + +function build_bake_file() { + g_latest_version=$(find_latest_server_version) + g_container_release="$(date --utc +%Y%m%dT%H%M%SZ -d "@${g_start_time}")" + + local test_targets_str="" + local push_targets_str="" + local group_test_targets="" + local group_push_targets="" + + for version in $(support_versions "${g_registry}"); do + if support_config_filter "${version}" "${g_filter_versions[@]}"; then + continue + fi + + support_source_config "${g_registry}" "${version}" + skip="false" + + for edition in "${c_editions[@]}"; do + if support_config_filter "${edition}" "${g_filter_editions[@]}"; then + continue fi + + support_source_config "${g_registry}" "${version}" "${edition}" + + for distro_ix in "${!c_distros[@]}"; do + local distro="${c_distros[${distro_ix}]}" + local distro_dir="${c_distro_dir[${distro_ix}]}" + + if support_config_filter "${distro}" "${g_filter_distros[@]}"; then + continue + fi + + version_path="$(support_image_path "${g_registry}" \ + "${version}" "${edition}" "${distro_dir}")" + + if [ ! -d "${version_path}" ]; then + skip="true" + continue + fi + + # shellcheck disable=SC1090,SC1091 + source "${version_path}"/meta + + g_server_version=${META_AEROSPIKE_VERSION} + + test_targets_str+="$(do_bake_test_target "${version}" \ + "${distro}" "${distro_dir}" "${edition}")" + push_targets_str+="$(do_bake_push_target "${version}" \ + "${distro}" "${distro_dir}" "${edition}")" + group_test_targets+="$(do_bake_test_group_targets "${distro}" \ + "${edition}" "${version}")" + group_push_targets+="\"$(get_target_name "${version}" \ + "${distro}" "${edition}" "")\", " + done done + + if [[ "${skip}" == "false" ]]; then + group_test_targets=${group_test_targets%", "} + group_push_targets=${group_push_targets%", "} + group_test_targets+=",\n " + group_push_targets+=",\n " + fi + done + + group_test_targets=${group_test_targets%",\n "} + group_push_targets=${group_push_targets%",\n "} + + local test_group_str + test_group_str="$(do_bake_group "test" "${group_test_targets}")" + local push_group_str + push_group_str="$(do_bake_group "push" "${group_push_targets}")" + + mkdir -p "${g_target_dir}/${g_registry}" + + local bake_file="${g_target_dir}/${g_registry}/bake.hcl" + cat <<-EOF >"${bake_file}" +# This file contains the targets for the test images. +# This file is auto-generated by the build.sh script and will be wiped out by +# the build.sh script. Please don't edit this file. +# +# Build all test/push images: +# docker buildx bake -f ${bake_file} [test | push] --progress plain [--load | --push] +# Build selected images: +# docker buildx bake -f ${bake_file} [target name, ...] --progress plain [--load | --push] + +EOF + + { + printf "%b\n%b" "${test_group_str}" "${test_targets_str}" + printf "%b\n%b" "${push_group_str}" "${push_targets_str}" + } >>"${bake_file}" +} + +function build_images() { + local target= + + if [ "${g_test_build}" = "true" ]; then + target="test" + elif [ "${g_push_build}" = "true" ]; then + target="push" fi local params= @@ -121,16 +362,33 @@ function main() { params="--push" fi - local bake_file="bake.hcl" + local bake_file="${g_target_dir}/${g_registry}/bake.hcl" + + log_info "main() - build '${bake_file}'" + local revision= revision="$(git rev-parse HEAD)" local created= - created="$(date --rfc-3339=seconds)" + created="$(date --utc --rfc-3339=seconds -d "@${g_start_time}")" verbose_call docker buildx bake --pull --progress plain ${params} \ --set "\*.labels.org.opencontainers.image.revision=\"${revision}\"" \ --set "\*.labels.org.opencontainers.image.created=\"${created}\"" \ - --file "${bake_file}" "${targets}" + --file "${bake_file}" "${target}" +} + +function main() { + parse_args "$@" + + g_start_time="$(date --utc +%s)" + + build_bake_file + + if [ "${g_dry_run}" = "true" ]; then + exit 0 + fi + + build_images } main "$@" diff --git a/community/ubuntu22.04/README.md b/community/ubuntu22.04/README.md deleted file mode 100644 index a0bb028c..00000000 --- a/community/ubuntu22.04/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# 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/ubuntu22.04/entrypoint.sh b/community/ubuntu22.04/entrypoint.sh deleted file mode 100755 index 1aa9d0ea..00000000 --- a/community/ubuntu22.04/entrypoint.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/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/data/config/dockerhub/6.1/config.sh b/data/config/dockerhub/6.1/config.sh new file mode 100644 index 00000000..41c12ed8 --- /dev/null +++ b/data/config/dockerhub/6.1/config.sh @@ -0,0 +1,11 @@ +# shellcheck shell=bash + +export c_editions=("enterprise" "federal" "community") + +export c_distros=("ubuntu20.04") +export c_distro_dir=("ubuntu20.04") +export c_distro_default="ubuntu20.04" +export c_distro_bases=("ubuntu:20.04") + +export c_archs=("x86_64") +export c_platforms=("linux/amd64") diff --git a/data/config/dockerhub/6.3/config.sh b/data/config/dockerhub/6.3/config.sh new file mode 100644 index 00000000..93f9b725 --- /dev/null +++ b/data/config/dockerhub/6.3/config.sh @@ -0,0 +1,11 @@ +# shellcheck shell=bash + +export c_editions=("enterprise" "federal" "community") + +export c_distros=("ubuntu22.04") +export c_distro_dir=("ubuntu22.04") +export c_distro_default="ubuntu22.04" +export c_distro_bases=("ubuntu:22.04") + +export c_archs=("x86_64" "aarch64") +export c_platforms=("linux/amd64" "linux/arm64") diff --git a/data/config/dockerhub/6.3/federal/config.sh b/data/config/dockerhub/6.3/federal/config.sh new file mode 100644 index 00000000..d60827f9 --- /dev/null +++ b/data/config/dockerhub/6.3/federal/config.sh @@ -0,0 +1,4 @@ +# shellcheck shell=bash + +export c_archs=("x86_64") +export c_platforms=("linux/amd64") diff --git a/data/config/dockerhub/6.4/config.sh b/data/config/dockerhub/6.4/config.sh new file mode 100644 index 00000000..93f9b725 --- /dev/null +++ b/data/config/dockerhub/6.4/config.sh @@ -0,0 +1,11 @@ +# shellcheck shell=bash + +export c_editions=("enterprise" "federal" "community") + +export c_distros=("ubuntu22.04") +export c_distro_dir=("ubuntu22.04") +export c_distro_default="ubuntu22.04" +export c_distro_bases=("ubuntu:22.04") + +export c_archs=("x86_64" "aarch64") +export c_platforms=("linux/amd64" "linux/arm64") diff --git a/data/config/dockerhub/6.4/federal/config.sh b/data/config/dockerhub/6.4/federal/config.sh new file mode 100644 index 00000000..d60827f9 --- /dev/null +++ b/data/config/dockerhub/6.4/federal/config.sh @@ -0,0 +1,4 @@ +# shellcheck shell=bash + +export c_archs=("x86_64") +export c_platforms=("linux/amd64") diff --git a/data/config/dockerhub/7.0/config.sh b/data/config/dockerhub/7.0/config.sh new file mode 100644 index 00000000..93f9b725 --- /dev/null +++ b/data/config/dockerhub/7.0/config.sh @@ -0,0 +1,11 @@ +# shellcheck shell=bash + +export c_editions=("enterprise" "federal" "community") + +export c_distros=("ubuntu22.04") +export c_distro_dir=("ubuntu22.04") +export c_distro_default="ubuntu22.04" +export c_distro_bases=("ubuntu:22.04") + +export c_archs=("x86_64" "aarch64") +export c_platforms=("linux/amd64" "linux/arm64") diff --git a/data/config/dockerhub/7.0/federal/config.sh b/data/config/dockerhub/7.0/federal/config.sh new file mode 100644 index 00000000..d60827f9 --- /dev/null +++ b/data/config/dockerhub/7.0/federal/config.sh @@ -0,0 +1,4 @@ +# shellcheck shell=bash + +export c_archs=("x86_64") +export c_platforms=("linux/amd64") diff --git a/data/config/dockerhub/7.1/config.sh b/data/config/dockerhub/7.1/config.sh new file mode 100644 index 00000000..93f9b725 --- /dev/null +++ b/data/config/dockerhub/7.1/config.sh @@ -0,0 +1,11 @@ +# shellcheck shell=bash + +export c_editions=("enterprise" "federal" "community") + +export c_distros=("ubuntu22.04") +export c_distro_dir=("ubuntu22.04") +export c_distro_default="ubuntu22.04" +export c_distro_bases=("ubuntu:22.04") + +export c_archs=("x86_64" "aarch64") +export c_platforms=("linux/amd64" "linux/arm64") diff --git a/data/config/dockerhub/7.1/federal/config.sh b/data/config/dockerhub/7.1/federal/config.sh new file mode 100644 index 00000000..d60827f9 --- /dev/null +++ b/data/config/dockerhub/7.1/federal/config.sh @@ -0,0 +1,4 @@ +# shellcheck shell=bash + +export c_archs=("x86_64") +export c_platforms=("linux/amd64") diff --git a/data/config/dockerhub/config.sh b/data/config/dockerhub/config.sh new file mode 100644 index 00000000..9c9f730e --- /dev/null +++ b/data/config/dockerhub/config.sh @@ -0,0 +1,3 @@ +# shellcheck shell=bash + +export c_registry_url="docker.io" diff --git a/data/config/redhat/6.1/config.sh b/data/config/redhat/6.1/config.sh new file mode 100644 index 00000000..7bc272f4 --- /dev/null +++ b/data/config/redhat/6.1/config.sh @@ -0,0 +1,11 @@ +# shellcheck shell=bash + +export c_editions=("enterprise" "community") + +export c_distros=("el8") +export c_distro_dir=("ubi8") +export c_distro_default="el8" +export c_distro_bases=("ubi8-minimal") + +export c_archs=("x86_64") +export c_platforms=("linux/amd64") diff --git a/data/config/redhat/6.3/config.sh b/data/config/redhat/6.3/config.sh new file mode 100644 index 00000000..662c09ff --- /dev/null +++ b/data/config/redhat/6.3/config.sh @@ -0,0 +1,11 @@ +# shellcheck shell=bash + +export c_editions=("enterprise" "community") + +export c_distros=("el9") +export c_distro_dir=("ubi9") +export c_distro_default="el9" +export c_distro_bases=("ubi9-minimal") + +export c_archs=("x86_64" "aarch64") +export c_platforms=("linux/amd64" "linux/arm64") diff --git a/data/config/redhat/6.4/config.sh b/data/config/redhat/6.4/config.sh new file mode 100644 index 00000000..662c09ff --- /dev/null +++ b/data/config/redhat/6.4/config.sh @@ -0,0 +1,11 @@ +# shellcheck shell=bash + +export c_editions=("enterprise" "community") + +export c_distros=("el9") +export c_distro_dir=("ubi9") +export c_distro_default="el9" +export c_distro_bases=("ubi9-minimal") + +export c_archs=("x86_64" "aarch64") +export c_platforms=("linux/amd64" "linux/arm64") diff --git a/data/config/redhat/7.0/config.sh b/data/config/redhat/7.0/config.sh new file mode 100644 index 00000000..662c09ff --- /dev/null +++ b/data/config/redhat/7.0/config.sh @@ -0,0 +1,11 @@ +# shellcheck shell=bash + +export c_editions=("enterprise" "community") + +export c_distros=("el9") +export c_distro_dir=("ubi9") +export c_distro_default="el9" +export c_distro_bases=("ubi9-minimal") + +export c_archs=("x86_64" "aarch64") +export c_platforms=("linux/amd64" "linux/arm64") diff --git a/data/config/redhat/7.1/config.sh b/data/config/redhat/7.1/config.sh new file mode 100644 index 00000000..662c09ff --- /dev/null +++ b/data/config/redhat/7.1/config.sh @@ -0,0 +1,11 @@ +# shellcheck shell=bash + +export c_editions=("enterprise" "community") + +export c_distros=("el9") +export c_distro_dir=("ubi9") +export c_distro_default="el9" +export c_distro_bases=("ubi9-minimal") + +export c_archs=("x86_64" "aarch64") +export c_platforms=("linux/amd64" "linux/arm64") diff --git a/data/config/redhat/config.sh b/data/config/redhat/config.sh new file mode 100644 index 00000000..c468c9a0 --- /dev/null +++ b/data/config/redhat/config.sh @@ -0,0 +1,3 @@ +# shellcheck shell=bash + +export c_registry_url="registry.access.redhat.com" diff --git a/community/COMMUNITY_LICENSE b/data/res/COMMUNITY_LICENSE similarity index 100% rename from community/COMMUNITY_LICENSE rename to data/res/COMMUNITY_LICENSE diff --git a/enterprise/ENTERPRISE_LICENSE b/data/res/ENTERPRISE_LICENSE similarity index 100% rename from enterprise/ENTERPRISE_LICENSE rename to data/res/ENTERPRISE_LICENSE diff --git a/federal/FEDERAL_LICENSE b/data/res/FEDERAL_LICENSE similarity index 100% rename from federal/FEDERAL_LICENSE rename to data/res/FEDERAL_LICENSE diff --git a/scripts/00-prelude-deb.part b/data/scripts/00-prelude-deb.part similarity index 97% rename from scripts/00-prelude-deb.part rename to data/scripts/00-prelude-deb.part index 82b0c7e9..25545d86 100644 --- a/scripts/00-prelude-deb.part +++ b/data/scripts/00-prelude-deb.part @@ -7,6 +7,7 @@ binutils \ ca-certificates \ curl \ + file \ xz-utils; \ }; \ { \ diff --git a/data/scripts/00-prelude-rpm.part b/data/scripts/00-prelude-rpm.part new file mode 100644 index 00000000..17c0e153 --- /dev/null +++ b/data/scripts/00-prelude-rpm.part @@ -0,0 +1,16 @@ + { \ + # 00-prelude-rpm.part - Setup dependencies for scripts. + microdnf update -y; \ + microdnf install -y \ + binutils \ + file \ + findutils \ + gzip \ + shadow-utils \ + tar \ + xz; \ + }; \ + { \ + # 00-prelude-rpm.part - Install procps for tests. + microdnf install -y procps-ng; \ + }; \ diff --git a/scripts/10-download.part b/data/scripts/10-download.part similarity index 62% rename from scripts/10-download.part rename to data/scripts/10-download.part index b76f5b87..641515c9 100644 --- a/scripts/10-download.part +++ b/data/scripts/10-download.part @@ -4,42 +4,48 @@ }; \ { \ # 10-common.part - Install tini. - ARCH="$(dpkg --print-architecture)"; \ - if [ "${ARCH}" = "amd64" ]; then \ + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ suffix=""; \ - elif [ "${ARCH}" = "arm64" ]; then \ + elif [ "${ARCH}" = "aarch64" ]; 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; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ 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)"; \ + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ mkdir -p aerospike/pkg; \ - if [ "${ARCH}" = "amd64" ]; then \ + if [ "${ARCH}" = "x86-64" ]; then \ pkg_link="${AEROSPIKE_X86_64_LINK}"; \ sha256="${AEROSPIKE_SHA_X86_64}"; \ - elif [ "${ARCH}" = "arm64" ]; then \ + elif [ "${ARCH}" = "aarch64" ]; 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 \ + if [ "$(curl -fsSL "${pkg_link}" --output aerospike-server.tgz --write-out "%{response_code}")" != "200" ]; then \ echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ exit 1; \ fi; \ echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ - rm aerospike-server.tgz; \ + rm -f aerospike-server.tgz; \ # These directories are required for backward compatibility. mkdir -p /var/{log,run}/aerospike; \ # Copy license file to standard location. diff --git a/scripts/20-install-dependencies-deb.part b/data/scripts/20-install-dependencies-deb.part similarity index 50% rename from scripts/20-install-dependencies-deb.part rename to data/scripts/20-install-dependencies-deb.part index 6620352d..e71e5db5 100644 --- a/scripts/20-install-dependencies-deb.part +++ b/data/scripts/20-install-dependencies-deb.part @@ -1,23 +1,16 @@ { \ # 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; \ + apt-get install -y --no-install-recommends \ + # required for EE and pre 6.0 + libcurl4 \ + # required for EE + libldap-2.4.2; \ 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 \ + if ! [ "$(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/data/scripts/20-install-dependencies-rpm.part b/data/scripts/20-install-dependencies-rpm.part new file mode 100644 index 00000000..51763a3d --- /dev/null +++ b/data/scripts/20-install-dependencies-rpm.part @@ -0,0 +1,21 @@ + { \ + # 20-install-dependencies-rpm.part - Install server and dependencies. + rpm -i aerospike/aerospike-server-*.rpm; \ + rm -rf /opt/aerospike/bin; \ + }; \ + { \ + # 20-install-dependencies-rpm.part - Install tools dependencies. + if ! [ "$(printf "%s\n%s" "${VERSION}" "6.2.0.3" | sort -V | head -1)" != "${VERSION}" ]; then \ + # Tools before 6.0 need python3. + microdnf install -y python3; \ + fi; \ + # Tools after 6.0 bundled their own python interpreter. + }; \ + { \ + # 20-install-dependencies-rpm.part - Extract tools. + pushd aerospike/pkg || exit 1; \ + rpm2archive -n ../aerospike-tools*.rpm; \ + tar xf ../aerospike-tools*.tar -C .; \ + rm -f ../aerospike-tools*.tar; \ + popd || exit 1; \ + }; \ diff --git a/scripts/30-install-tools.part b/data/scripts/30-install-tools.part similarity index 96% rename from scripts/30-install-tools.part rename to data/scripts/30-install-tools.part index fdd2c27e..62f1162b 100644 --- a/scripts/30-install-tools.part +++ b/data/scripts/30-install-tools.part @@ -1,6 +1,6 @@ { \ # 30-install-tools.part - install asinfo and asadm. - find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} +; \ + find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} + || true; \ 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; \ diff --git a/scripts/40-cleanup.part b/data/scripts/40-cleanup.part similarity index 100% rename from scripts/40-cleanup.part rename to data/scripts/40-cleanup.part diff --git a/scripts/50-remove-prelude-deb.part b/data/scripts/50-remove-prelude-deb.part similarity index 96% rename from scripts/50-remove-prelude-deb.part rename to data/scripts/50-remove-prelude-deb.part index a8285dd8..6318b2b0 100644 --- a/scripts/50-remove-prelude-deb.part +++ b/data/scripts/50-remove-prelude-deb.part @@ -6,6 +6,7 @@ binutils \ ca-certificates \ curl \ + file \ xz-utils 2>&1; \ apt-get purge -y; \ apt-get autoremove -y; \ diff --git a/data/scripts/50-remove-prelude-rpm.part b/data/scripts/50-remove-prelude-rpm.part new file mode 100644 index 00000000..978fa0b2 --- /dev/null +++ b/data/scripts/50-remove-prelude-rpm.part @@ -0,0 +1,12 @@ + { \ + # 50-remove-prelude-rpm.part - Remove dependencies for scripts. + microdnf remove -y \ + # binutils - dependency issues on ubi9 + file \ + findutils \ + # gzip - dependency issues on ubi9 + shadow-utils \ + tar \ + xz 2>&1; \ + microdnf clean all; \ + }; \ diff --git a/template/0/Dockerfile.template b/data/template/0/Dockerfile.template similarity index 75% rename from template/0/Dockerfile.template rename to data/template/0/Dockerfile.template index 00ec1a61..6f1234c5 100644 --- a/template/0/Dockerfile.template +++ b/data/template/0/Dockerfile.template @@ -4,23 +4,7 @@ # http://github.com/aerospike/aerospike-server.docker # -FROM ${LINUX_BASE} - -LABEL org.opencontainers.image.title=\"Aerospike ${AEROSPIKE_EDITION^} Server\" \\ - org.opencontainers.image.description=\"${AEROSPIKE_DESCRIPTION}\" \\ - org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ - org.opencontainers.image.base.name=\"docker.io/library/${LINUX_BASE}\" \\ - org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ - org.opencontainers.image.vendor="Aerospike" \ - org.opencontainers.image.version=\"${AEROSPIKE_VERSION}\" \\ - org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" - -# 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=\"${AEROSPIKE_EDITION}\" +FROM ${DOCKER_REGISTRY_URL}/${LINUX_BASE} ARG AEROSPIKE_X86_64_LINK=\"${AEROSPIKE_X86_64_LINK}\" ARG AEROSPIKE_SHA_X86_64=\"${AEROSPIKE_SHA_X86_64}\" @@ -31,14 +15,23 @@ SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"] # Install Aerospike Server and Tools RUN \ -$(cat scripts/00-prelude-deb.part) -$(cat scripts/10-download.part) -$(cat scripts/20-install-dependencies-deb.part) -$(cat scripts/30-install-tools.part) -$(cat scripts/40-cleanup.part) -$(cat scripts/50-remove-prelude-deb.part) +$(cat ${g_data_scripts_dir}/00-prelude-${LINUX_PKG_TYPE}.part) +$(cat ${g_data_scripts_dir}/10-download.part) +$(cat ${g_data_scripts_dir}/20-install-dependencies-${LINUX_PKG_TYPE}.part) +$(cat ${g_data_scripts_dir}/30-install-tools.part) +$(cat ${g_data_scripts_dir}/40-cleanup.part) +$(cat ${g_data_scripts_dir}/50-remove-prelude-${LINUX_PKG_TYPE}.part) echo "done"; +LABEL org.opencontainers.image.title=\"Aerospike ${AEROSPIKE_EDITION^} Server\" \\ + org.opencontainers.image.description=\"${AEROSPIKE_DESCRIPTION}\" \\ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name=\"docker.io/library/${LINUX_BASE}\" \\ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version=\"${AEROSPIKE_VERSION}\" \\ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + # Add the Aerospike configuration specific to this dockerfile COPY aerospike.template.conf /etc/aerospike/aerospike.template.conf @@ -55,6 +48,9 @@ COPY aerospike.template.conf /etc/aerospike/aerospike.template.conf # EXPOSE 3000 3001 3002 +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + COPY entrypoint.sh /entrypoint.sh # Tini init set to restart ASD on SIGUSR1 and terminate ASD on SIGTERM diff --git a/template/0/aerospike.template.conf b/data/template/0/aerospike.template.conf similarity index 100% rename from template/0/aerospike.template.conf rename to data/template/0/aerospike.template.conf diff --git a/data/template/0/entrypoint.sh b/data/template/0/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/data/template/0/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 -f "${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/community/ubuntu22.04/aerospike.template.conf b/data/template/7/aerospike.template.conf similarity index 100% rename from community/ubuntu22.04/aerospike.template.conf rename to data/template/7/aerospike.template.conf diff --git a/docs/build.md b/docs/build.md index 34e7e2d5..4413f4f6 100644 --- a/docs/build.md +++ b/docs/build.md @@ -47,28 +47,26 @@ cd aerospike-server.docker 2. Run `update.sh` with target version. ```shell - ./update.sh -s + ./update.sh ``` 3. After the update script has run, commit the changes and tag the release. ```shell - git add enterprise federal community bake.hcl - git commit -m "" - git tag -a "" -m "" + git commit images -m "Adding version #.#" ``` 4. Verify the tag format is correct. ```shell - ./update.sh -g 2>/dev/null && [ -z "$(git diff --stat)" ] && echo "Tag is good" || echo -e "\033[0;31mBad Tag\033[0m" + ./update.sh 2>/dev/null && [ -z "$(git diff --stat)" ] && echo "Tag is good" || echo -e "\033[0;31mBad Tag\033[0m" ``` 5. Build test images and test. ```shell ./build.sh -t - ./test.sh --clean + ./test.sh ``` 6. Build image for publishing and publish. @@ -85,19 +83,21 @@ cd aerospike-server.docker ## About update.sh -By default, the `update.sh` script will automatically find the latest release in the artifacts index. The user may also specify a particular server release using the `-s ` option. The `update.sh` script will apply this version to the enterprise, federal, and community docker templates. If the version specified doesn't support a particular edition then that edition will not be populated. +The `update.sh` script will finds the latest release for each version in the `data/config/` directory. The `config.sh` and `config_.sh` inform the script of which server editions, linux distributions, and hardware platforms are supported by the version parent directory in `data/config/`. -The `update.sh` script is also used in GitHub actions with the `-g` option. The `-g` option uses the version found in `git describe` to update the templates. The GitHub action then verifies that running the update this way does not change the contents of the repository - which means all the relevant files correctly pushed and the tag followed to standard format. +The `update.sh` script is also used in GitHub actions - the github action will fail if there are uncommitted changes after running `update.sh`. ## About build.sh -By default, `build.sh` discovers the server version from the enterprise Dockerfile (which the script assumes is always generated). Build uses the server version to determine which architectures that are supported and builds each variant generated by `update.sh`. +The `build.sh` script uses the same `data/config` files to determine editions, etc. The script generates `target/bake.hcl` which defines all the images and tags to be built. There are two groups of images: "test" and "push". The "test" group is consumed by `test.sh` and built by running `./build.sh -t`. The "push" group are the published images. The reason for the two groups is that the `test.sh` script currently cannot test local multi-platform images which are generated by the `-p` option. Currently we are unable to test multi-platform docker images without pushing those images to a registry. To work around this issue, build has two modes, test and push. The test mode allows the `test.sh` to locally verify that the docker containers are functioning properly. The push mode builds and publishes the multi-platform containers. ## About test.sh -By default, `test.sh` discovers each architecture which needs to be tested based on the server version it discovers from the enterprise Dockerfile - same as `build.sh` above. It will also, by default, test each variant generated by `update.sh`. Currently it performs the following tests: +The `test.sh` script uses the same `data/config` files to determine editions, etc. The script will test each image generated by `./build.sh -t`. + +Currently it performs the following tests: 1. The container is running. 2. The container is running with the target platform. @@ -106,4 +106,4 @@ By default, `test.sh` discovers each architecture which needs to be tested based 5. The Aerospike database is running the expected version. 6. The Aerospike database is running the expected edition. -The `test.sh` script's `--clean` option removes the test images after the tests complete successfully. +The `test.sh` script's `-c` option removes the test images after the tests complete successfully. diff --git a/enterprise/ubuntu22.04/README.md b/enterprise/ubuntu22.04/README.md deleted file mode 100644 index a0bb028c..00000000 --- a/enterprise/ubuntu22.04/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# 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/ubuntu22.04/entrypoint.sh b/enterprise/ubuntu22.04/entrypoint.sh deleted file mode 100755 index 1aa9d0ea..00000000 --- a/enterprise/ubuntu22.04/entrypoint.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/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/ubuntu22.04/README.md b/federal/ubuntu22.04/README.md deleted file mode 100644 index a0bb028c..00000000 --- a/federal/ubuntu22.04/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# 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/ubuntu22.04/entrypoint.sh b/federal/ubuntu22.04/entrypoint.sh deleted file mode 100755 index 1aa9d0ea..00000000 --- a/federal/ubuntu22.04/entrypoint.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/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/images/dockerhub/6.1/community/ubuntu20.04/Dockerfile b/images/dockerhub/6.1/community/ubuntu20.04/Dockerfile new file mode 100644 index 00000000..e2423e0a --- /dev/null +++ b/images/dockerhub/6.1/community/ubuntu20.04/Dockerfile @@ -0,0 +1,193 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM docker.io/ubuntu:20.04 + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-community/6.1.0.40/aerospike-server-community-6.1.0.40-ubuntu20.04.tgz" +ARG AEROSPIKE_SHA_X86_64="a9cf9a207631522715aedc9dc0860bf7f3fa4cc879e61f9fd2915b0bb15d1faa" +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 \ + file \ + 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]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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. + apt-get install -y --no-install-recommends \ + # required for EE and pre 6.0 + libcurl4 \ + # required for EE + libldap-2.4.2; \ + 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}" "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 -x aerospike/aerospike-tools*.deb --output aerospike/pkg; \ + 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 {} + || true; \ + 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 \ + file \ + xz-utils 2>&1; \ + apt-get purge -y; \ + apt-get autoremove -y; \ + unset DEBIAN_FRONTEND; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Community Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubuntu:20.04" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="6.1.0.40" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/dockerhub/6.1/community/ubuntu20.04/LICENSE b/images/dockerhub/6.1/community/ubuntu20.04/LICENSE new file mode 100644 index 00000000..ff5e8e96 --- /dev/null +++ b/images/dockerhub/6.1/community/ubuntu20.04/LICENSE @@ -0,0 +1,13 @@ +Copyright 2014-2022 Aerospike, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/images/dockerhub/6.1/community/ubuntu20.04/aerospike.template.conf b/images/dockerhub/6.1/community/ubuntu20.04/aerospike.template.conf new file mode 100644 index 00000000..6737692b --- /dev/null +++ b/images/dockerhub/6.1/community/ubuntu20.04/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/images/dockerhub/6.1/community/ubuntu20.04/entrypoint.sh b/images/dockerhub/6.1/community/ubuntu20.04/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/dockerhub/6.1/community/ubuntu20.04/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 -f "${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/images/dockerhub/6.1/community/ubuntu20.04/meta b/images/dockerhub/6.1/community/ubuntu20.04/meta new file mode 100644 index 00000000..a58cc852 --- /dev/null +++ b/images/dockerhub/6.1/community/ubuntu20.04/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='docker.io' +META_LINUX_BASE='ubuntu:20.04' +META_LINUX_PKG_TYPE='deb' +META_AEROSPIKE_VERSION='6.1.0.40' +META_AEROSPIKE_EDITION='community' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-community/6.1.0.40/aerospike-server-community-6.1.0.40-ubuntu20.04.tgz' +META_AEROSPIKE_SHA_X86_64='a9cf9a207631522715aedc9dc0860bf7f3fa4cc879e61f9fd2915b0bb15d1faa' +META_AEROSPIKE_AARCH64_LINK='' +META_AEROSPIKE_SHA_AARCH64='' diff --git a/images/dockerhub/6.1/enterprise/ubuntu20.04/Dockerfile b/images/dockerhub/6.1/enterprise/ubuntu20.04/Dockerfile new file mode 100644 index 00000000..a1961d6a --- /dev/null +++ b/images/dockerhub/6.1/enterprise/ubuntu20.04/Dockerfile @@ -0,0 +1,193 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM docker.io/ubuntu:20.04 + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/6.1.0.40/aerospike-server-enterprise-6.1.0.40-ubuntu20.04.tgz" +ARG AEROSPIKE_SHA_X86_64="f187f4ada4aeb5a0b008e978f0ee9a593d7c93dffa2ad07f9f082558d2f50e04" +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 \ + file \ + 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]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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. + apt-get install -y --no-install-recommends \ + # required for EE and pre 6.0 + libcurl4 \ + # required for EE + libldap-2.4.2; \ + 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}" "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 -x aerospike/aerospike-tools*.deb --output aerospike/pkg; \ + 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 {} + || true; \ + 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 \ + file \ + xz-utils 2>&1; \ + apt-get purge -y; \ + apt-get autoremove -y; \ + unset DEBIAN_FRONTEND; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Enterprise Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubuntu:20.04" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="6.1.0.40" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/dockerhub/6.1/enterprise/ubuntu20.04/LICENSE b/images/dockerhub/6.1/enterprise/ubuntu20.04/LICENSE new file mode 100644 index 00000000..0f6833df --- /dev/null +++ b/images/dockerhub/6.1/enterprise/ubuntu20.04/LICENSE @@ -0,0 +1,5 @@ +Copyright 2020-2022 Aerospike, Inc. + +If you are using the Aerospike Database EE evaluation feature key file, you are operating under the [Aerospike Evaluation License Agreement](https://www.aerospike.com/forms/evaluation-license-agreement/). + +If you are using a feature key file you received as part of your commercial enterprise license, you are operating under the [Aerospike Master License Agreement](https://www.aerospike.com/forms/master-license-agreement/). diff --git a/images/dockerhub/6.1/enterprise/ubuntu20.04/aerospike.template.conf b/images/dockerhub/6.1/enterprise/ubuntu20.04/aerospike.template.conf new file mode 100644 index 00000000..6737692b --- /dev/null +++ b/images/dockerhub/6.1/enterprise/ubuntu20.04/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/images/dockerhub/6.1/enterprise/ubuntu20.04/entrypoint.sh b/images/dockerhub/6.1/enterprise/ubuntu20.04/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/dockerhub/6.1/enterprise/ubuntu20.04/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 -f "${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/images/dockerhub/6.1/enterprise/ubuntu20.04/meta b/images/dockerhub/6.1/enterprise/ubuntu20.04/meta new file mode 100644 index 00000000..35ec2249 --- /dev/null +++ b/images/dockerhub/6.1/enterprise/ubuntu20.04/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='docker.io' +META_LINUX_BASE='ubuntu:20.04' +META_LINUX_PKG_TYPE='deb' +META_AEROSPIKE_VERSION='6.1.0.40' +META_AEROSPIKE_EDITION='enterprise' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-enterprise/6.1.0.40/aerospike-server-enterprise-6.1.0.40-ubuntu20.04.tgz' +META_AEROSPIKE_SHA_X86_64='f187f4ada4aeb5a0b008e978f0ee9a593d7c93dffa2ad07f9f082558d2f50e04' +META_AEROSPIKE_AARCH64_LINK='' +META_AEROSPIKE_SHA_AARCH64='' diff --git a/images/dockerhub/6.1/federal/ubuntu20.04/Dockerfile b/images/dockerhub/6.1/federal/ubuntu20.04/Dockerfile new file mode 100644 index 00000000..62e4fdc1 --- /dev/null +++ b/images/dockerhub/6.1/federal/ubuntu20.04/Dockerfile @@ -0,0 +1,193 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM docker.io/ubuntu:20.04 + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-federal/6.1.0.40/aerospike-server-federal-6.1.0.40-ubuntu20.04.tgz" +ARG AEROSPIKE_SHA_X86_64="f75667fa17a90adfd307091fb43ef9019a0d39ebea2129f316a30dc7adb1fd61" +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 \ + file \ + 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]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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. + apt-get install -y --no-install-recommends \ + # required for EE and pre 6.0 + libcurl4 \ + # required for EE + libldap-2.4.2; \ + 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}" "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 -x aerospike/aerospike-tools*.deb --output aerospike/pkg; \ + 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 {} + || true; \ + 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 \ + file \ + xz-utils 2>&1; \ + apt-get purge -y; \ + apt-get autoremove -y; \ + unset DEBIAN_FRONTEND; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Federal Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubuntu:20.04" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="6.1.0.40" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/dockerhub/6.1/federal/ubuntu20.04/LICENSE b/images/dockerhub/6.1/federal/ubuntu20.04/LICENSE new file mode 100644 index 00000000..a0884fd0 --- /dev/null +++ b/images/dockerhub/6.1/federal/ubuntu20.04/LICENSE @@ -0,0 +1,5 @@ +Copyright 2020-2022 Aerospike, Inc. + +If you are using the Aerospike Server Enterprise Edition for United States Federal evaluation feature key file, you are operating under the [Aerospike Evaluation License Agreement](https://aerospike.com/forms/evaluation-license-agreement/). + +If you are using a feature key file you received as part of your commercial federal license, you are operating under the [Aerospike Master License Agreement](https://aerospike.com/forms/master-license-agreement/). diff --git a/images/dockerhub/6.1/federal/ubuntu20.04/aerospike.template.conf b/images/dockerhub/6.1/federal/ubuntu20.04/aerospike.template.conf new file mode 100644 index 00000000..6737692b --- /dev/null +++ b/images/dockerhub/6.1/federal/ubuntu20.04/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/images/dockerhub/6.1/federal/ubuntu20.04/entrypoint.sh b/images/dockerhub/6.1/federal/ubuntu20.04/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/dockerhub/6.1/federal/ubuntu20.04/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 -f "${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/images/dockerhub/6.1/federal/ubuntu20.04/meta b/images/dockerhub/6.1/federal/ubuntu20.04/meta new file mode 100644 index 00000000..4a826336 --- /dev/null +++ b/images/dockerhub/6.1/federal/ubuntu20.04/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='docker.io' +META_LINUX_BASE='ubuntu:20.04' +META_LINUX_PKG_TYPE='deb' +META_AEROSPIKE_VERSION='6.1.0.40' +META_AEROSPIKE_EDITION='federal' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-federal/6.1.0.40/aerospike-server-federal-6.1.0.40-ubuntu20.04.tgz' +META_AEROSPIKE_SHA_X86_64='f75667fa17a90adfd307091fb43ef9019a0d39ebea2129f316a30dc7adb1fd61' +META_AEROSPIKE_AARCH64_LINK='' +META_AEROSPIKE_SHA_AARCH64='' diff --git a/community/ubuntu22.04/Dockerfile b/images/dockerhub/6.3/community/ubuntu22.04/Dockerfile similarity index 75% rename from community/ubuntu22.04/Dockerfile rename to images/dockerhub/6.3/community/ubuntu22.04/Dockerfile index 92603e55..c23be55c 100644 --- a/community/ubuntu22.04/Dockerfile +++ b/images/dockerhub/6.3/community/ubuntu22.04/Dockerfile @@ -5,28 +5,12 @@ # http://github.com/aerospike/aerospike-server.docker # -FROM ubuntu:22.04 +FROM docker.io/ubuntu:22.04 -LABEL org.opencontainers.image.title="Aerospike Community Server" \ - org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ - org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ - org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04" \ - org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ - org.opencontainers.image.vendor="Aerospike" \ - org.opencontainers.image.version="7.1.0.0" \ - org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" - -# 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/7.1.0.0/aerospike-server-community_7.1.0.0_tools-11.0.0_ubuntu22.04_x86_64.tgz" -ARG AEROSPIKE_SHA_X86_64="ab61ba2430ef89ef70ba3cb4e858cdc23c507428a2d244856c07f734141ee0eb" -ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-community/7.1.0.0/aerospike-server-community_7.1.0.0_tools-11.0.0_ubuntu22.04_aarch64.tgz" -ARG AEROSPIKE_SHA_AARCH64="ef6ea09e51ccbe6db01fc19dcae847ffbd7e2690972e64dd671c63f54b905b7b" +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-community/6.3.0.28/aerospike-server-community_6.3.0.28_tools-8.5.1_ubuntu22.04_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="5ce8629240afe69d96a7d48cdf826f590223155c84ada624c551b98f85c72729" +ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-community/6.3.0.28/aerospike-server-community_6.3.0.28_tools-8.5.1_ubuntu22.04_aarch64.tgz" +ARG AEROSPIKE_SHA_AARCH64="8c1d4b362ea451bd48f2e0a90de265aa2429950f2b00e2d636a792a6abed694b" SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"] @@ -41,6 +25,7 @@ RUN \ binutils \ ca-certificates \ curl \ + file \ xz-utils; \ }; \ { \ @@ -53,42 +38,48 @@ RUN \ }; \ { \ # 10-common.part - Install tini. - ARCH="$(dpkg --print-architecture)"; \ - if [ "${ARCH}" = "amd64" ]; then \ + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ suffix=""; \ - elif [ "${ARCH}" = "arm64" ]; then \ + elif [ "${ARCH}" = "aarch64" ]; 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; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ 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)"; \ + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ mkdir -p aerospike/pkg; \ - if [ "${ARCH}" = "amd64" ]; then \ + if [ "${ARCH}" = "x86-64" ]; then \ pkg_link="${AEROSPIKE_X86_64_LINK}"; \ sha256="${AEROSPIKE_SHA_X86_64}"; \ - elif [ "${ARCH}" = "arm64" ]; then \ + elif [ "${ARCH}" = "aarch64" ]; 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 \ + if [ "$(curl -fsSL "${pkg_link}" --output aerospike-server.tgz --write-out "%{response_code}")" != "200" ]; then \ echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ exit 1; \ fi; \ echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ - rm aerospike-server.tgz; \ + rm -f aerospike-server.tgz; \ # These directories are required for backward compatibility. mkdir -p /var/{log,run}/aerospike; \ # Copy license file to standard location. @@ -97,24 +88,17 @@ RUN \ }; \ { \ # 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; \ + apt-get install -y --no-install-recommends \ + # required for EE and pre 6.0 + libcurl4 \ + # required for EE + libldap-2.4.2; \ 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 \ + if ! [ "$(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 \ @@ -129,7 +113,7 @@ RUN \ }; \ { \ # 30-install-tools.part - install asinfo and asadm. - find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} +; \ + find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} + || true; \ 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; \ @@ -164,6 +148,7 @@ RUN \ binutils \ ca-certificates \ curl \ + file \ xz-utils 2>&1; \ apt-get purge -y; \ apt-get autoremove -y; \ @@ -171,6 +156,15 @@ RUN \ }; \ echo "done"; +LABEL org.opencontainers.image.title="Aerospike Community Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="6.3.0.28" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + # Add the Aerospike configuration specific to this dockerfile COPY aerospike.template.conf /etc/aerospike/aerospike.template.conf @@ -187,6 +181,9 @@ COPY aerospike.template.conf /etc/aerospike/aerospike.template.conf # EXPOSE 3000 3001 3002 +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + COPY entrypoint.sh /entrypoint.sh # Tini init set to restart ASD on SIGUSR1 and terminate ASD on SIGTERM diff --git a/images/dockerhub/6.3/community/ubuntu22.04/LICENSE b/images/dockerhub/6.3/community/ubuntu22.04/LICENSE new file mode 100644 index 00000000..ff5e8e96 --- /dev/null +++ b/images/dockerhub/6.3/community/ubuntu22.04/LICENSE @@ -0,0 +1,13 @@ +Copyright 2014-2022 Aerospike, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/images/dockerhub/6.3/community/ubuntu22.04/aerospike.template.conf b/images/dockerhub/6.3/community/ubuntu22.04/aerospike.template.conf new file mode 100644 index 00000000..6737692b --- /dev/null +++ b/images/dockerhub/6.3/community/ubuntu22.04/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/images/dockerhub/6.3/community/ubuntu22.04/entrypoint.sh b/images/dockerhub/6.3/community/ubuntu22.04/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/dockerhub/6.3/community/ubuntu22.04/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 -f "${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/images/dockerhub/6.3/community/ubuntu22.04/meta b/images/dockerhub/6.3/community/ubuntu22.04/meta new file mode 100644 index 00000000..fae7e86e --- /dev/null +++ b/images/dockerhub/6.3/community/ubuntu22.04/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='docker.io' +META_LINUX_BASE='ubuntu:22.04' +META_LINUX_PKG_TYPE='deb' +META_AEROSPIKE_VERSION='6.3.0.28' +META_AEROSPIKE_EDITION='community' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-community/6.3.0.28/aerospike-server-community_6.3.0.28_tools-8.5.1_ubuntu22.04_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='5ce8629240afe69d96a7d48cdf826f590223155c84ada624c551b98f85c72729' +META_AEROSPIKE_AARCH64_LINK='https://artifacts.aerospike.com/aerospike-server-community/6.3.0.28/aerospike-server-community_6.3.0.28_tools-8.5.1_ubuntu22.04_aarch64.tgz' +META_AEROSPIKE_SHA_AARCH64='8c1d4b362ea451bd48f2e0a90de265aa2429950f2b00e2d636a792a6abed694b' diff --git a/enterprise/ubuntu22.04/Dockerfile b/images/dockerhub/6.3/enterprise/ubuntu22.04/Dockerfile similarity index 75% rename from enterprise/ubuntu22.04/Dockerfile rename to images/dockerhub/6.3/enterprise/ubuntu22.04/Dockerfile index 854eb418..395fc59c 100644 --- a/enterprise/ubuntu22.04/Dockerfile +++ b/images/dockerhub/6.3/enterprise/ubuntu22.04/Dockerfile @@ -5,28 +5,12 @@ # http://github.com/aerospike/aerospike-server.docker # -FROM ubuntu:22.04 +FROM docker.io/ubuntu:22.04 -LABEL org.opencontainers.image.title="Aerospike Enterprise Server" \ - org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ - org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ - org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04" \ - org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ - org.opencontainers.image.vendor="Aerospike" \ - org.opencontainers.image.version="7.1.0.0" \ - org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" - -# 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/7.1.0.0/aerospike-server-enterprise_7.1.0.0_tools-11.0.0_ubuntu22.04_x86_64.tgz" -ARG AEROSPIKE_SHA_X86_64="6046f85cd37ebbbca8f3ad7a2079954a223de5a433ddb34104a8362846bdd002" -ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/7.1.0.0/aerospike-server-enterprise_7.1.0.0_tools-11.0.0_ubuntu22.04_aarch64.tgz" -ARG AEROSPIKE_SHA_AARCH64="20f50036269a1b59b611dae35952f80f77fdd549355590011af9fa51c7c1a94f" +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/6.3.0.28/aerospike-server-enterprise_6.3.0.28_tools-8.5.1_ubuntu22.04_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="f5ee58530ea0219f3caf962476b66bb9aa19089a24eb54cad81af8cc4a1e31a9" +ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/6.3.0.28/aerospike-server-enterprise_6.3.0.28_tools-8.5.1_ubuntu22.04_aarch64.tgz" +ARG AEROSPIKE_SHA_AARCH64="cebe344c1c2f805420ee8eca6301be5e5271bc2106bb9eddd06fe30640be2fc8" SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"] @@ -41,6 +25,7 @@ RUN \ binutils \ ca-certificates \ curl \ + file \ xz-utils; \ }; \ { \ @@ -53,42 +38,48 @@ RUN \ }; \ { \ # 10-common.part - Install tini. - ARCH="$(dpkg --print-architecture)"; \ - if [ "${ARCH}" = "amd64" ]; then \ + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ suffix=""; \ - elif [ "${ARCH}" = "arm64" ]; then \ + elif [ "${ARCH}" = "aarch64" ]; 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; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ 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)"; \ + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ mkdir -p aerospike/pkg; \ - if [ "${ARCH}" = "amd64" ]; then \ + if [ "${ARCH}" = "x86-64" ]; then \ pkg_link="${AEROSPIKE_X86_64_LINK}"; \ sha256="${AEROSPIKE_SHA_X86_64}"; \ - elif [ "${ARCH}" = "arm64" ]; then \ + elif [ "${ARCH}" = "aarch64" ]; 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 \ + if [ "$(curl -fsSL "${pkg_link}" --output aerospike-server.tgz --write-out "%{response_code}")" != "200" ]; then \ echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ exit 1; \ fi; \ echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ - rm aerospike-server.tgz; \ + rm -f aerospike-server.tgz; \ # These directories are required for backward compatibility. mkdir -p /var/{log,run}/aerospike; \ # Copy license file to standard location. @@ -97,24 +88,17 @@ RUN \ }; \ { \ # 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; \ + apt-get install -y --no-install-recommends \ + # required for EE and pre 6.0 + libcurl4 \ + # required for EE + libldap-2.4.2; \ 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 \ + if ! [ "$(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 \ @@ -129,7 +113,7 @@ RUN \ }; \ { \ # 30-install-tools.part - install asinfo and asadm. - find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} +; \ + find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} + || true; \ 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; \ @@ -164,6 +148,7 @@ RUN \ binutils \ ca-certificates \ curl \ + file \ xz-utils 2>&1; \ apt-get purge -y; \ apt-get autoremove -y; \ @@ -171,6 +156,15 @@ RUN \ }; \ echo "done"; +LABEL org.opencontainers.image.title="Aerospike Enterprise Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="6.3.0.28" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + # Add the Aerospike configuration specific to this dockerfile COPY aerospike.template.conf /etc/aerospike/aerospike.template.conf @@ -187,6 +181,9 @@ COPY aerospike.template.conf /etc/aerospike/aerospike.template.conf # EXPOSE 3000 3001 3002 +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + COPY entrypoint.sh /entrypoint.sh # Tini init set to restart ASD on SIGUSR1 and terminate ASD on SIGTERM diff --git a/images/dockerhub/6.3/enterprise/ubuntu22.04/LICENSE b/images/dockerhub/6.3/enterprise/ubuntu22.04/LICENSE new file mode 100644 index 00000000..0f6833df --- /dev/null +++ b/images/dockerhub/6.3/enterprise/ubuntu22.04/LICENSE @@ -0,0 +1,5 @@ +Copyright 2020-2022 Aerospike, Inc. + +If you are using the Aerospike Database EE evaluation feature key file, you are operating under the [Aerospike Evaluation License Agreement](https://www.aerospike.com/forms/evaluation-license-agreement/). + +If you are using a feature key file you received as part of your commercial enterprise license, you are operating under the [Aerospike Master License Agreement](https://www.aerospike.com/forms/master-license-agreement/). diff --git a/images/dockerhub/6.3/enterprise/ubuntu22.04/aerospike.template.conf b/images/dockerhub/6.3/enterprise/ubuntu22.04/aerospike.template.conf new file mode 100644 index 00000000..6737692b --- /dev/null +++ b/images/dockerhub/6.3/enterprise/ubuntu22.04/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/images/dockerhub/6.3/enterprise/ubuntu22.04/entrypoint.sh b/images/dockerhub/6.3/enterprise/ubuntu22.04/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/dockerhub/6.3/enterprise/ubuntu22.04/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 -f "${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/images/dockerhub/6.3/enterprise/ubuntu22.04/meta b/images/dockerhub/6.3/enterprise/ubuntu22.04/meta new file mode 100644 index 00000000..39a91d7d --- /dev/null +++ b/images/dockerhub/6.3/enterprise/ubuntu22.04/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='docker.io' +META_LINUX_BASE='ubuntu:22.04' +META_LINUX_PKG_TYPE='deb' +META_AEROSPIKE_VERSION='6.3.0.28' +META_AEROSPIKE_EDITION='enterprise' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-enterprise/6.3.0.28/aerospike-server-enterprise_6.3.0.28_tools-8.5.1_ubuntu22.04_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='f5ee58530ea0219f3caf962476b66bb9aa19089a24eb54cad81af8cc4a1e31a9' +META_AEROSPIKE_AARCH64_LINK='https://artifacts.aerospike.com/aerospike-server-enterprise/6.3.0.28/aerospike-server-enterprise_6.3.0.28_tools-8.5.1_ubuntu22.04_aarch64.tgz' +META_AEROSPIKE_SHA_AARCH64='cebe344c1c2f805420ee8eca6301be5e5271bc2106bb9eddd06fe30640be2fc8' diff --git a/federal/ubuntu22.04/Dockerfile b/images/dockerhub/6.3/federal/ubuntu22.04/Dockerfile similarity index 77% rename from federal/ubuntu22.04/Dockerfile rename to images/dockerhub/6.3/federal/ubuntu22.04/Dockerfile index 39c75f11..8fd131f6 100644 --- a/federal/ubuntu22.04/Dockerfile +++ b/images/dockerhub/6.3/federal/ubuntu22.04/Dockerfile @@ -5,26 +5,10 @@ # http://github.com/aerospike/aerospike-server.docker # -FROM ubuntu:22.04 +FROM docker.io/ubuntu:22.04 -LABEL org.opencontainers.image.title="Aerospike Federal Server" \ - org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ - org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ - org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04" \ - org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ - org.opencontainers.image.vendor="Aerospike" \ - org.opencontainers.image.version="7.1.0.0" \ - org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" - -# 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/7.1.0.0/aerospike-server-federal_7.1.0.0_tools-11.0.0_ubuntu22.04_x86_64.tgz" -ARG AEROSPIKE_SHA_X86_64="1a8446e5659aba4c1f8fd3ec47c770e916d16e554fe6b2bb036f53b650930916" +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-federal/6.3.0.28/aerospike-server-federal_6.3.0.28_tools-8.5.1_ubuntu22.04_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="e11fa5a7e61c2699e2458a6b691a1eacd1d164bb80f8601c47080668b123a725" ARG AEROSPIKE_AARCH64_LINK="" ARG AEROSPIKE_SHA_AARCH64="" @@ -41,6 +25,7 @@ RUN \ binutils \ ca-certificates \ curl \ + file \ xz-utils; \ }; \ { \ @@ -53,42 +38,48 @@ RUN \ }; \ { \ # 10-common.part - Install tini. - ARCH="$(dpkg --print-architecture)"; \ - if [ "${ARCH}" = "amd64" ]; then \ + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ suffix=""; \ - elif [ "${ARCH}" = "arm64" ]; then \ + elif [ "${ARCH}" = "aarch64" ]; 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; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ 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)"; \ + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ mkdir -p aerospike/pkg; \ - if [ "${ARCH}" = "amd64" ]; then \ + if [ "${ARCH}" = "x86-64" ]; then \ pkg_link="${AEROSPIKE_X86_64_LINK}"; \ sha256="${AEROSPIKE_SHA_X86_64}"; \ - elif [ "${ARCH}" = "arm64" ]; then \ + elif [ "${ARCH}" = "aarch64" ]; 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 \ + if [ "$(curl -fsSL "${pkg_link}" --output aerospike-server.tgz --write-out "%{response_code}")" != "200" ]; then \ echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ exit 1; \ fi; \ echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ - rm aerospike-server.tgz; \ + rm -f aerospike-server.tgz; \ # These directories are required for backward compatibility. mkdir -p /var/{log,run}/aerospike; \ # Copy license file to standard location. @@ -97,24 +88,17 @@ RUN \ }; \ { \ # 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; \ + apt-get install -y --no-install-recommends \ + # required for EE and pre 6.0 + libcurl4 \ + # required for EE + libldap-2.4.2; \ 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 \ + if ! [ "$(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 \ @@ -129,7 +113,7 @@ RUN \ }; \ { \ # 30-install-tools.part - install asinfo and asadm. - find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} +; \ + find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} + || true; \ 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; \ @@ -164,6 +148,7 @@ RUN \ binutils \ ca-certificates \ curl \ + file \ xz-utils 2>&1; \ apt-get purge -y; \ apt-get autoremove -y; \ @@ -171,6 +156,15 @@ RUN \ }; \ echo "done"; +LABEL org.opencontainers.image.title="Aerospike Federal Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="6.3.0.28" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + # Add the Aerospike configuration specific to this dockerfile COPY aerospike.template.conf /etc/aerospike/aerospike.template.conf @@ -187,6 +181,9 @@ COPY aerospike.template.conf /etc/aerospike/aerospike.template.conf # EXPOSE 3000 3001 3002 +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + COPY entrypoint.sh /entrypoint.sh # Tini init set to restart ASD on SIGUSR1 and terminate ASD on SIGTERM diff --git a/images/dockerhub/6.3/federal/ubuntu22.04/LICENSE b/images/dockerhub/6.3/federal/ubuntu22.04/LICENSE new file mode 100644 index 00000000..a0884fd0 --- /dev/null +++ b/images/dockerhub/6.3/federal/ubuntu22.04/LICENSE @@ -0,0 +1,5 @@ +Copyright 2020-2022 Aerospike, Inc. + +If you are using the Aerospike Server Enterprise Edition for United States Federal evaluation feature key file, you are operating under the [Aerospike Evaluation License Agreement](https://aerospike.com/forms/evaluation-license-agreement/). + +If you are using a feature key file you received as part of your commercial federal license, you are operating under the [Aerospike Master License Agreement](https://aerospike.com/forms/master-license-agreement/). diff --git a/images/dockerhub/6.3/federal/ubuntu22.04/aerospike.template.conf b/images/dockerhub/6.3/federal/ubuntu22.04/aerospike.template.conf new file mode 100644 index 00000000..6737692b --- /dev/null +++ b/images/dockerhub/6.3/federal/ubuntu22.04/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/images/dockerhub/6.3/federal/ubuntu22.04/entrypoint.sh b/images/dockerhub/6.3/federal/ubuntu22.04/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/dockerhub/6.3/federal/ubuntu22.04/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 -f "${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/images/dockerhub/6.3/federal/ubuntu22.04/meta b/images/dockerhub/6.3/federal/ubuntu22.04/meta new file mode 100644 index 00000000..05fd3c75 --- /dev/null +++ b/images/dockerhub/6.3/federal/ubuntu22.04/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='docker.io' +META_LINUX_BASE='ubuntu:22.04' +META_LINUX_PKG_TYPE='deb' +META_AEROSPIKE_VERSION='6.3.0.28' +META_AEROSPIKE_EDITION='federal' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-federal/6.3.0.28/aerospike-server-federal_6.3.0.28_tools-8.5.1_ubuntu22.04_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='e11fa5a7e61c2699e2458a6b691a1eacd1d164bb80f8601c47080668b123a725' +META_AEROSPIKE_AARCH64_LINK='' +META_AEROSPIKE_SHA_AARCH64='' diff --git a/images/dockerhub/6.4/community/ubuntu22.04/Dockerfile b/images/dockerhub/6.4/community/ubuntu22.04/Dockerfile new file mode 100644 index 00000000..5a2547b1 --- /dev/null +++ b/images/dockerhub/6.4/community/ubuntu22.04/Dockerfile @@ -0,0 +1,193 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM docker.io/ubuntu:22.04 + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-community/6.4.0.23/aerospike-server-community_6.4.0.23_tools-10.0.0_ubuntu22.04_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="1d38b1893235c24c4538a14e91711638bc1384a5c7bad9c455a41038dae05f8f" +ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-community/6.4.0.23/aerospike-server-community_6.4.0.23_tools-10.0.0_ubuntu22.04_aarch64.tgz" +ARG AEROSPIKE_SHA_AARCH64="20a793a3fc5b001567e2da3b427fcd42f9802e2899c3f43a5e4ed4915244e7fa" + +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 \ + file \ + 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]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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. + apt-get install -y --no-install-recommends \ + # required for EE and pre 6.0 + libcurl4 \ + # required for EE + libldap-2.4.2; \ + 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}" "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 -x aerospike/aerospike-tools*.deb --output aerospike/pkg; \ + 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 {} + || true; \ + 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 \ + file \ + xz-utils 2>&1; \ + apt-get purge -y; \ + apt-get autoremove -y; \ + unset DEBIAN_FRONTEND; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Community Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="6.4.0.23" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/dockerhub/6.4/community/ubuntu22.04/LICENSE b/images/dockerhub/6.4/community/ubuntu22.04/LICENSE new file mode 100644 index 00000000..ff5e8e96 --- /dev/null +++ b/images/dockerhub/6.4/community/ubuntu22.04/LICENSE @@ -0,0 +1,13 @@ +Copyright 2014-2022 Aerospike, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/images/dockerhub/6.4/community/ubuntu22.04/aerospike.template.conf b/images/dockerhub/6.4/community/ubuntu22.04/aerospike.template.conf new file mode 100644 index 00000000..6737692b --- /dev/null +++ b/images/dockerhub/6.4/community/ubuntu22.04/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/images/dockerhub/6.4/community/ubuntu22.04/entrypoint.sh b/images/dockerhub/6.4/community/ubuntu22.04/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/dockerhub/6.4/community/ubuntu22.04/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 -f "${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/images/dockerhub/6.4/community/ubuntu22.04/meta b/images/dockerhub/6.4/community/ubuntu22.04/meta new file mode 100644 index 00000000..dd07dcb7 --- /dev/null +++ b/images/dockerhub/6.4/community/ubuntu22.04/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='docker.io' +META_LINUX_BASE='ubuntu:22.04' +META_LINUX_PKG_TYPE='deb' +META_AEROSPIKE_VERSION='6.4.0.23' +META_AEROSPIKE_EDITION='community' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-community/6.4.0.23/aerospike-server-community_6.4.0.23_tools-10.0.0_ubuntu22.04_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='1d38b1893235c24c4538a14e91711638bc1384a5c7bad9c455a41038dae05f8f' +META_AEROSPIKE_AARCH64_LINK='https://artifacts.aerospike.com/aerospike-server-community/6.4.0.23/aerospike-server-community_6.4.0.23_tools-10.0.0_ubuntu22.04_aarch64.tgz' +META_AEROSPIKE_SHA_AARCH64='20a793a3fc5b001567e2da3b427fcd42f9802e2899c3f43a5e4ed4915244e7fa' diff --git a/images/dockerhub/6.4/enterprise/ubuntu22.04/Dockerfile b/images/dockerhub/6.4/enterprise/ubuntu22.04/Dockerfile new file mode 100644 index 00000000..59280b1c --- /dev/null +++ b/images/dockerhub/6.4/enterprise/ubuntu22.04/Dockerfile @@ -0,0 +1,193 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM docker.io/ubuntu:22.04 + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/6.4.0.23/aerospike-server-enterprise_6.4.0.23_tools-10.0.0_ubuntu22.04_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="436459d5fc54afc9d6c0fbe9c5ff4f671b210391e60d39d163d8a7e684b7c07f" +ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/6.4.0.23/aerospike-server-enterprise_6.4.0.23_tools-10.0.0_ubuntu22.04_aarch64.tgz" +ARG AEROSPIKE_SHA_AARCH64="5dab8322c95da35f72f075ba403ab1073adbe3a5ba541fa21cb6efea24f6bf7b" + +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 \ + file \ + 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]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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. + apt-get install -y --no-install-recommends \ + # required for EE and pre 6.0 + libcurl4 \ + # required for EE + libldap-2.4.2; \ + 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}" "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 -x aerospike/aerospike-tools*.deb --output aerospike/pkg; \ + 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 {} + || true; \ + 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 \ + file \ + xz-utils 2>&1; \ + apt-get purge -y; \ + apt-get autoremove -y; \ + unset DEBIAN_FRONTEND; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Enterprise Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="6.4.0.23" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/dockerhub/6.4/enterprise/ubuntu22.04/LICENSE b/images/dockerhub/6.4/enterprise/ubuntu22.04/LICENSE new file mode 100644 index 00000000..0f6833df --- /dev/null +++ b/images/dockerhub/6.4/enterprise/ubuntu22.04/LICENSE @@ -0,0 +1,5 @@ +Copyright 2020-2022 Aerospike, Inc. + +If you are using the Aerospike Database EE evaluation feature key file, you are operating under the [Aerospike Evaluation License Agreement](https://www.aerospike.com/forms/evaluation-license-agreement/). + +If you are using a feature key file you received as part of your commercial enterprise license, you are operating under the [Aerospike Master License Agreement](https://www.aerospike.com/forms/master-license-agreement/). diff --git a/images/dockerhub/6.4/enterprise/ubuntu22.04/aerospike.template.conf b/images/dockerhub/6.4/enterprise/ubuntu22.04/aerospike.template.conf new file mode 100644 index 00000000..6737692b --- /dev/null +++ b/images/dockerhub/6.4/enterprise/ubuntu22.04/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/images/dockerhub/6.4/enterprise/ubuntu22.04/entrypoint.sh b/images/dockerhub/6.4/enterprise/ubuntu22.04/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/dockerhub/6.4/enterprise/ubuntu22.04/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 -f "${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/images/dockerhub/6.4/enterprise/ubuntu22.04/meta b/images/dockerhub/6.4/enterprise/ubuntu22.04/meta new file mode 100644 index 00000000..c612ee72 --- /dev/null +++ b/images/dockerhub/6.4/enterprise/ubuntu22.04/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='docker.io' +META_LINUX_BASE='ubuntu:22.04' +META_LINUX_PKG_TYPE='deb' +META_AEROSPIKE_VERSION='6.4.0.23' +META_AEROSPIKE_EDITION='enterprise' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-enterprise/6.4.0.23/aerospike-server-enterprise_6.4.0.23_tools-10.0.0_ubuntu22.04_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='436459d5fc54afc9d6c0fbe9c5ff4f671b210391e60d39d163d8a7e684b7c07f' +META_AEROSPIKE_AARCH64_LINK='https://artifacts.aerospike.com/aerospike-server-enterprise/6.4.0.23/aerospike-server-enterprise_6.4.0.23_tools-10.0.0_ubuntu22.04_aarch64.tgz' +META_AEROSPIKE_SHA_AARCH64='5dab8322c95da35f72f075ba403ab1073adbe3a5ba541fa21cb6efea24f6bf7b' diff --git a/images/dockerhub/6.4/federal/ubuntu22.04/Dockerfile b/images/dockerhub/6.4/federal/ubuntu22.04/Dockerfile new file mode 100644 index 00000000..b6dcbc4e --- /dev/null +++ b/images/dockerhub/6.4/federal/ubuntu22.04/Dockerfile @@ -0,0 +1,193 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM docker.io/ubuntu:22.04 + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-federal/6.4.0.23/aerospike-server-federal_6.4.0.23_tools-10.0.0_ubuntu22.04_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="3b3ab64496a43ffea8a97e7954adfef0e0607a5bfbb4c3537f701e7abaf21f63" +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 \ + file \ + 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]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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. + apt-get install -y --no-install-recommends \ + # required for EE and pre 6.0 + libcurl4 \ + # required for EE + libldap-2.4.2; \ + 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}" "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 -x aerospike/aerospike-tools*.deb --output aerospike/pkg; \ + 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 {} + || true; \ + 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 \ + file \ + xz-utils 2>&1; \ + apt-get purge -y; \ + apt-get autoremove -y; \ + unset DEBIAN_FRONTEND; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Federal Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="6.4.0.23" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/dockerhub/6.4/federal/ubuntu22.04/LICENSE b/images/dockerhub/6.4/federal/ubuntu22.04/LICENSE new file mode 100644 index 00000000..a0884fd0 --- /dev/null +++ b/images/dockerhub/6.4/federal/ubuntu22.04/LICENSE @@ -0,0 +1,5 @@ +Copyright 2020-2022 Aerospike, Inc. + +If you are using the Aerospike Server Enterprise Edition for United States Federal evaluation feature key file, you are operating under the [Aerospike Evaluation License Agreement](https://aerospike.com/forms/evaluation-license-agreement/). + +If you are using a feature key file you received as part of your commercial federal license, you are operating under the [Aerospike Master License Agreement](https://aerospike.com/forms/master-license-agreement/). diff --git a/images/dockerhub/6.4/federal/ubuntu22.04/aerospike.template.conf b/images/dockerhub/6.4/federal/ubuntu22.04/aerospike.template.conf new file mode 100644 index 00000000..6737692b --- /dev/null +++ b/images/dockerhub/6.4/federal/ubuntu22.04/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/images/dockerhub/6.4/federal/ubuntu22.04/entrypoint.sh b/images/dockerhub/6.4/federal/ubuntu22.04/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/dockerhub/6.4/federal/ubuntu22.04/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 -f "${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/images/dockerhub/6.4/federal/ubuntu22.04/meta b/images/dockerhub/6.4/federal/ubuntu22.04/meta new file mode 100644 index 00000000..09ba0f1b --- /dev/null +++ b/images/dockerhub/6.4/federal/ubuntu22.04/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='docker.io' +META_LINUX_BASE='ubuntu:22.04' +META_LINUX_PKG_TYPE='deb' +META_AEROSPIKE_VERSION='6.4.0.23' +META_AEROSPIKE_EDITION='federal' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-federal/6.4.0.23/aerospike-server-federal_6.4.0.23_tools-10.0.0_ubuntu22.04_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='3b3ab64496a43ffea8a97e7954adfef0e0607a5bfbb4c3537f701e7abaf21f63' +META_AEROSPIKE_AARCH64_LINK='' +META_AEROSPIKE_SHA_AARCH64='' diff --git a/images/dockerhub/7.0/community/ubuntu22.04/Dockerfile b/images/dockerhub/7.0/community/ubuntu22.04/Dockerfile new file mode 100644 index 00000000..c180a5e1 --- /dev/null +++ b/images/dockerhub/7.0/community/ubuntu22.04/Dockerfile @@ -0,0 +1,193 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM docker.io/ubuntu:22.04 + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-community/7.0.0.15/aerospike-server-community_7.0.0.15_tools-10.2.1_ubuntu22.04_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="0d6e5fae0bd1cc0fa4a7352f055b23316720b8e8902091c7ac57557b42665518" +ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-community/7.0.0.15/aerospike-server-community_7.0.0.15_tools-10.2.1_ubuntu22.04_aarch64.tgz" +ARG AEROSPIKE_SHA_AARCH64="41b417ebba7908f1917de08e82e9002719973021a290bbf8b69f0e89e9cfa7f0" + +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 \ + file \ + 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]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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. + apt-get install -y --no-install-recommends \ + # required for EE and pre 6.0 + libcurl4 \ + # required for EE + libldap-2.4.2; \ + 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}" "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 -x aerospike/aerospike-tools*.deb --output aerospike/pkg; \ + 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 {} + || true; \ + 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 \ + file \ + xz-utils 2>&1; \ + apt-get purge -y; \ + apt-get autoremove -y; \ + unset DEBIAN_FRONTEND; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Community Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="7.0.0.15" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/dockerhub/7.0/community/ubuntu22.04/LICENSE b/images/dockerhub/7.0/community/ubuntu22.04/LICENSE new file mode 100644 index 00000000..ff5e8e96 --- /dev/null +++ b/images/dockerhub/7.0/community/ubuntu22.04/LICENSE @@ -0,0 +1,13 @@ +Copyright 2014-2022 Aerospike, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/enterprise/ubuntu22.04/aerospike.template.conf b/images/dockerhub/7.0/community/ubuntu22.04/aerospike.template.conf similarity index 100% rename from enterprise/ubuntu22.04/aerospike.template.conf rename to images/dockerhub/7.0/community/ubuntu22.04/aerospike.template.conf diff --git a/images/dockerhub/7.0/community/ubuntu22.04/entrypoint.sh b/images/dockerhub/7.0/community/ubuntu22.04/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/dockerhub/7.0/community/ubuntu22.04/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 -f "${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/images/dockerhub/7.0/community/ubuntu22.04/meta b/images/dockerhub/7.0/community/ubuntu22.04/meta new file mode 100644 index 00000000..17ee6191 --- /dev/null +++ b/images/dockerhub/7.0/community/ubuntu22.04/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='docker.io' +META_LINUX_BASE='ubuntu:22.04' +META_LINUX_PKG_TYPE='deb' +META_AEROSPIKE_VERSION='7.0.0.15' +META_AEROSPIKE_EDITION='community' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-community/7.0.0.15/aerospike-server-community_7.0.0.15_tools-10.2.1_ubuntu22.04_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='0d6e5fae0bd1cc0fa4a7352f055b23316720b8e8902091c7ac57557b42665518' +META_AEROSPIKE_AARCH64_LINK='https://artifacts.aerospike.com/aerospike-server-community/7.0.0.15/aerospike-server-community_7.0.0.15_tools-10.2.1_ubuntu22.04_aarch64.tgz' +META_AEROSPIKE_SHA_AARCH64='41b417ebba7908f1917de08e82e9002719973021a290bbf8b69f0e89e9cfa7f0' diff --git a/images/dockerhub/7.0/enterprise/ubuntu22.04/Dockerfile b/images/dockerhub/7.0/enterprise/ubuntu22.04/Dockerfile new file mode 100644 index 00000000..86dedb16 --- /dev/null +++ b/images/dockerhub/7.0/enterprise/ubuntu22.04/Dockerfile @@ -0,0 +1,193 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM docker.io/ubuntu:22.04 + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/7.0.0.15/aerospike-server-enterprise_7.0.0.15_tools-10.2.1_ubuntu22.04_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="60a2ac264ea1fb35318298a91dd2ac668e12b29959cdba59483978f9b4b28011" +ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/7.0.0.15/aerospike-server-enterprise_7.0.0.15_tools-10.2.1_ubuntu22.04_aarch64.tgz" +ARG AEROSPIKE_SHA_AARCH64="feb8b6756fd88c722db37b9e62700fc2aa882c84360da1349d66e2fc7bfa72a5" + +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 \ + file \ + 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]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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. + apt-get install -y --no-install-recommends \ + # required for EE and pre 6.0 + libcurl4 \ + # required for EE + libldap-2.4.2; \ + 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}" "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 -x aerospike/aerospike-tools*.deb --output aerospike/pkg; \ + 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 {} + || true; \ + 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 \ + file \ + xz-utils 2>&1; \ + apt-get purge -y; \ + apt-get autoremove -y; \ + unset DEBIAN_FRONTEND; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Enterprise Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="7.0.0.15" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/dockerhub/7.0/enterprise/ubuntu22.04/LICENSE b/images/dockerhub/7.0/enterprise/ubuntu22.04/LICENSE new file mode 100644 index 00000000..0f6833df --- /dev/null +++ b/images/dockerhub/7.0/enterprise/ubuntu22.04/LICENSE @@ -0,0 +1,5 @@ +Copyright 2020-2022 Aerospike, Inc. + +If you are using the Aerospike Database EE evaluation feature key file, you are operating under the [Aerospike Evaluation License Agreement](https://www.aerospike.com/forms/evaluation-license-agreement/). + +If you are using a feature key file you received as part of your commercial enterprise license, you are operating under the [Aerospike Master License Agreement](https://www.aerospike.com/forms/master-license-agreement/). diff --git a/federal/ubuntu22.04/aerospike.template.conf b/images/dockerhub/7.0/enterprise/ubuntu22.04/aerospike.template.conf similarity index 100% rename from federal/ubuntu22.04/aerospike.template.conf rename to images/dockerhub/7.0/enterprise/ubuntu22.04/aerospike.template.conf diff --git a/images/dockerhub/7.0/enterprise/ubuntu22.04/entrypoint.sh b/images/dockerhub/7.0/enterprise/ubuntu22.04/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/dockerhub/7.0/enterprise/ubuntu22.04/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 -f "${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/images/dockerhub/7.0/enterprise/ubuntu22.04/meta b/images/dockerhub/7.0/enterprise/ubuntu22.04/meta new file mode 100644 index 00000000..0445dea7 --- /dev/null +++ b/images/dockerhub/7.0/enterprise/ubuntu22.04/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='docker.io' +META_LINUX_BASE='ubuntu:22.04' +META_LINUX_PKG_TYPE='deb' +META_AEROSPIKE_VERSION='7.0.0.15' +META_AEROSPIKE_EDITION='enterprise' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-enterprise/7.0.0.15/aerospike-server-enterprise_7.0.0.15_tools-10.2.1_ubuntu22.04_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='60a2ac264ea1fb35318298a91dd2ac668e12b29959cdba59483978f9b4b28011' +META_AEROSPIKE_AARCH64_LINK='https://artifacts.aerospike.com/aerospike-server-enterprise/7.0.0.15/aerospike-server-enterprise_7.0.0.15_tools-10.2.1_ubuntu22.04_aarch64.tgz' +META_AEROSPIKE_SHA_AARCH64='feb8b6756fd88c722db37b9e62700fc2aa882c84360da1349d66e2fc7bfa72a5' diff --git a/images/dockerhub/7.0/federal/ubuntu22.04/Dockerfile b/images/dockerhub/7.0/federal/ubuntu22.04/Dockerfile new file mode 100644 index 00000000..6fc27d3b --- /dev/null +++ b/images/dockerhub/7.0/federal/ubuntu22.04/Dockerfile @@ -0,0 +1,193 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM docker.io/ubuntu:22.04 + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-federal/7.0.0.15/aerospike-server-federal_7.0.0.15_tools-10.2.1_ubuntu22.04_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="603371e63cd96547847fdc6cdf3503bb49738a52761662a2ea8791b124d154c8" +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 \ + file \ + 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]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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. + apt-get install -y --no-install-recommends \ + # required for EE and pre 6.0 + libcurl4 \ + # required for EE + libldap-2.4.2; \ + 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}" "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 -x aerospike/aerospike-tools*.deb --output aerospike/pkg; \ + 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 {} + || true; \ + 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 \ + file \ + xz-utils 2>&1; \ + apt-get purge -y; \ + apt-get autoremove -y; \ + unset DEBIAN_FRONTEND; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Federal Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="7.0.0.15" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/dockerhub/7.0/federal/ubuntu22.04/LICENSE b/images/dockerhub/7.0/federal/ubuntu22.04/LICENSE new file mode 100644 index 00000000..a0884fd0 --- /dev/null +++ b/images/dockerhub/7.0/federal/ubuntu22.04/LICENSE @@ -0,0 +1,5 @@ +Copyright 2020-2022 Aerospike, Inc. + +If you are using the Aerospike Server Enterprise Edition for United States Federal evaluation feature key file, you are operating under the [Aerospike Evaluation License Agreement](https://aerospike.com/forms/evaluation-license-agreement/). + +If you are using a feature key file you received as part of your commercial federal license, you are operating under the [Aerospike Master License Agreement](https://aerospike.com/forms/master-license-agreement/). diff --git a/template/7/aerospike.template.conf b/images/dockerhub/7.0/federal/ubuntu22.04/aerospike.template.conf similarity index 100% rename from template/7/aerospike.template.conf rename to images/dockerhub/7.0/federal/ubuntu22.04/aerospike.template.conf diff --git a/images/dockerhub/7.0/federal/ubuntu22.04/entrypoint.sh b/images/dockerhub/7.0/federal/ubuntu22.04/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/dockerhub/7.0/federal/ubuntu22.04/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 -f "${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/images/dockerhub/7.0/federal/ubuntu22.04/meta b/images/dockerhub/7.0/federal/ubuntu22.04/meta new file mode 100644 index 00000000..2d2cf435 --- /dev/null +++ b/images/dockerhub/7.0/federal/ubuntu22.04/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='docker.io' +META_LINUX_BASE='ubuntu:22.04' +META_LINUX_PKG_TYPE='deb' +META_AEROSPIKE_VERSION='7.0.0.15' +META_AEROSPIKE_EDITION='federal' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-federal/7.0.0.15/aerospike-server-federal_7.0.0.15_tools-10.2.1_ubuntu22.04_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='603371e63cd96547847fdc6cdf3503bb49738a52761662a2ea8791b124d154c8' +META_AEROSPIKE_AARCH64_LINK='' +META_AEROSPIKE_SHA_AARCH64='' diff --git a/images/dockerhub/7.1/community/ubuntu22.04/Dockerfile b/images/dockerhub/7.1/community/ubuntu22.04/Dockerfile new file mode 100644 index 00000000..de6432cf --- /dev/null +++ b/images/dockerhub/7.1/community/ubuntu22.04/Dockerfile @@ -0,0 +1,193 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM docker.io/ubuntu:22.04 + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-community/7.1.0.6/aerospike-server-community_7.1.0.6_tools-11.0.2_ubuntu22.04_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="d7653c9780f64b7d05b092385b609003b5faf11f7c57cae96c33dd1462bfec3a" +ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-community/7.1.0.6/aerospike-server-community_7.1.0.6_tools-11.0.2_ubuntu22.04_aarch64.tgz" +ARG AEROSPIKE_SHA_AARCH64="04328038169f4a8009123cf6fe5c636d78d71d5e1c0f5688f80a6821a92fc7b2" + +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 \ + file \ + 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]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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. + apt-get install -y --no-install-recommends \ + # required for EE and pre 6.0 + libcurl4 \ + # required for EE + libldap-2.4.2; \ + 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}" "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 -x aerospike/aerospike-tools*.deb --output aerospike/pkg; \ + 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 {} + || true; \ + 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 \ + file \ + xz-utils 2>&1; \ + apt-get purge -y; \ + apt-get autoremove -y; \ + unset DEBIAN_FRONTEND; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Community Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="7.1.0.6" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/dockerhub/7.1/community/ubuntu22.04/LICENSE b/images/dockerhub/7.1/community/ubuntu22.04/LICENSE new file mode 100644 index 00000000..ff5e8e96 --- /dev/null +++ b/images/dockerhub/7.1/community/ubuntu22.04/LICENSE @@ -0,0 +1,13 @@ +Copyright 2014-2022 Aerospike, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/images/dockerhub/7.1/community/ubuntu22.04/aerospike.template.conf b/images/dockerhub/7.1/community/ubuntu22.04/aerospike.template.conf new file mode 100644 index 00000000..7942a049 --- /dev/null +++ b/images/dockerhub/7.1/community/ubuntu22.04/aerospike.template.conf @@ -0,0 +1,68 @@ +# 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}") + cluster-name docker +} + +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. + nsup-period ${NSUP_PERIOD} + replication-factor 1 + storage-engine $([ "${DATA_IN_MEMORY}" = "true" ] && echo "memory" || echo "device") { + # For 'storage-engine memory' with 'device' or 'file' backing, we + # recommend having multiple devices (eight is recommended). One is used + # here for backward compatibility. + file /opt/aerospike/data/${NAMESPACE}.dat + filesize ${STORAGE_GB}G + $(([ -z "${DATA_IN_MEMORY}" ] || [ "${DATA_IN_MEMORY}" = "false" ]) && echo "read-page-cache ${READ_PAGE_CACHE}") + } +} diff --git a/images/dockerhub/7.1/community/ubuntu22.04/entrypoint.sh b/images/dockerhub/7.1/community/ubuntu22.04/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/dockerhub/7.1/community/ubuntu22.04/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 -f "${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/images/dockerhub/7.1/community/ubuntu22.04/meta b/images/dockerhub/7.1/community/ubuntu22.04/meta new file mode 100644 index 00000000..f9f8c598 --- /dev/null +++ b/images/dockerhub/7.1/community/ubuntu22.04/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='docker.io' +META_LINUX_BASE='ubuntu:22.04' +META_LINUX_PKG_TYPE='deb' +META_AEROSPIKE_VERSION='7.1.0.6' +META_AEROSPIKE_EDITION='community' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-community/7.1.0.6/aerospike-server-community_7.1.0.6_tools-11.0.2_ubuntu22.04_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='d7653c9780f64b7d05b092385b609003b5faf11f7c57cae96c33dd1462bfec3a' +META_AEROSPIKE_AARCH64_LINK='https://artifacts.aerospike.com/aerospike-server-community/7.1.0.6/aerospike-server-community_7.1.0.6_tools-11.0.2_ubuntu22.04_aarch64.tgz' +META_AEROSPIKE_SHA_AARCH64='04328038169f4a8009123cf6fe5c636d78d71d5e1c0f5688f80a6821a92fc7b2' diff --git a/images/dockerhub/7.1/enterprise/ubuntu22.04/Dockerfile b/images/dockerhub/7.1/enterprise/ubuntu22.04/Dockerfile new file mode 100644 index 00000000..55e3de49 --- /dev/null +++ b/images/dockerhub/7.1/enterprise/ubuntu22.04/Dockerfile @@ -0,0 +1,193 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM docker.io/ubuntu:22.04 + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/7.1.0.6/aerospike-server-enterprise_7.1.0.6_tools-11.0.2_ubuntu22.04_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="a9c6cee762efe92151117166da89c82637bb82aad80bffeb2972827e7581e23a" +ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/7.1.0.6/aerospike-server-enterprise_7.1.0.6_tools-11.0.2_ubuntu22.04_aarch64.tgz" +ARG AEROSPIKE_SHA_AARCH64="148b362f1bd829aabf9e76525c2d9f7fc7ba07e9f43d293b9907f09acb8e7e4d" + +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 \ + file \ + 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]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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. + apt-get install -y --no-install-recommends \ + # required for EE and pre 6.0 + libcurl4 \ + # required for EE + libldap-2.4.2; \ + 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}" "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 -x aerospike/aerospike-tools*.deb --output aerospike/pkg; \ + 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 {} + || true; \ + 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 \ + file \ + xz-utils 2>&1; \ + apt-get purge -y; \ + apt-get autoremove -y; \ + unset DEBIAN_FRONTEND; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Enterprise Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="7.1.0.6" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/dockerhub/7.1/enterprise/ubuntu22.04/LICENSE b/images/dockerhub/7.1/enterprise/ubuntu22.04/LICENSE new file mode 100644 index 00000000..0f6833df --- /dev/null +++ b/images/dockerhub/7.1/enterprise/ubuntu22.04/LICENSE @@ -0,0 +1,5 @@ +Copyright 2020-2022 Aerospike, Inc. + +If you are using the Aerospike Database EE evaluation feature key file, you are operating under the [Aerospike Evaluation License Agreement](https://www.aerospike.com/forms/evaluation-license-agreement/). + +If you are using a feature key file you received as part of your commercial enterprise license, you are operating under the [Aerospike Master License Agreement](https://www.aerospike.com/forms/master-license-agreement/). diff --git a/images/dockerhub/7.1/enterprise/ubuntu22.04/aerospike.template.conf b/images/dockerhub/7.1/enterprise/ubuntu22.04/aerospike.template.conf new file mode 100644 index 00000000..7942a049 --- /dev/null +++ b/images/dockerhub/7.1/enterprise/ubuntu22.04/aerospike.template.conf @@ -0,0 +1,68 @@ +# 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}") + cluster-name docker +} + +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. + nsup-period ${NSUP_PERIOD} + replication-factor 1 + storage-engine $([ "${DATA_IN_MEMORY}" = "true" ] && echo "memory" || echo "device") { + # For 'storage-engine memory' with 'device' or 'file' backing, we + # recommend having multiple devices (eight is recommended). One is used + # here for backward compatibility. + file /opt/aerospike/data/${NAMESPACE}.dat + filesize ${STORAGE_GB}G + $(([ -z "${DATA_IN_MEMORY}" ] || [ "${DATA_IN_MEMORY}" = "false" ]) && echo "read-page-cache ${READ_PAGE_CACHE}") + } +} diff --git a/images/dockerhub/7.1/enterprise/ubuntu22.04/entrypoint.sh b/images/dockerhub/7.1/enterprise/ubuntu22.04/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/dockerhub/7.1/enterprise/ubuntu22.04/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 -f "${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/images/dockerhub/7.1/enterprise/ubuntu22.04/meta b/images/dockerhub/7.1/enterprise/ubuntu22.04/meta new file mode 100644 index 00000000..05ac36c7 --- /dev/null +++ b/images/dockerhub/7.1/enterprise/ubuntu22.04/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='docker.io' +META_LINUX_BASE='ubuntu:22.04' +META_LINUX_PKG_TYPE='deb' +META_AEROSPIKE_VERSION='7.1.0.6' +META_AEROSPIKE_EDITION='enterprise' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-enterprise/7.1.0.6/aerospike-server-enterprise_7.1.0.6_tools-11.0.2_ubuntu22.04_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='a9c6cee762efe92151117166da89c82637bb82aad80bffeb2972827e7581e23a' +META_AEROSPIKE_AARCH64_LINK='https://artifacts.aerospike.com/aerospike-server-enterprise/7.1.0.6/aerospike-server-enterprise_7.1.0.6_tools-11.0.2_ubuntu22.04_aarch64.tgz' +META_AEROSPIKE_SHA_AARCH64='148b362f1bd829aabf9e76525c2d9f7fc7ba07e9f43d293b9907f09acb8e7e4d' diff --git a/images/dockerhub/7.1/federal/ubuntu22.04/Dockerfile b/images/dockerhub/7.1/federal/ubuntu22.04/Dockerfile new file mode 100644 index 00000000..24e4a08a --- /dev/null +++ b/images/dockerhub/7.1/federal/ubuntu22.04/Dockerfile @@ -0,0 +1,193 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM docker.io/ubuntu:22.04 + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-federal/7.1.0.6/aerospike-server-federal_7.1.0.6_tools-11.0.2_ubuntu22.04_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="6a3b090d1fa6855c58aa96bf1c506571c6fcddef9c8e91ffd1bb752777adb1e0" +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 \ + file \ + 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]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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. + apt-get install -y --no-install-recommends \ + # required for EE and pre 6.0 + libcurl4 \ + # required for EE + libldap-2.4.2; \ + 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}" "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 -x aerospike/aerospike-tools*.deb --output aerospike/pkg; \ + 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 {} + || true; \ + 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 \ + file \ + xz-utils 2>&1; \ + apt-get purge -y; \ + apt-get autoremove -y; \ + unset DEBIAN_FRONTEND; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Federal Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="7.1.0.6" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/dockerhub/7.1/federal/ubuntu22.04/LICENSE b/images/dockerhub/7.1/federal/ubuntu22.04/LICENSE new file mode 100644 index 00000000..a0884fd0 --- /dev/null +++ b/images/dockerhub/7.1/federal/ubuntu22.04/LICENSE @@ -0,0 +1,5 @@ +Copyright 2020-2022 Aerospike, Inc. + +If you are using the Aerospike Server Enterprise Edition for United States Federal evaluation feature key file, you are operating under the [Aerospike Evaluation License Agreement](https://aerospike.com/forms/evaluation-license-agreement/). + +If you are using a feature key file you received as part of your commercial federal license, you are operating under the [Aerospike Master License Agreement](https://aerospike.com/forms/master-license-agreement/). diff --git a/images/dockerhub/7.1/federal/ubuntu22.04/aerospike.template.conf b/images/dockerhub/7.1/federal/ubuntu22.04/aerospike.template.conf new file mode 100644 index 00000000..7942a049 --- /dev/null +++ b/images/dockerhub/7.1/federal/ubuntu22.04/aerospike.template.conf @@ -0,0 +1,68 @@ +# 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}") + cluster-name docker +} + +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. + nsup-period ${NSUP_PERIOD} + replication-factor 1 + storage-engine $([ "${DATA_IN_MEMORY}" = "true" ] && echo "memory" || echo "device") { + # For 'storage-engine memory' with 'device' or 'file' backing, we + # recommend having multiple devices (eight is recommended). One is used + # here for backward compatibility. + file /opt/aerospike/data/${NAMESPACE}.dat + filesize ${STORAGE_GB}G + $(([ -z "${DATA_IN_MEMORY}" ] || [ "${DATA_IN_MEMORY}" = "false" ]) && echo "read-page-cache ${READ_PAGE_CACHE}") + } +} diff --git a/images/dockerhub/7.1/federal/ubuntu22.04/entrypoint.sh b/images/dockerhub/7.1/federal/ubuntu22.04/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/dockerhub/7.1/federal/ubuntu22.04/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 -f "${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/images/dockerhub/7.1/federal/ubuntu22.04/meta b/images/dockerhub/7.1/federal/ubuntu22.04/meta new file mode 100644 index 00000000..d8edb38c --- /dev/null +++ b/images/dockerhub/7.1/federal/ubuntu22.04/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='docker.io' +META_LINUX_BASE='ubuntu:22.04' +META_LINUX_PKG_TYPE='deb' +META_AEROSPIKE_VERSION='7.1.0.6' +META_AEROSPIKE_EDITION='federal' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-federal/7.1.0.6/aerospike-server-federal_7.1.0.6_tools-11.0.2_ubuntu22.04_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='6a3b090d1fa6855c58aa96bf1c506571c6fcddef9c8e91ffd1bb752777adb1e0' +META_AEROSPIKE_AARCH64_LINK='' +META_AEROSPIKE_SHA_AARCH64='' diff --git a/images/redhat/6.1/community/ubi8/Dockerfile b/images/redhat/6.1/community/ubi8/Dockerfile new file mode 100644 index 00000000..b92f6d05 --- /dev/null +++ b/images/redhat/6.1/community/ubi8/Dockerfile @@ -0,0 +1,187 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM registry.access.redhat.com/ubi8-minimal + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-community/6.1.0.40/aerospike-server-community-6.1.0.40-el8.tgz" +ARG AEROSPIKE_SHA_X86_64="d462eb26602da410da5a7593f3bbcb353733d5d85887917edf01b20242d2388f" +ARG AEROSPIKE_AARCH64_LINK="" +ARG AEROSPIKE_SHA_AARCH64="" + +SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"] + +# Install Aerospike Server and Tools +RUN \ + { \ + # 00-prelude-rpm.part - Setup dependencies for scripts. + microdnf update -y; \ + microdnf install -y \ + binutils \ + file \ + findutils \ + gzip \ + shadow-utils \ + tar \ + xz; \ + }; \ + { \ + # 00-prelude-rpm.part - Install procps for tests. + microdnf install -y procps-ng; \ + }; \ + { \ + # 10-download.part - Vars used for tini and tools. + VERSION="$(grep -oE "/[0-9]+[.][0-9]+[.][0-9]+([.][0-9]+)+(-rc[0-9]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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-rpm.part - Install server and dependencies. + rpm -i aerospike/aerospike-server-*.rpm; \ + rm -rf /opt/aerospike/bin; \ + }; \ + { \ + # 20-install-dependencies-rpm.part - Install tools dependencies. + if ! [ "$(printf "%s\n%s" "${VERSION}" "6.2.0.3" | sort -V | head -1)" != "${VERSION}" ]; then \ + # Tools before 6.0 need python3. + microdnf install -y python3; \ + fi; \ + # Tools after 6.0 bundled their own python interpreter. + }; \ + { \ + # 20-install-dependencies-rpm.part - Extract tools. + pushd aerospike/pkg || exit 1; \ + rpm2archive -n ../aerospike-tools*.rpm; \ + tar xf ../aerospike-tools*.tar -C .; \ + rm -f ../aerospike-tools*.tar; \ + popd || exit 1; \ + }; \ + { \ + # 30-install-tools.part - install asinfo and asadm. + find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} + || true; \ + 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-rpm.part - Remove dependencies for scripts. + microdnf remove -y \ + # binutils - dependency issues on ubi9 + file \ + findutils \ + # gzip - dependency issues on ubi9 + shadow-utils \ + tar \ + xz 2>&1; \ + microdnf clean all; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Community Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubi8-minimal" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="6.1.0.40" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/redhat/6.1/community/ubi8/LICENSE b/images/redhat/6.1/community/ubi8/LICENSE new file mode 100644 index 00000000..ff5e8e96 --- /dev/null +++ b/images/redhat/6.1/community/ubi8/LICENSE @@ -0,0 +1,13 @@ +Copyright 2014-2022 Aerospike, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/images/redhat/6.1/community/ubi8/aerospike.template.conf b/images/redhat/6.1/community/ubi8/aerospike.template.conf new file mode 100644 index 00000000..6737692b --- /dev/null +++ b/images/redhat/6.1/community/ubi8/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/images/redhat/6.1/community/ubi8/entrypoint.sh b/images/redhat/6.1/community/ubi8/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/redhat/6.1/community/ubi8/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 -f "${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/images/redhat/6.1/community/ubi8/meta b/images/redhat/6.1/community/ubi8/meta new file mode 100644 index 00000000..30215c27 --- /dev/null +++ b/images/redhat/6.1/community/ubi8/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='registry.access.redhat.com' +META_LINUX_BASE='ubi8-minimal' +META_LINUX_PKG_TYPE='rpm' +META_AEROSPIKE_VERSION='6.1.0.40' +META_AEROSPIKE_EDITION='community' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-community/6.1.0.40/aerospike-server-community-6.1.0.40-el8.tgz' +META_AEROSPIKE_SHA_X86_64='d462eb26602da410da5a7593f3bbcb353733d5d85887917edf01b20242d2388f' +META_AEROSPIKE_AARCH64_LINK='' +META_AEROSPIKE_SHA_AARCH64='' diff --git a/images/redhat/6.1/enterprise/ubi8/Dockerfile b/images/redhat/6.1/enterprise/ubi8/Dockerfile new file mode 100644 index 00000000..3e28618e --- /dev/null +++ b/images/redhat/6.1/enterprise/ubi8/Dockerfile @@ -0,0 +1,187 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM registry.access.redhat.com/ubi8-minimal + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/6.1.0.40/aerospike-server-enterprise-6.1.0.40-el8.tgz" +ARG AEROSPIKE_SHA_X86_64="bb0f5dbca9217c1b471d9477b9772845701ec54bb8426d3179d9a08022a0abea" +ARG AEROSPIKE_AARCH64_LINK="" +ARG AEROSPIKE_SHA_AARCH64="" + +SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"] + +# Install Aerospike Server and Tools +RUN \ + { \ + # 00-prelude-rpm.part - Setup dependencies for scripts. + microdnf update -y; \ + microdnf install -y \ + binutils \ + file \ + findutils \ + gzip \ + shadow-utils \ + tar \ + xz; \ + }; \ + { \ + # 00-prelude-rpm.part - Install procps for tests. + microdnf install -y procps-ng; \ + }; \ + { \ + # 10-download.part - Vars used for tini and tools. + VERSION="$(grep -oE "/[0-9]+[.][0-9]+[.][0-9]+([.][0-9]+)+(-rc[0-9]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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-rpm.part - Install server and dependencies. + rpm -i aerospike/aerospike-server-*.rpm; \ + rm -rf /opt/aerospike/bin; \ + }; \ + { \ + # 20-install-dependencies-rpm.part - Install tools dependencies. + if ! [ "$(printf "%s\n%s" "${VERSION}" "6.2.0.3" | sort -V | head -1)" != "${VERSION}" ]; then \ + # Tools before 6.0 need python3. + microdnf install -y python3; \ + fi; \ + # Tools after 6.0 bundled their own python interpreter. + }; \ + { \ + # 20-install-dependencies-rpm.part - Extract tools. + pushd aerospike/pkg || exit 1; \ + rpm2archive -n ../aerospike-tools*.rpm; \ + tar xf ../aerospike-tools*.tar -C .; \ + rm -f ../aerospike-tools*.tar; \ + popd || exit 1; \ + }; \ + { \ + # 30-install-tools.part - install asinfo and asadm. + find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} + || true; \ + 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-rpm.part - Remove dependencies for scripts. + microdnf remove -y \ + # binutils - dependency issues on ubi9 + file \ + findutils \ + # gzip - dependency issues on ubi9 + shadow-utils \ + tar \ + xz 2>&1; \ + microdnf clean all; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Enterprise Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubi8-minimal" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="6.1.0.40" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/redhat/6.1/enterprise/ubi8/LICENSE b/images/redhat/6.1/enterprise/ubi8/LICENSE new file mode 100644 index 00000000..0f6833df --- /dev/null +++ b/images/redhat/6.1/enterprise/ubi8/LICENSE @@ -0,0 +1,5 @@ +Copyright 2020-2022 Aerospike, Inc. + +If you are using the Aerospike Database EE evaluation feature key file, you are operating under the [Aerospike Evaluation License Agreement](https://www.aerospike.com/forms/evaluation-license-agreement/). + +If you are using a feature key file you received as part of your commercial enterprise license, you are operating under the [Aerospike Master License Agreement](https://www.aerospike.com/forms/master-license-agreement/). diff --git a/images/redhat/6.1/enterprise/ubi8/aerospike.template.conf b/images/redhat/6.1/enterprise/ubi8/aerospike.template.conf new file mode 100644 index 00000000..6737692b --- /dev/null +++ b/images/redhat/6.1/enterprise/ubi8/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/images/redhat/6.1/enterprise/ubi8/entrypoint.sh b/images/redhat/6.1/enterprise/ubi8/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/redhat/6.1/enterprise/ubi8/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 -f "${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/images/redhat/6.1/enterprise/ubi8/meta b/images/redhat/6.1/enterprise/ubi8/meta new file mode 100644 index 00000000..c18b42f3 --- /dev/null +++ b/images/redhat/6.1/enterprise/ubi8/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='registry.access.redhat.com' +META_LINUX_BASE='ubi8-minimal' +META_LINUX_PKG_TYPE='rpm' +META_AEROSPIKE_VERSION='6.1.0.40' +META_AEROSPIKE_EDITION='enterprise' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-enterprise/6.1.0.40/aerospike-server-enterprise-6.1.0.40-el8.tgz' +META_AEROSPIKE_SHA_X86_64='bb0f5dbca9217c1b471d9477b9772845701ec54bb8426d3179d9a08022a0abea' +META_AEROSPIKE_AARCH64_LINK='' +META_AEROSPIKE_SHA_AARCH64='' diff --git a/images/redhat/6.3/community/ubi9/Dockerfile b/images/redhat/6.3/community/ubi9/Dockerfile new file mode 100644 index 00000000..a3b8b9fd --- /dev/null +++ b/images/redhat/6.3/community/ubi9/Dockerfile @@ -0,0 +1,187 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM registry.access.redhat.com/ubi9-minimal + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-community/6.3.0.28/aerospike-server-community_6.3.0.28_tools-8.5.1_el9_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="93fa36455a4b81a38fb6f5d328943eeca7641effddf57c897073821b2d293d09" +ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-community/6.3.0.28/aerospike-server-community_6.3.0.28_tools-8.5.1_el9_aarch64.tgz" +ARG AEROSPIKE_SHA_AARCH64="3db0842755d7ba366c69e4e30f8d8030294105bb8a9c7e0edf5fd8d0ebbfc083" + +SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"] + +# Install Aerospike Server and Tools +RUN \ + { \ + # 00-prelude-rpm.part - Setup dependencies for scripts. + microdnf update -y; \ + microdnf install -y \ + binutils \ + file \ + findutils \ + gzip \ + shadow-utils \ + tar \ + xz; \ + }; \ + { \ + # 00-prelude-rpm.part - Install procps for tests. + microdnf install -y procps-ng; \ + }; \ + { \ + # 10-download.part - Vars used for tini and tools. + VERSION="$(grep -oE "/[0-9]+[.][0-9]+[.][0-9]+([.][0-9]+)+(-rc[0-9]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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-rpm.part - Install server and dependencies. + rpm -i aerospike/aerospike-server-*.rpm; \ + rm -rf /opt/aerospike/bin; \ + }; \ + { \ + # 20-install-dependencies-rpm.part - Install tools dependencies. + if ! [ "$(printf "%s\n%s" "${VERSION}" "6.2.0.3" | sort -V | head -1)" != "${VERSION}" ]; then \ + # Tools before 6.0 need python3. + microdnf install -y python3; \ + fi; \ + # Tools after 6.0 bundled their own python interpreter. + }; \ + { \ + # 20-install-dependencies-rpm.part - Extract tools. + pushd aerospike/pkg || exit 1; \ + rpm2archive -n ../aerospike-tools*.rpm; \ + tar xf ../aerospike-tools*.tar -C .; \ + rm -f ../aerospike-tools*.tar; \ + popd || exit 1; \ + }; \ + { \ + # 30-install-tools.part - install asinfo and asadm. + find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} + || true; \ + 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-rpm.part - Remove dependencies for scripts. + microdnf remove -y \ + # binutils - dependency issues on ubi9 + file \ + findutils \ + # gzip - dependency issues on ubi9 + shadow-utils \ + tar \ + xz 2>&1; \ + microdnf clean all; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Community Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubi9-minimal" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="6.3.0.28" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/redhat/6.3/community/ubi9/LICENSE b/images/redhat/6.3/community/ubi9/LICENSE new file mode 100644 index 00000000..ff5e8e96 --- /dev/null +++ b/images/redhat/6.3/community/ubi9/LICENSE @@ -0,0 +1,13 @@ +Copyright 2014-2022 Aerospike, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/images/redhat/6.3/community/ubi9/aerospike.template.conf b/images/redhat/6.3/community/ubi9/aerospike.template.conf new file mode 100644 index 00000000..6737692b --- /dev/null +++ b/images/redhat/6.3/community/ubi9/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/images/redhat/6.3/community/ubi9/entrypoint.sh b/images/redhat/6.3/community/ubi9/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/redhat/6.3/community/ubi9/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 -f "${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/images/redhat/6.3/community/ubi9/meta b/images/redhat/6.3/community/ubi9/meta new file mode 100644 index 00000000..9f199b18 --- /dev/null +++ b/images/redhat/6.3/community/ubi9/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='registry.access.redhat.com' +META_LINUX_BASE='ubi9-minimal' +META_LINUX_PKG_TYPE='rpm' +META_AEROSPIKE_VERSION='6.3.0.28' +META_AEROSPIKE_EDITION='community' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-community/6.3.0.28/aerospike-server-community_6.3.0.28_tools-8.5.1_el9_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='93fa36455a4b81a38fb6f5d328943eeca7641effddf57c897073821b2d293d09' +META_AEROSPIKE_AARCH64_LINK='https://artifacts.aerospike.com/aerospike-server-community/6.3.0.28/aerospike-server-community_6.3.0.28_tools-8.5.1_el9_aarch64.tgz' +META_AEROSPIKE_SHA_AARCH64='3db0842755d7ba366c69e4e30f8d8030294105bb8a9c7e0edf5fd8d0ebbfc083' diff --git a/images/redhat/6.3/enterprise/ubi9/Dockerfile b/images/redhat/6.3/enterprise/ubi9/Dockerfile new file mode 100644 index 00000000..fb26ac4e --- /dev/null +++ b/images/redhat/6.3/enterprise/ubi9/Dockerfile @@ -0,0 +1,187 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM registry.access.redhat.com/ubi9-minimal + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/6.3.0.28/aerospike-server-enterprise_6.3.0.28_tools-8.5.1_el9_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="637a9dc19e25af1e74495ec3c4882806d0434815b02bded7b628894ea625ceb4" +ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/6.3.0.28/aerospike-server-enterprise_6.3.0.28_tools-8.5.1_el9_aarch64.tgz" +ARG AEROSPIKE_SHA_AARCH64="2c1e9d6c2eeed7dbddfe04646f589cfba8dae211c68468d5f1c95868dc49f0a6" + +SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"] + +# Install Aerospike Server and Tools +RUN \ + { \ + # 00-prelude-rpm.part - Setup dependencies for scripts. + microdnf update -y; \ + microdnf install -y \ + binutils \ + file \ + findutils \ + gzip \ + shadow-utils \ + tar \ + xz; \ + }; \ + { \ + # 00-prelude-rpm.part - Install procps for tests. + microdnf install -y procps-ng; \ + }; \ + { \ + # 10-download.part - Vars used for tini and tools. + VERSION="$(grep -oE "/[0-9]+[.][0-9]+[.][0-9]+([.][0-9]+)+(-rc[0-9]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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-rpm.part - Install server and dependencies. + rpm -i aerospike/aerospike-server-*.rpm; \ + rm -rf /opt/aerospike/bin; \ + }; \ + { \ + # 20-install-dependencies-rpm.part - Install tools dependencies. + if ! [ "$(printf "%s\n%s" "${VERSION}" "6.2.0.3" | sort -V | head -1)" != "${VERSION}" ]; then \ + # Tools before 6.0 need python3. + microdnf install -y python3; \ + fi; \ + # Tools after 6.0 bundled their own python interpreter. + }; \ + { \ + # 20-install-dependencies-rpm.part - Extract tools. + pushd aerospike/pkg || exit 1; \ + rpm2archive -n ../aerospike-tools*.rpm; \ + tar xf ../aerospike-tools*.tar -C .; \ + rm -f ../aerospike-tools*.tar; \ + popd || exit 1; \ + }; \ + { \ + # 30-install-tools.part - install asinfo and asadm. + find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} + || true; \ + 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-rpm.part - Remove dependencies for scripts. + microdnf remove -y \ + # binutils - dependency issues on ubi9 + file \ + findutils \ + # gzip - dependency issues on ubi9 + shadow-utils \ + tar \ + xz 2>&1; \ + microdnf clean all; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Enterprise Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubi9-minimal" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="6.3.0.28" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/redhat/6.3/enterprise/ubi9/LICENSE b/images/redhat/6.3/enterprise/ubi9/LICENSE new file mode 100644 index 00000000..0f6833df --- /dev/null +++ b/images/redhat/6.3/enterprise/ubi9/LICENSE @@ -0,0 +1,5 @@ +Copyright 2020-2022 Aerospike, Inc. + +If you are using the Aerospike Database EE evaluation feature key file, you are operating under the [Aerospike Evaluation License Agreement](https://www.aerospike.com/forms/evaluation-license-agreement/). + +If you are using a feature key file you received as part of your commercial enterprise license, you are operating under the [Aerospike Master License Agreement](https://www.aerospike.com/forms/master-license-agreement/). diff --git a/images/redhat/6.3/enterprise/ubi9/aerospike.template.conf b/images/redhat/6.3/enterprise/ubi9/aerospike.template.conf new file mode 100644 index 00000000..6737692b --- /dev/null +++ b/images/redhat/6.3/enterprise/ubi9/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/images/redhat/6.3/enterprise/ubi9/entrypoint.sh b/images/redhat/6.3/enterprise/ubi9/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/redhat/6.3/enterprise/ubi9/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 -f "${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/images/redhat/6.3/enterprise/ubi9/meta b/images/redhat/6.3/enterprise/ubi9/meta new file mode 100644 index 00000000..92bb34d6 --- /dev/null +++ b/images/redhat/6.3/enterprise/ubi9/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='registry.access.redhat.com' +META_LINUX_BASE='ubi9-minimal' +META_LINUX_PKG_TYPE='rpm' +META_AEROSPIKE_VERSION='6.3.0.28' +META_AEROSPIKE_EDITION='enterprise' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-enterprise/6.3.0.28/aerospike-server-enterprise_6.3.0.28_tools-8.5.1_el9_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='637a9dc19e25af1e74495ec3c4882806d0434815b02bded7b628894ea625ceb4' +META_AEROSPIKE_AARCH64_LINK='https://artifacts.aerospike.com/aerospike-server-enterprise/6.3.0.28/aerospike-server-enterprise_6.3.0.28_tools-8.5.1_el9_aarch64.tgz' +META_AEROSPIKE_SHA_AARCH64='2c1e9d6c2eeed7dbddfe04646f589cfba8dae211c68468d5f1c95868dc49f0a6' diff --git a/images/redhat/6.4/community/ubi9/Dockerfile b/images/redhat/6.4/community/ubi9/Dockerfile new file mode 100644 index 00000000..f04828c7 --- /dev/null +++ b/images/redhat/6.4/community/ubi9/Dockerfile @@ -0,0 +1,187 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM registry.access.redhat.com/ubi9-minimal + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-community/6.4.0.23/aerospike-server-community_6.4.0.23_tools-10.0.0_el9_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="d842f369de65ab7f163fc5d156b2fcfe5f17165ce635269f90331151f9cfb9c7" +ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-community/6.4.0.23/aerospike-server-community_6.4.0.23_tools-10.0.0_el9_aarch64.tgz" +ARG AEROSPIKE_SHA_AARCH64="cc4ad85de6bb27aa3b19c98682dfded0ee0339efdebf6d5f14f284cd77eb0ff7" + +SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"] + +# Install Aerospike Server and Tools +RUN \ + { \ + # 00-prelude-rpm.part - Setup dependencies for scripts. + microdnf update -y; \ + microdnf install -y \ + binutils \ + file \ + findutils \ + gzip \ + shadow-utils \ + tar \ + xz; \ + }; \ + { \ + # 00-prelude-rpm.part - Install procps for tests. + microdnf install -y procps-ng; \ + }; \ + { \ + # 10-download.part - Vars used for tini and tools. + VERSION="$(grep -oE "/[0-9]+[.][0-9]+[.][0-9]+([.][0-9]+)+(-rc[0-9]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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-rpm.part - Install server and dependencies. + rpm -i aerospike/aerospike-server-*.rpm; \ + rm -rf /opt/aerospike/bin; \ + }; \ + { \ + # 20-install-dependencies-rpm.part - Install tools dependencies. + if ! [ "$(printf "%s\n%s" "${VERSION}" "6.2.0.3" | sort -V | head -1)" != "${VERSION}" ]; then \ + # Tools before 6.0 need python3. + microdnf install -y python3; \ + fi; \ + # Tools after 6.0 bundled their own python interpreter. + }; \ + { \ + # 20-install-dependencies-rpm.part - Extract tools. + pushd aerospike/pkg || exit 1; \ + rpm2archive -n ../aerospike-tools*.rpm; \ + tar xf ../aerospike-tools*.tar -C .; \ + rm -f ../aerospike-tools*.tar; \ + popd || exit 1; \ + }; \ + { \ + # 30-install-tools.part - install asinfo and asadm. + find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} + || true; \ + 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-rpm.part - Remove dependencies for scripts. + microdnf remove -y \ + # binutils - dependency issues on ubi9 + file \ + findutils \ + # gzip - dependency issues on ubi9 + shadow-utils \ + tar \ + xz 2>&1; \ + microdnf clean all; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Community Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubi9-minimal" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="6.4.0.23" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/redhat/6.4/community/ubi9/LICENSE b/images/redhat/6.4/community/ubi9/LICENSE new file mode 100644 index 00000000..ff5e8e96 --- /dev/null +++ b/images/redhat/6.4/community/ubi9/LICENSE @@ -0,0 +1,13 @@ +Copyright 2014-2022 Aerospike, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/images/redhat/6.4/community/ubi9/aerospike.template.conf b/images/redhat/6.4/community/ubi9/aerospike.template.conf new file mode 100644 index 00000000..6737692b --- /dev/null +++ b/images/redhat/6.4/community/ubi9/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/images/redhat/6.4/community/ubi9/entrypoint.sh b/images/redhat/6.4/community/ubi9/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/redhat/6.4/community/ubi9/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 -f "${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/images/redhat/6.4/community/ubi9/meta b/images/redhat/6.4/community/ubi9/meta new file mode 100644 index 00000000..ccc60c60 --- /dev/null +++ b/images/redhat/6.4/community/ubi9/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='registry.access.redhat.com' +META_LINUX_BASE='ubi9-minimal' +META_LINUX_PKG_TYPE='rpm' +META_AEROSPIKE_VERSION='6.4.0.23' +META_AEROSPIKE_EDITION='community' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-community/6.4.0.23/aerospike-server-community_6.4.0.23_tools-10.0.0_el9_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='d842f369de65ab7f163fc5d156b2fcfe5f17165ce635269f90331151f9cfb9c7' +META_AEROSPIKE_AARCH64_LINK='https://artifacts.aerospike.com/aerospike-server-community/6.4.0.23/aerospike-server-community_6.4.0.23_tools-10.0.0_el9_aarch64.tgz' +META_AEROSPIKE_SHA_AARCH64='cc4ad85de6bb27aa3b19c98682dfded0ee0339efdebf6d5f14f284cd77eb0ff7' diff --git a/images/redhat/6.4/enterprise/ubi9/Dockerfile b/images/redhat/6.4/enterprise/ubi9/Dockerfile new file mode 100644 index 00000000..4b770bc5 --- /dev/null +++ b/images/redhat/6.4/enterprise/ubi9/Dockerfile @@ -0,0 +1,187 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM registry.access.redhat.com/ubi9-minimal + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/6.4.0.23/aerospike-server-enterprise_6.4.0.23_tools-10.0.0_el9_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="b6d6b2bfae6826901c78d7118bb7e1b94f4662c088aa23cc82c488d43d9e29de" +ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/6.4.0.23/aerospike-server-enterprise_6.4.0.23_tools-10.0.0_el9_aarch64.tgz" +ARG AEROSPIKE_SHA_AARCH64="4c74e3b4f2e485856de230d5f37caea133d670d4167e2d6c7c79cb8d42076e68" + +SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"] + +# Install Aerospike Server and Tools +RUN \ + { \ + # 00-prelude-rpm.part - Setup dependencies for scripts. + microdnf update -y; \ + microdnf install -y \ + binutils \ + file \ + findutils \ + gzip \ + shadow-utils \ + tar \ + xz; \ + }; \ + { \ + # 00-prelude-rpm.part - Install procps for tests. + microdnf install -y procps-ng; \ + }; \ + { \ + # 10-download.part - Vars used for tini and tools. + VERSION="$(grep -oE "/[0-9]+[.][0-9]+[.][0-9]+([.][0-9]+)+(-rc[0-9]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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-rpm.part - Install server and dependencies. + rpm -i aerospike/aerospike-server-*.rpm; \ + rm -rf /opt/aerospike/bin; \ + }; \ + { \ + # 20-install-dependencies-rpm.part - Install tools dependencies. + if ! [ "$(printf "%s\n%s" "${VERSION}" "6.2.0.3" | sort -V | head -1)" != "${VERSION}" ]; then \ + # Tools before 6.0 need python3. + microdnf install -y python3; \ + fi; \ + # Tools after 6.0 bundled their own python interpreter. + }; \ + { \ + # 20-install-dependencies-rpm.part - Extract tools. + pushd aerospike/pkg || exit 1; \ + rpm2archive -n ../aerospike-tools*.rpm; \ + tar xf ../aerospike-tools*.tar -C .; \ + rm -f ../aerospike-tools*.tar; \ + popd || exit 1; \ + }; \ + { \ + # 30-install-tools.part - install asinfo and asadm. + find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} + || true; \ + 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-rpm.part - Remove dependencies for scripts. + microdnf remove -y \ + # binutils - dependency issues on ubi9 + file \ + findutils \ + # gzip - dependency issues on ubi9 + shadow-utils \ + tar \ + xz 2>&1; \ + microdnf clean all; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Enterprise Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubi9-minimal" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="6.4.0.23" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/redhat/6.4/enterprise/ubi9/LICENSE b/images/redhat/6.4/enterprise/ubi9/LICENSE new file mode 100644 index 00000000..0f6833df --- /dev/null +++ b/images/redhat/6.4/enterprise/ubi9/LICENSE @@ -0,0 +1,5 @@ +Copyright 2020-2022 Aerospike, Inc. + +If you are using the Aerospike Database EE evaluation feature key file, you are operating under the [Aerospike Evaluation License Agreement](https://www.aerospike.com/forms/evaluation-license-agreement/). + +If you are using a feature key file you received as part of your commercial enterprise license, you are operating under the [Aerospike Master License Agreement](https://www.aerospike.com/forms/master-license-agreement/). diff --git a/images/redhat/6.4/enterprise/ubi9/aerospike.template.conf b/images/redhat/6.4/enterprise/ubi9/aerospike.template.conf new file mode 100644 index 00000000..6737692b --- /dev/null +++ b/images/redhat/6.4/enterprise/ubi9/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/images/redhat/6.4/enterprise/ubi9/entrypoint.sh b/images/redhat/6.4/enterprise/ubi9/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/redhat/6.4/enterprise/ubi9/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 -f "${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/images/redhat/6.4/enterprise/ubi9/meta b/images/redhat/6.4/enterprise/ubi9/meta new file mode 100644 index 00000000..bfe4fa71 --- /dev/null +++ b/images/redhat/6.4/enterprise/ubi9/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='registry.access.redhat.com' +META_LINUX_BASE='ubi9-minimal' +META_LINUX_PKG_TYPE='rpm' +META_AEROSPIKE_VERSION='6.4.0.23' +META_AEROSPIKE_EDITION='enterprise' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-enterprise/6.4.0.23/aerospike-server-enterprise_6.4.0.23_tools-10.0.0_el9_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='b6d6b2bfae6826901c78d7118bb7e1b94f4662c088aa23cc82c488d43d9e29de' +META_AEROSPIKE_AARCH64_LINK='https://artifacts.aerospike.com/aerospike-server-enterprise/6.4.0.23/aerospike-server-enterprise_6.4.0.23_tools-10.0.0_el9_aarch64.tgz' +META_AEROSPIKE_SHA_AARCH64='4c74e3b4f2e485856de230d5f37caea133d670d4167e2d6c7c79cb8d42076e68' diff --git a/images/redhat/7.0/community/ubi9/Dockerfile b/images/redhat/7.0/community/ubi9/Dockerfile new file mode 100644 index 00000000..0f216427 --- /dev/null +++ b/images/redhat/7.0/community/ubi9/Dockerfile @@ -0,0 +1,187 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM registry.access.redhat.com/ubi9-minimal + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-community/7.0.0.15/aerospike-server-community_7.0.0.15_tools-10.2.1_el9_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="2801ba15562ccfc5c8f953f53445f001b5a0ed3cf4d57f8307d2b7910aed4ec1" +ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-community/7.0.0.15/aerospike-server-community_7.0.0.15_tools-10.2.1_el9_aarch64.tgz" +ARG AEROSPIKE_SHA_AARCH64="8ce34845af8524e93c524b702b73668a77d611b8890be41bd4abf47673730d37" + +SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"] + +# Install Aerospike Server and Tools +RUN \ + { \ + # 00-prelude-rpm.part - Setup dependencies for scripts. + microdnf update -y; \ + microdnf install -y \ + binutils \ + file \ + findutils \ + gzip \ + shadow-utils \ + tar \ + xz; \ + }; \ + { \ + # 00-prelude-rpm.part - Install procps for tests. + microdnf install -y procps-ng; \ + }; \ + { \ + # 10-download.part - Vars used for tini and tools. + VERSION="$(grep -oE "/[0-9]+[.][0-9]+[.][0-9]+([.][0-9]+)+(-rc[0-9]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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-rpm.part - Install server and dependencies. + rpm -i aerospike/aerospike-server-*.rpm; \ + rm -rf /opt/aerospike/bin; \ + }; \ + { \ + # 20-install-dependencies-rpm.part - Install tools dependencies. + if ! [ "$(printf "%s\n%s" "${VERSION}" "6.2.0.3" | sort -V | head -1)" != "${VERSION}" ]; then \ + # Tools before 6.0 need python3. + microdnf install -y python3; \ + fi; \ + # Tools after 6.0 bundled their own python interpreter. + }; \ + { \ + # 20-install-dependencies-rpm.part - Extract tools. + pushd aerospike/pkg || exit 1; \ + rpm2archive -n ../aerospike-tools*.rpm; \ + tar xf ../aerospike-tools*.tar -C .; \ + rm -f ../aerospike-tools*.tar; \ + popd || exit 1; \ + }; \ + { \ + # 30-install-tools.part - install asinfo and asadm. + find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} + || true; \ + 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-rpm.part - Remove dependencies for scripts. + microdnf remove -y \ + # binutils - dependency issues on ubi9 + file \ + findutils \ + # gzip - dependency issues on ubi9 + shadow-utils \ + tar \ + xz 2>&1; \ + microdnf clean all; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Community Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubi9-minimal" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="7.0.0.15" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/redhat/7.0/community/ubi9/LICENSE b/images/redhat/7.0/community/ubi9/LICENSE new file mode 100644 index 00000000..ff5e8e96 --- /dev/null +++ b/images/redhat/7.0/community/ubi9/LICENSE @@ -0,0 +1,13 @@ +Copyright 2014-2022 Aerospike, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/images/redhat/7.0/community/ubi9/aerospike.template.conf b/images/redhat/7.0/community/ubi9/aerospike.template.conf new file mode 100644 index 00000000..7942a049 --- /dev/null +++ b/images/redhat/7.0/community/ubi9/aerospike.template.conf @@ -0,0 +1,68 @@ +# 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}") + cluster-name docker +} + +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. + nsup-period ${NSUP_PERIOD} + replication-factor 1 + storage-engine $([ "${DATA_IN_MEMORY}" = "true" ] && echo "memory" || echo "device") { + # For 'storage-engine memory' with 'device' or 'file' backing, we + # recommend having multiple devices (eight is recommended). One is used + # here for backward compatibility. + file /opt/aerospike/data/${NAMESPACE}.dat + filesize ${STORAGE_GB}G + $(([ -z "${DATA_IN_MEMORY}" ] || [ "${DATA_IN_MEMORY}" = "false" ]) && echo "read-page-cache ${READ_PAGE_CACHE}") + } +} diff --git a/images/redhat/7.0/community/ubi9/entrypoint.sh b/images/redhat/7.0/community/ubi9/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/redhat/7.0/community/ubi9/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 -f "${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/images/redhat/7.0/community/ubi9/meta b/images/redhat/7.0/community/ubi9/meta new file mode 100644 index 00000000..11dd6a59 --- /dev/null +++ b/images/redhat/7.0/community/ubi9/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='registry.access.redhat.com' +META_LINUX_BASE='ubi9-minimal' +META_LINUX_PKG_TYPE='rpm' +META_AEROSPIKE_VERSION='7.0.0.15' +META_AEROSPIKE_EDITION='community' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-community/7.0.0.15/aerospike-server-community_7.0.0.15_tools-10.2.1_el9_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='2801ba15562ccfc5c8f953f53445f001b5a0ed3cf4d57f8307d2b7910aed4ec1' +META_AEROSPIKE_AARCH64_LINK='https://artifacts.aerospike.com/aerospike-server-community/7.0.0.15/aerospike-server-community_7.0.0.15_tools-10.2.1_el9_aarch64.tgz' +META_AEROSPIKE_SHA_AARCH64='8ce34845af8524e93c524b702b73668a77d611b8890be41bd4abf47673730d37' diff --git a/images/redhat/7.0/enterprise/ubi9/Dockerfile b/images/redhat/7.0/enterprise/ubi9/Dockerfile new file mode 100644 index 00000000..c87cfb57 --- /dev/null +++ b/images/redhat/7.0/enterprise/ubi9/Dockerfile @@ -0,0 +1,187 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM registry.access.redhat.com/ubi9-minimal + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/7.0.0.15/aerospike-server-enterprise_7.0.0.15_tools-10.2.1_el9_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="9758f4b3d57ff891ba3174f536a74deae7985291e4cbc995573e1aeaddb4af05" +ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/7.0.0.15/aerospike-server-enterprise_7.0.0.15_tools-10.2.1_el9_aarch64.tgz" +ARG AEROSPIKE_SHA_AARCH64="4f2a6d1c904f8c1c7c1a5304ffc06e16915051dc312c8ac4c04289d21c5087de" + +SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"] + +# Install Aerospike Server and Tools +RUN \ + { \ + # 00-prelude-rpm.part - Setup dependencies for scripts. + microdnf update -y; \ + microdnf install -y \ + binutils \ + file \ + findutils \ + gzip \ + shadow-utils \ + tar \ + xz; \ + }; \ + { \ + # 00-prelude-rpm.part - Install procps for tests. + microdnf install -y procps-ng; \ + }; \ + { \ + # 10-download.part - Vars used for tini and tools. + VERSION="$(grep -oE "/[0-9]+[.][0-9]+[.][0-9]+([.][0-9]+)+(-rc[0-9]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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-rpm.part - Install server and dependencies. + rpm -i aerospike/aerospike-server-*.rpm; \ + rm -rf /opt/aerospike/bin; \ + }; \ + { \ + # 20-install-dependencies-rpm.part - Install tools dependencies. + if ! [ "$(printf "%s\n%s" "${VERSION}" "6.2.0.3" | sort -V | head -1)" != "${VERSION}" ]; then \ + # Tools before 6.0 need python3. + microdnf install -y python3; \ + fi; \ + # Tools after 6.0 bundled their own python interpreter. + }; \ + { \ + # 20-install-dependencies-rpm.part - Extract tools. + pushd aerospike/pkg || exit 1; \ + rpm2archive -n ../aerospike-tools*.rpm; \ + tar xf ../aerospike-tools*.tar -C .; \ + rm -f ../aerospike-tools*.tar; \ + popd || exit 1; \ + }; \ + { \ + # 30-install-tools.part - install asinfo and asadm. + find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} + || true; \ + 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-rpm.part - Remove dependencies for scripts. + microdnf remove -y \ + # binutils - dependency issues on ubi9 + file \ + findutils \ + # gzip - dependency issues on ubi9 + shadow-utils \ + tar \ + xz 2>&1; \ + microdnf clean all; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Enterprise Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubi9-minimal" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="7.0.0.15" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/redhat/7.0/enterprise/ubi9/LICENSE b/images/redhat/7.0/enterprise/ubi9/LICENSE new file mode 100644 index 00000000..0f6833df --- /dev/null +++ b/images/redhat/7.0/enterprise/ubi9/LICENSE @@ -0,0 +1,5 @@ +Copyright 2020-2022 Aerospike, Inc. + +If you are using the Aerospike Database EE evaluation feature key file, you are operating under the [Aerospike Evaluation License Agreement](https://www.aerospike.com/forms/evaluation-license-agreement/). + +If you are using a feature key file you received as part of your commercial enterprise license, you are operating under the [Aerospike Master License Agreement](https://www.aerospike.com/forms/master-license-agreement/). diff --git a/images/redhat/7.0/enterprise/ubi9/aerospike.template.conf b/images/redhat/7.0/enterprise/ubi9/aerospike.template.conf new file mode 100644 index 00000000..7942a049 --- /dev/null +++ b/images/redhat/7.0/enterprise/ubi9/aerospike.template.conf @@ -0,0 +1,68 @@ +# 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}") + cluster-name docker +} + +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. + nsup-period ${NSUP_PERIOD} + replication-factor 1 + storage-engine $([ "${DATA_IN_MEMORY}" = "true" ] && echo "memory" || echo "device") { + # For 'storage-engine memory' with 'device' or 'file' backing, we + # recommend having multiple devices (eight is recommended). One is used + # here for backward compatibility. + file /opt/aerospike/data/${NAMESPACE}.dat + filesize ${STORAGE_GB}G + $(([ -z "${DATA_IN_MEMORY}" ] || [ "${DATA_IN_MEMORY}" = "false" ]) && echo "read-page-cache ${READ_PAGE_CACHE}") + } +} diff --git a/images/redhat/7.0/enterprise/ubi9/entrypoint.sh b/images/redhat/7.0/enterprise/ubi9/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/redhat/7.0/enterprise/ubi9/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 -f "${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/images/redhat/7.0/enterprise/ubi9/meta b/images/redhat/7.0/enterprise/ubi9/meta new file mode 100644 index 00000000..80761a55 --- /dev/null +++ b/images/redhat/7.0/enterprise/ubi9/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='registry.access.redhat.com' +META_LINUX_BASE='ubi9-minimal' +META_LINUX_PKG_TYPE='rpm' +META_AEROSPIKE_VERSION='7.0.0.15' +META_AEROSPIKE_EDITION='enterprise' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-enterprise/7.0.0.15/aerospike-server-enterprise_7.0.0.15_tools-10.2.1_el9_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='9758f4b3d57ff891ba3174f536a74deae7985291e4cbc995573e1aeaddb4af05' +META_AEROSPIKE_AARCH64_LINK='https://artifacts.aerospike.com/aerospike-server-enterprise/7.0.0.15/aerospike-server-enterprise_7.0.0.15_tools-10.2.1_el9_aarch64.tgz' +META_AEROSPIKE_SHA_AARCH64='4f2a6d1c904f8c1c7c1a5304ffc06e16915051dc312c8ac4c04289d21c5087de' diff --git a/images/redhat/7.1/community/ubi9/Dockerfile b/images/redhat/7.1/community/ubi9/Dockerfile new file mode 100644 index 00000000..f4350a3e --- /dev/null +++ b/images/redhat/7.1/community/ubi9/Dockerfile @@ -0,0 +1,187 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM registry.access.redhat.com/ubi9-minimal + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-community/7.1.0.6/aerospike-server-community_7.1.0.6_tools-11.0.2_el9_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="2e2a013661298226f01dc446de9cd307cc6d5f51158e19813356dcdfc3f2520f" +ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-community/7.1.0.6/aerospike-server-community_7.1.0.6_tools-11.0.2_el9_aarch64.tgz" +ARG AEROSPIKE_SHA_AARCH64="7bae2e65fcb918f6b534e5049a91e19dba7afb9c10a80e93f540a92fc60354bc" + +SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"] + +# Install Aerospike Server and Tools +RUN \ + { \ + # 00-prelude-rpm.part - Setup dependencies for scripts. + microdnf update -y; \ + microdnf install -y \ + binutils \ + file \ + findutils \ + gzip \ + shadow-utils \ + tar \ + xz; \ + }; \ + { \ + # 00-prelude-rpm.part - Install procps for tests. + microdnf install -y procps-ng; \ + }; \ + { \ + # 10-download.part - Vars used for tini and tools. + VERSION="$(grep -oE "/[0-9]+[.][0-9]+[.][0-9]+([.][0-9]+)+(-rc[0-9]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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-rpm.part - Install server and dependencies. + rpm -i aerospike/aerospike-server-*.rpm; \ + rm -rf /opt/aerospike/bin; \ + }; \ + { \ + # 20-install-dependencies-rpm.part - Install tools dependencies. + if ! [ "$(printf "%s\n%s" "${VERSION}" "6.2.0.3" | sort -V | head -1)" != "${VERSION}" ]; then \ + # Tools before 6.0 need python3. + microdnf install -y python3; \ + fi; \ + # Tools after 6.0 bundled their own python interpreter. + }; \ + { \ + # 20-install-dependencies-rpm.part - Extract tools. + pushd aerospike/pkg || exit 1; \ + rpm2archive -n ../aerospike-tools*.rpm; \ + tar xf ../aerospike-tools*.tar -C .; \ + rm -f ../aerospike-tools*.tar; \ + popd || exit 1; \ + }; \ + { \ + # 30-install-tools.part - install asinfo and asadm. + find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} + || true; \ + 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-rpm.part - Remove dependencies for scripts. + microdnf remove -y \ + # binutils - dependency issues on ubi9 + file \ + findutils \ + # gzip - dependency issues on ubi9 + shadow-utils \ + tar \ + xz 2>&1; \ + microdnf clean all; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Community Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubi9-minimal" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="7.1.0.6" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/redhat/7.1/community/ubi9/LICENSE b/images/redhat/7.1/community/ubi9/LICENSE new file mode 100644 index 00000000..ff5e8e96 --- /dev/null +++ b/images/redhat/7.1/community/ubi9/LICENSE @@ -0,0 +1,13 @@ +Copyright 2014-2022 Aerospike, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/images/redhat/7.1/community/ubi9/aerospike.template.conf b/images/redhat/7.1/community/ubi9/aerospike.template.conf new file mode 100644 index 00000000..7942a049 --- /dev/null +++ b/images/redhat/7.1/community/ubi9/aerospike.template.conf @@ -0,0 +1,68 @@ +# 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}") + cluster-name docker +} + +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. + nsup-period ${NSUP_PERIOD} + replication-factor 1 + storage-engine $([ "${DATA_IN_MEMORY}" = "true" ] && echo "memory" || echo "device") { + # For 'storage-engine memory' with 'device' or 'file' backing, we + # recommend having multiple devices (eight is recommended). One is used + # here for backward compatibility. + file /opt/aerospike/data/${NAMESPACE}.dat + filesize ${STORAGE_GB}G + $(([ -z "${DATA_IN_MEMORY}" ] || [ "${DATA_IN_MEMORY}" = "false" ]) && echo "read-page-cache ${READ_PAGE_CACHE}") + } +} diff --git a/images/redhat/7.1/community/ubi9/entrypoint.sh b/images/redhat/7.1/community/ubi9/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/redhat/7.1/community/ubi9/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 -f "${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/images/redhat/7.1/community/ubi9/meta b/images/redhat/7.1/community/ubi9/meta new file mode 100644 index 00000000..aa70d1a5 --- /dev/null +++ b/images/redhat/7.1/community/ubi9/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='registry.access.redhat.com' +META_LINUX_BASE='ubi9-minimal' +META_LINUX_PKG_TYPE='rpm' +META_AEROSPIKE_VERSION='7.1.0.6' +META_AEROSPIKE_EDITION='community' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-community/7.1.0.6/aerospike-server-community_7.1.0.6_tools-11.0.2_el9_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='2e2a013661298226f01dc446de9cd307cc6d5f51158e19813356dcdfc3f2520f' +META_AEROSPIKE_AARCH64_LINK='https://artifacts.aerospike.com/aerospike-server-community/7.1.0.6/aerospike-server-community_7.1.0.6_tools-11.0.2_el9_aarch64.tgz' +META_AEROSPIKE_SHA_AARCH64='7bae2e65fcb918f6b534e5049a91e19dba7afb9c10a80e93f540a92fc60354bc' diff --git a/images/redhat/7.1/enterprise/ubi9/Dockerfile b/images/redhat/7.1/enterprise/ubi9/Dockerfile new file mode 100644 index 00000000..cc3e2455 --- /dev/null +++ b/images/redhat/7.1/enterprise/ubi9/Dockerfile @@ -0,0 +1,187 @@ + +# +# Aerospike Server Dockerfile +# +# http://github.com/aerospike/aerospike-server.docker +# + +FROM registry.access.redhat.com/ubi9-minimal + +ARG AEROSPIKE_X86_64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/7.1.0.6/aerospike-server-enterprise_7.1.0.6_tools-11.0.2_el9_x86_64.tgz" +ARG AEROSPIKE_SHA_X86_64="13f286b1644bbbf8c9c006fd075f0d130e7715d0cdfd9e2bb91aefa9748474f9" +ARG AEROSPIKE_AARCH64_LINK="https://artifacts.aerospike.com/aerospike-server-enterprise/7.1.0.6/aerospike-server-enterprise_7.1.0.6_tools-11.0.2_el9_aarch64.tgz" +ARG AEROSPIKE_SHA_AARCH64="83c5a11d86da7608efcd1222aab8166fa20b0ed2c010084e042e5aa8e8093971" + +SHELL ["/bin/bash", "-Eeuo", "pipefail", "-c"] + +# Install Aerospike Server and Tools +RUN \ + { \ + # 00-prelude-rpm.part - Setup dependencies for scripts. + microdnf update -y; \ + microdnf install -y \ + binutils \ + file \ + findutils \ + gzip \ + shadow-utils \ + tar \ + xz; \ + }; \ + { \ + # 00-prelude-rpm.part - Install procps for tests. + microdnf install -y procps-ng; \ + }; \ + { \ + # 10-download.part - Vars used for tini and tools. + VERSION="$(grep -oE "/[0-9]+[.][0-9]+[.][0-9]+([.][0-9]+)+(-rc[0-9]+)?([-][0-9]+[-]g[0-9a-z]*)?/" <<<"${AEROSPIKE_X86_64_LINK}" | tr -d '/' | tail -1)"; \ + }; \ + { \ + # 10-common.part - Install tini. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + if [ "${ARCH}" = "x86-64" ]; then \ + sha256=d1f6826dd70cdd88dde3d5a20d8ed248883a3bc2caba3071c8a3a9b0e0de5940; \ + suffix=""; \ + elif [ "${ARCH}" = "aarch64" ]; then \ + sha256=1c398e5283af2f33888b7d8ac5b01ac89f777ea27c85d25866a40d1e64d0341b; \ + suffix="-arm64"; \ + else \ + echo "Unsuported architecture - ${ARCH}" >&2; \ + exit 1; \ + fi; \ + tini_link="https://github.com/aerospike/tini/releases/download/1.0.1/as-tini-static${suffix}"; \ + if [ "$(curl -fsSL "${tini_link}" --output /usr/bin/as-tini-static --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${tini_link}" >&2; \ + cat /usr/bin/as-tini-static; \ + exit 1; \ + fi; \ + echo "${sha256} /usr/bin/as-tini-static" | sha256sum -c -; \ + chmod +x /usr/bin/as-tini-static; \ + }; \ + { \ + # 10-download.part - Download server and tools. + ARCH="$(file -Lb /usr/bin/awk | awk -F'[,]*' '{ print $2 }' | awk '{ print $NF }')"; \ + mkdir -p aerospike/pkg; \ + if [ "${ARCH}" = "x86-64" ]; then \ + pkg_link="${AEROSPIKE_X86_64_LINK}"; \ + sha256="${AEROSPIKE_SHA_X86_64}"; \ + elif [ "${ARCH}" = "aarch64" ]; 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 --write-out "%{response_code}")" != "200" ]; then \ + echo "Could not fetch pkg - ${pkg_link}" >&2; \ + cat aerospike-server.tgz; \ + exit 1; \ + fi; \ + echo "${sha256} aerospike-server.tgz" | sha256sum -c -; \ + tar xzf aerospike-server.tgz --strip-components=1 -C aerospike; \ + rm -f 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-rpm.part - Install server and dependencies. + rpm -i aerospike/aerospike-server-*.rpm; \ + rm -rf /opt/aerospike/bin; \ + }; \ + { \ + # 20-install-dependencies-rpm.part - Install tools dependencies. + if ! [ "$(printf "%s\n%s" "${VERSION}" "6.2.0.3" | sort -V | head -1)" != "${VERSION}" ]; then \ + # Tools before 6.0 need python3. + microdnf install -y python3; \ + fi; \ + # Tools after 6.0 bundled their own python interpreter. + }; \ + { \ + # 20-install-dependencies-rpm.part - Extract tools. + pushd aerospike/pkg || exit 1; \ + rpm2archive -n ../aerospike-tools*.rpm; \ + tar xf ../aerospike-tools*.tar -C .; \ + rm -f ../aerospike-tools*.tar; \ + popd || exit 1; \ + }; \ + { \ + # 30-install-tools.part - install asinfo and asadm. + find aerospike/pkg/opt/aerospike/bin/ -user aerospike -group aerospike -exec chown root:root {} + || true; \ + 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-rpm.part - Remove dependencies for scripts. + microdnf remove -y \ + # binutils - dependency issues on ubi9 + file \ + findutils \ + # gzip - dependency issues on ubi9 + shadow-utils \ + tar \ + xz 2>&1; \ + microdnf clean all; \ + }; \ + echo "done"; + +LABEL org.opencontainers.image.title="Aerospike Enterprise Server" \ + org.opencontainers.image.description="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." \ + org.opencontainers.image.documentation="https://hub.docker.com/_/aerospike" \ + org.opencontainers.image.base.name="docker.io/library/ubi9-minimal" \ + org.opencontainers.image.source="https://github.com/aerospike/aerospike-server.docker" \ + org.opencontainers.image.vendor="Aerospike" \ + org.opencontainers.image.version="7.1.0.6" \ + org.opencontainers.image.url="https://github.com/aerospike/aerospike-server.docker" + +# 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 + +RUN chown aerospike:aerospike /etc/aerospike/* +USER aerospike:aerospike + +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/images/redhat/7.1/enterprise/ubi9/LICENSE b/images/redhat/7.1/enterprise/ubi9/LICENSE new file mode 100644 index 00000000..0f6833df --- /dev/null +++ b/images/redhat/7.1/enterprise/ubi9/LICENSE @@ -0,0 +1,5 @@ +Copyright 2020-2022 Aerospike, Inc. + +If you are using the Aerospike Database EE evaluation feature key file, you are operating under the [Aerospike Evaluation License Agreement](https://www.aerospike.com/forms/evaluation-license-agreement/). + +If you are using a feature key file you received as part of your commercial enterprise license, you are operating under the [Aerospike Master License Agreement](https://www.aerospike.com/forms/master-license-agreement/). diff --git a/images/redhat/7.1/enterprise/ubi9/aerospike.template.conf b/images/redhat/7.1/enterprise/ubi9/aerospike.template.conf new file mode 100644 index 00000000..7942a049 --- /dev/null +++ b/images/redhat/7.1/enterprise/ubi9/aerospike.template.conf @@ -0,0 +1,68 @@ +# 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}") + cluster-name docker +} + +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. + nsup-period ${NSUP_PERIOD} + replication-factor 1 + storage-engine $([ "${DATA_IN_MEMORY}" = "true" ] && echo "memory" || echo "device") { + # For 'storage-engine memory' with 'device' or 'file' backing, we + # recommend having multiple devices (eight is recommended). One is used + # here for backward compatibility. + file /opt/aerospike/data/${NAMESPACE}.dat + filesize ${STORAGE_GB}G + $(([ -z "${DATA_IN_MEMORY}" ] || [ "${DATA_IN_MEMORY}" = "false" ]) && echo "read-page-cache ${READ_PAGE_CACHE}") + } +} diff --git a/images/redhat/7.1/enterprise/ubi9/entrypoint.sh b/images/redhat/7.1/enterprise/ubi9/entrypoint.sh new file mode 100755 index 00000000..4e9fea35 --- /dev/null +++ b/images/redhat/7.1/enterprise/ubi9/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 -f "${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/images/redhat/7.1/enterprise/ubi9/meta b/images/redhat/7.1/enterprise/ubi9/meta new file mode 100644 index 00000000..5a2fa58f --- /dev/null +++ b/images/redhat/7.1/enterprise/ubi9/meta @@ -0,0 +1,11 @@ +META_DEBUG='false' +META_DOCKER_REGISTRY_URL='registry.access.redhat.com' +META_LINUX_BASE='ubi9-minimal' +META_LINUX_PKG_TYPE='rpm' +META_AEROSPIKE_VERSION='7.1.0.6' +META_AEROSPIKE_EDITION='enterprise' +META_AEROSPIKE_DESCRIPTION='Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions.' +META_AEROSPIKE_X86_64_LINK='https://artifacts.aerospike.com/aerospike-server-enterprise/7.1.0.6/aerospike-server-enterprise_7.1.0.6_tools-11.0.2_el9_x86_64.tgz' +META_AEROSPIKE_SHA_X86_64='13f286b1644bbbf8c9c006fd075f0d130e7715d0cdfd9e2bb91aefa9748474f9' +META_AEROSPIKE_AARCH64_LINK='https://artifacts.aerospike.com/aerospike-server-enterprise/7.1.0.6/aerospike-server-enterprise_7.1.0.6_tools-11.0.2_el9_aarch64.tgz' +META_AEROSPIKE_SHA_AARCH64='83c5a11d86da7608efcd1222aab8166fa20b0ed2c010084e042e5aa8e8093971' diff --git a/lib/array.sh b/lib/array.sh new file mode 100644 index 00000000..f10f1f15 --- /dev/null +++ b/lib/array.sh @@ -0,0 +1,15 @@ +# shellcheck shell=bash + +function array_empty() { + local array=("$@") + + [ "${#array[@]}" -eq 0 ] +} + +function in_array() { + local needle=$1 + shift + local array=("$@") + + printf '%s\0' "${array[@]}" | grep -Fxqz "${needle}" +} diff --git a/lib/fetch.sh b/lib/fetch.sh index c7e28ccc..c053fabc 100644 --- a/lib/fetch.sh +++ b/lib/fetch.sh @@ -1,6 +1,4 @@ -#!/usr/bin/env bash - -set -Eeuo pipefail +# shellcheck shell=bash function fetch() { local tag=$1 diff --git a/lib/globals.sh b/lib/globals.sh new file mode 100644 index 00000000..957ac7ba --- /dev/null +++ b/lib/globals.sh @@ -0,0 +1,17 @@ +# shellcheck shell=bash + +export g_images_dir="images" +export g_target_dir="target" +export g_data_dir="data" +export g_data_template_dir="${g_data_dir}/template" +export g_data_scripts_dir="${g_data_dir}/scripts" +export g_data_res_dir="${g_data_dir}/res" +export g_data_config_dir="${g_data_dir}/config" + +export g_all_editions=("enterprise" "federal" "community") + +declare -A g_license=( + [enterprise]="${g_data_res_dir}/ENTERPRISE_LICENSE" + [federal]="${g_data_res_dir}/FEDERAL_LICENSE" + [community]="${g_data_res_dir}/COMMUNITY_LICENSE") +export g_license diff --git a/lib/log.sh b/lib/log.sh index 86273e7f..2e3ae56a 100644 --- a/lib/log.sh +++ b/lib/log.sh @@ -1,6 +1,4 @@ -#!/usr/bin/env bash - -set -Eeuo pipefail +# shellcheck shell=bash LOG_RED="\e[31m" LOG_GREEN="\e[32m" diff --git a/lib/support.sh b/lib/support.sh index dcfc67a8..abc8d743 100644 --- a/lib/support.sh +++ b/lib/support.sh @@ -1,101 +1,122 @@ -#!/usr/bin/env bash - -set -Eeuo pipefail +# shellcheck shell=bash +source lib/array.sh +source lib/globals.sh source lib/log.sh source lib/version.sh -function support_all_editions() { - echo "enterprise federal community" -} - -function support_editions_for_asd() { - local version=$1 +function support_config_filter() { + local needle=$1 + shift + local array=("$@") - if version_compare_gt "6.0" "${version}"; then - echo "enterprise community" - return - fi - - echo "enterprise federal community" + ! array_empty "${array[@]}" && ! in_array "${needle}" "${array[@]}" } -function support_distro_to_base() { - local distro=$1 +function support_platform_to_arch() { + local platform=$1 - case "${distro}" in - ubuntu20.04) - echo "ubuntu:20.04" - ;; - ubuntu22.04) - echo "ubuntu:22.04" + case "${platform}" in + "linux/amd64") + echo "x86_64" ;; - ubuntu24.04) - echo "ubuntu:24.04" + "linux/arm64") + echo "aarch64" ;; *) - warn "unsupported distro '${distro}'" + log_warn "Unexpected platform '${platform}'" exit 1 ;; esac } -function support_distros_for_asd() { - local version=$1 +function support_source_config() { + local registry=$1 + local version=$2 + local edition="" - if version_compare_gt "6.3" "${version}"; then - echo "ubuntu20.04" - return + if [ $# -ge 3 ]; then + edition=$3 fi - if version_compare_gt "7.2" "${version}"; then - echo "ubuntu22.04" - return + # Apply registry config. + local registry_config_dir="${g_data_config_dir}/${registry}" + local registry_config="${registry_config_dir}/config.sh" + + if [ -f "${registry_config}" ]; then + # shellcheck source=data/config/dockerhub/config.sh + source "${registry_config}" fi - echo "ubuntu24.04" -} + # Apply version config (required). + local version_config_dir="${registry_config_dir}/${version}" -function support_arch_for_asd() { - local version=$1 + # shellcheck source=data/config/dockerhub/6.4/config.sh + source "${version_config_dir}/config.sh" - if version_compare_gt "6.2" "${version}"; then - echo "x86_64" + if [ -z "${edition}" ]; then return fi - echo "x86_64 aarch64" + # Apply edition config (required). + local edition_config="${version_config_dir}/${edition}/config.sh" + + if [ -f "${edition_config}" ]; then + # shellcheck source=data/config/dockerhub/6.4/federal/config.sh + source "${edition_config}" + fi } -function support_platforms_for_asd() { - local version=$1 - local edition=$2 +function _dir_dirs() { + local search_dir=$1 - if version_compare_gt "6.2" "${version}"; then - echo "linux/amd64" - return - fi + while IFS= read -r -d '' dir; do + local found_dir= + found_dir=$(basename "${dir}") + echo "${found_dir}" + done < <(find "${search_dir}" -mindepth 1 -maxdepth 1 -type d -print0) +} - if [ "${edition}" = "federal" ]; then - echo "linux/amd64" - fi +function support_registries() { + _dir_dirs "${g_data_config_dir}" | sort +} + +function support_versions() { + local registry=$1 - echo "linux/amd64 linux/arm64" + _dir_dirs "${g_data_config_dir}/${registry}" | sort } -function support_platform_to_arch() { - local platform=$1 +function support_editions() { + local registry=$1 + local version=$2 - case "${platform}" in - "linux/amd64") - echo "x86_64" - ;; - "linux/arm64") - echo "aarch64" - ;; - *) - warn "Unexpected platform '${platform}'" - exit 1 - ;; - esac + _dir_dirs "${g_data_config_dir}/${registry}/${version}" | sort +} + +function support_configs() { + local prev + local leaf_config_path + + while IFS= read -r -d '' leaf_config_path; do + if [[ ${prev} =~ ${leaf_config_path} ]]; then + continue + fi + + prev="${leaf_config_path}" + echo "${leaf_config_path}" + done < <(find "${g_data_config_dir}" -depth -type d -print0) +} + +function support_image_path() { + # registry version edition distro + local args=("$@") + + images_path=("${g_images_dir}" "${args[@]}") + echo "${images_path[*]}" | tr ' ' '/' +} + +function template_overrides() { + find ${g_data_template_dir} -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | + sort -V } diff --git a/lib/verbose_call.sh b/lib/verbose_call.sh index 73b97d18..dbbc80b1 100644 --- a/lib/verbose_call.sh +++ b/lib/verbose_call.sh @@ -1,6 +1,4 @@ -#!/usr/bin/env bash - -set -Eeuo pipefail +# shellcheck shell=bash function verbose_call() { set -x diff --git a/lib/version.sh b/lib/version.sh index 5eaeab97..f64fe64d 100644 --- a/lib/version.sh +++ b/lib/version.sh @@ -1,11 +1,11 @@ -#!/usr/bin/env bash - -set -Eeuo pipefail +# shellcheck shell=bash source lib/fetch.sh +source lib/globals.sh +source lib/log.sh ARTIFACTS_DOMAIN=${ARTIFACTS_DOMAIN:="https://artifacts.aerospike.com"} -RE_VERSION='[0-9]+[.][0-9]+[.][0-9]+([.][0-9]+)+(-rc[0-9]+)?([-][0-9]*[-]g[0-9a-z]*)?' +RE_VERSION='[0-9]+[.][0-9]+[.][0-9]+([.][0-9]+)+(-(alpa|beta|rc)[0-9]+)?([-][0-9]*[-]g[0-9a-z]*)?' function version_compare_gt() { v1=$1 @@ -65,7 +65,7 @@ function find_latest_tools_version_for_server() { local tools_version tools_version="$( fetch "${FUNCNAME[0]}" "${ARTIFACTS_DOMAIN}/aerospike-server-${edition}/${server_version}/" | - grep -oE "_tools-[0-9.-]+(-rc[0-9]+)?(-g[a-f0-9]{7})?_${distro}_x86_64.tgz" | + grep -oE "_tools-[0-9.-]+(-[a-z0-9]+)?(-g[a-f0-9]{7})?_${distro}_x86_64.tgz" | cut -d _ -f 2 | sort -V | tail -1 @@ -127,8 +127,11 @@ function fetch_package_sha() { } function get_version_from_dockerfile() { - local distro=$1 - local edition=$2 + local registry=$1 + local version=$2 + local distro=$3 + local edition=$4 - grep "ARG AEROSPIKE_X86_64_LINK=" "${edition}/${distro}/Dockerfile" | grep -oE "/[0-9]+[.][0-9]+[.][0-9]+([.][0-9]+)+(-rc[0-9]+)?([-][0-9]*[-]g[0-9a-z]*)?/" | tr -d '/' | tail -1 + grep "ARG AEROSPIKE_X86_64_LINK=" "${g_images_dir}/${registry}/${version}/${edition}/${distro}/Dockerfile" | + grep -oE "/${RE_VERSION}?/" | tr -d '/' | tail -1 } diff --git a/res/eval_features.conf b/res/eval_features.conf deleted file mode 100644 index c725e858..00000000 --- a/res/eval_features.conf +++ /dev/null @@ -1,29 +0,0 @@ -# generated 2022-07-01 23:07:39 - -feature-key-version 2 -serial-number 205748112 - -account-name Aerospike_Eval_ver.6.1 - -account-ID Aerospike_20220701 - -valid-until-version 6.1 - -asdb-change-notification true -asdb-cluster-nodes-limit 1 -asdb-compression true -asdb-encryption-at-rest true -asdb-ldap true -asdb-pmem true -mesg-jms-connector true -mesg-kafka-connector true -presto-connector true -pulsar-connector true -raf-realtime-analysis-framework true -spark-connector true - ------ SIGNATURE ------------------------------------------------ -MEQCIBJWKXpVu3fpUMUEi81pgm+B6DVSheWs/S61vBhL/1eyAiAtFU4/uy1isKmH -m1ErWRR+ySLa9/QR0g3pEyDhes8aeyQ= ------ END OF SIGNATURE ----------------------------------------- - diff --git a/template/0/README.md b/template/0/README.md deleted file mode 100644 index a0bb028c..00000000 --- a/template/0/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# 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/template/0/entrypoint.sh b/template/0/entrypoint.sh deleted file mode 100755 index 1aa9d0ea..00000000 --- a/template/0/entrypoint.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/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/test.sh b/test.sh index efa03492..f35af591 100755 --- a/test.sh +++ b/test.sh @@ -2,89 +2,68 @@ #---------------------------------------------------------------------- # Sample: -# All editions and distributions: ./test.sh --all -# enterprise, ubuntu20 with cleanup: ./test.sh -e enterpise -d ubuntu20 -c +# All editions and distributions: ./test.sh #---------------------------------------------------------------------- set -Eeuo pipefail +source lib/globals.sh source lib/log.sh source lib/support.sh source lib/verbose_call.sh source lib/version.sh -IMAGE_TAG= -CONTAINER= - function usage() { cat < as it apprears in '${g_data_config_dir}. Default 'dockerhub'. EOF } function parse_args() { - CLEAN="false" - EDITION= - DISTRIBUTION= - - PARSED_ARGS=$(getopt -a -n test -o che:d:p: --long clean,help,edition:,distro:,platform: -- "$@") - VALID_ARGS=$? - - if [ "${VALID_ARGS}" != "0" ]; then - usage - fi + g_registry='dockerhub' + g_clean="false" - eval set -- "${PARSED_ARGS}" - while true; do - case "$1" in - -c | --clean) - CLEAN="true" - shift + while getopts "chy:" opt; do + case "${opt}" in + c) + g_clean="true" ;; - -e | --edition) - EDITION=$2 - shift 2 - ;; - -d | --distro) - DISTRIBUTION=$2 - shift 2 - ;; - --) - shift - break - ;; - -h) + h) usage exit 0 ;; + y) + g_registry="${OPTARG}" + ;; *) - log_warn "Unexpected option: $1" + log_warn "** Invalid argument **" usage exit 1 ;; esac done + + log_info "g_clean: '${g_clean}'" + log_info "g_registry: '${g_registry}'" } function run_docker() { - version=$1 + local version_short=$1 + local edition=$2 + local platform=$3 + local container=$4 + local image_tag=$5 - log_info "------ Running docker image ${IMAGE_TAG} ..." + log_info "running docker image '${image_tag}'" - if [ "${EDITION}" = "community" ] || version_compare_gt "${version}" "6.1"; then - verbose_call docker run -td --name "${CONTAINER}" "${PLATFORM/#/"--platform="}" \ - "${IMAGE_TAG}" - else - # Must supply a feature key when version is prior to 6.1. - verbose_call docker run -td --name "${CONTAINER}" "${PLATFORM/#/"--platform="}" \ - -v "/$(pwd)/res/":/asfeat/ -e "FEATURE_KEY_FILE=/asfeat/eval_features.conf" \ - "${IMAGE_TAG}" - fi + verbose_call docker run -td --name "${container}" \ + "${platform/#/"--platform="}" "${image_tag}" } function try() { @@ -107,18 +86,22 @@ function try() { function check_container() { local version=$1 + local edition=$2 + local platform=$3 + local container=$4 - log_info "------ Verifying docker container ..." + log_info "verifying container '${container}' version '${version}' platform '${platform}' ..." - if [ "$(docker container inspect -f '{{.State.Status}}' "${CONTAINER}")" == "running" ]; then - log_success "Container ${CONTAINER} started and running" + if [ "$(docker container inspect -f '{{.State.Status}}' "${container}")" == "running" ]; then + log_success "Container '${container}' started and running" else - log_failure "**Container ${CONTAINER} failed to start**" + log_failure "**Container '${container}' failed to start**" exit 1 fi - container_platform="$(docker exec -t "${CONTAINER}" bash -c 'stty -onlcr && uname -m')" - expected_platform="$(support_platform_to_arch "${PLATFORM}")" + container_platform="$(docker exec -t "${container}" bash -c \ + 'stty -onlcr && uname -m')" + expected_platform="$(support_platform_to_arch "${platform}")" if [ "${container_platform}" = "${expected_platform}" ]; then log_success "Container platform is expected platform '${expected_platform}'" @@ -127,21 +110,22 @@ function check_container() { exit 1 fi - if try 10 docker exec -t "${CONTAINER}" bash -c 'pgrep -x asd' >/dev/null; then + if try 10 docker exec -t "${container}" bash -c 'pgrep -x asd' >/dev/null; then log_success "Aerospike database is running" else log_failure "**Aerospike database is not running**" exit 1 fi - if try 5 docker exec -t "${CONTAINER}" bash -c 'asinfo -v status' | grep -qE "^ok"; then + if try 5 docker exec -t "${container}" bash -c 'asinfo -v status' | grep -qE "^ok"; then log_success "(asinfo) Aerospike database is responding" else log_failure "**(asinfo) Aerospike database is not responding**" exit 1 fi - build=$(try 5 docker exec -t "${CONTAINER}" bash -c 'asadm -e "enable; asinfo -v build"' | grep -oE "^${version}") + build=$(try 5 docker exec -t "${container}" bash -c \ + 'asadm -e "enable; asinfo -v build"' | grep -oE "^${version}") if [ -n "${build}" ]; then log_success "(asadm) Aerospike database has correct version - '${build}'" @@ -150,21 +134,24 @@ function check_container() { exit 1 fi - edition=$(try 5 docker exec -t "${CONTAINER}" bash -c 'asadm -e "enable; asinfo -v edition"' | grep -oE "^Aerospike ${EDITION^} Edition") + container_edition=$(try 5 docker exec -t "${container}" bash -c \ + 'asadm -e "enable; asinfo -v edition"' | grep -oE "^Aerospike ${edition^} Edition") - if [ -n "${edition}" ]; then - log_success "(asadm) Aerospike database has correct edition - '${edition}'" + if [ -n "${container_edition}" ]; then + log_success "(asadm) Aerospike database has correct edition - '${container_edition}'" else - log_failure "**(asadm) Aerospike database has incorrect edition - '${edition}'**" + log_failure "**(asadm) Aerospike database has incorrect edition - '${container_edition}'**" exit 1 fi if version_compare_gt "${version}" "6.2"; then tool="asinfo" - namespace=$(try 5 docker exec -t "${CONTAINER}" bash -c 'asinfo -v namespaces' | grep -o "test") + namespace=$(try 5 docker exec -t "${container}" bash -c \ + 'asinfo -v namespaces' | grep -o "test") else tool="aql" - namespace=$(try 5 docker exec -t "${CONTAINER}" bash -c 'aql -o raw <<<"SHOW namespaces" 2>/dev/null' | grep "namespaces: \"test\"") + namespace=$(try 5 docker exec -t "${container}" bash -c \ + 'aql -o raw <<<"SHOW namespaces" 2>/dev/null' | grep "namespaces: \"test\"" | tr -d '\r') fi if [ -n "${namespace}" ]; then @@ -173,75 +160,72 @@ function check_container() { log_failure "**(${tool}) Aerospike database does not have namespace 'test' - '${namespace}'" fi - log_info "------ Verify docker image completed successfully" + log_info "verify docker image completed successfully" } function try_stop_docker() { - log_info "------ Stop and remove containers form prior failed run" + local container=$1 - if verbose_call docker stop "${CONTAINER}"; then - verbose_call docker rm -f "${CONTAINER}" - fi + log_info "stop and remove containers '${container}' form prior failed run ..." - log_info "------ Stop and remove containers form prior failed run complete" + verbose_call docker rm -f "$(docker stop -q "${container}")" >/dev/null 2>&1 || true + + log_info "stop and remove containers form prior failed run complete" } function clean_docker() { - log_info "------ Cleaning up old containers ..." - verbose_call docker stop "${CONTAINER}" - verbose_call docker rm -f "${CONTAINER}" - log_info "------ Cleaning up old containers complete" - - if [ "${CLEAN}" = "true" ]; then - log_info "------ Cleaning up old images ..." - verbose_call docker rmi -f "$(docker images "${IMAGE_TAG}" -a -q | sort | uniq)" - log_info "------ Cleaning up old images complete" + local container=$1 + local image_tag=$2 + + log_info "cleaning up old containers '${container}' ..." + verbose_call docker stop "${container}" + verbose_call docker rm -f "${container}" + log_info "cleaning up old containers complete" + + if [ "${g_clean}" = "true" ]; then + log_info "cleaning up old images '${image_tag}' ..." + verbose_call docker rmi -f "$(docker images "${image_tag}" -a -q | sort | uniq)" + log_info "cleaning up old images complete" fi } -function test_current_edition_distro() { - local version - version="$(get_version_from_dockerfile "${DISTRIBUTION}" "${EDITION}")" - CONTAINER="aerospike-server-${EDITION}" - local platform_list - IFS=' ' read -r -a platform_list <<<"$(support_platforms_for_asd "${version}" "${EDITION}")" - - for platform in "${platform_list[@]}"; do - short_platform=${platform#*/} - IMAGE_TAG="aerospike/aerospike-server-${EDITION}-${short_platform}:${version}" - PLATFORM=${platform} - try_stop_docker - run_docker "${version}" - check_container "${version}" - clean_docker - done -} - function main() { parse_args "$@" - local edition_list=("${EDITION}") + for version_short in $(support_versions "${g_registry}"); do + support_source_config "${g_registry}" "${version_short}" - if [ -z "${EDITION}" ]; then - readarray -t edition_list < <(find community enterprise federal -name Dockerfile -type f | cut -d/ -f1) - fi + for edition in "${c_editions[@]}"; do + local container="aerospike-server-${edition}" - log_info "------ Testing editions: '${edition_list[*]}'" + support_source_config "${g_registry}" "${version_short}" "${edition}" - for edition in "${edition_list[@]}"; do - local distribution_list=("${DISTRIBUTION}") + for distro_ix in "${!c_distros[@]}"; do + local distro="${c_distros[${distro_ix}]}" + local distro_dir="${c_distro_dir[${distro_ix}]}" - if [ -z "${DISTRIBUTION}" ]; then - readarray -t distribution_list < <(find "${edition}"/* -maxdepth 0 -type d | cut -d/ -f2) - fi + version_path="$(support_image_path "${g_registry}" \ + "${version_short}" "${edition}" "${distro_dir}")" + + if [ ! -d "${version_path}" ]; then + continue + fi - for distribution in "${distribution_list[@]}"; do - EDITION=$edition - DISTRIBUTION=$distribution + local version_full + version_full="$(get_version_from_dockerfile "${g_registry}" \ + "${version_short}" "${distro_dir}" "${edition}")" - log_info "------ Testing for edition=${EDITION} Distribution=${DISTRIBUTION}" + for platform in "${c_platforms[@]}"; do + local short_platform= + short_platform="$(basename "${platform}")" + local image_tag="aerospike/aerospike-server-${edition}-${short_platform}:${version_full}-${distro}" - test_current_edition_distro + try_stop_docker "${container}" + run_docker "${version_full}" "${edition}" "${platform}" "${container}" "${image_tag}" + check_container "${version_full}" "${edition}" "${platform}" "${container}" "${image_tag}" + clean_docker "${container}" "${image_tag}" + done + done done done } diff --git a/update.sh b/update.sh index d3cce28c..43596ef6 100755 --- a/update.sh +++ b/update.sh @@ -3,30 +3,101 @@ set -Eeuo pipefail source lib/fetch.sh +source lib/globals.sh source lib/log.sh source lib/support.sh source lib/version.sh -function copy_template() { - local template_path="template" - local target_path=$1 +function usage() { + cat < as it apprears in '${g_data_config_dir}. May be repeated. + -d as it appears in 'config.sh'. May be repeated. + -e as it appears in 'config.sh'. May be repeated. + -s . +EOF +} - local override - for override in \ - $(find template/* -maxdepth 1 -type d -printf "%f\n" | sort -V); do - if ! version_compare_gt "${override}" "${g_server_version}"; then - local override_path="${template_path}/${override}/" +function parse_args() { + g_filter_registries=() + g_filter_full_versions=() + g_filter_short_versions=() + g_filter_editions=() + g_filter_distros=() - log_debug "copy_template - ${override_path} to ${target_path}" - cp -r "${override_path}"/* "${target_path}" - fi + g_has_filters="false" + + while getopts "d:e:hs:y:" opt; do + case "${opt}" in + d) + g_filter_distros+=("${OPTARG}") + g_has_filters="true" + ;; + e) + g_filter_editions+=("${OPTARG}") + g_has_filters="true" + ;; + h) + usage + exit 0 + ;; + s) + g_filter_full_versions+=("${OPTARG}") + g_has_filters="true" + ;; + y) + g_filter_registries+=("${OPTARG}") + g_has_filters="true" + ;; + + *) + log_warn "** Invalid argument **" + usage + exit 1 + ;; + esac + done + + local temp + temp="$(printf "'%s' " "${g_filter_registries[@]}")" + log_info "g_filter_registries: (${temp%" "})" + temp="$(printf "'%s' " "${g_filter_full_versions[@]}")" + log_info "g_filter_full_versions: (${temp%" "})" + temp="$(printf "'%s' " "${g_filter_editions[@]}")" + log_info "g_filter_editions: (${temp%" "})" + temp="$(printf "'%s' " "${g_filter_distros[@]}")" + log_info "g_filter_distros: (${temp%" "})" + + for full_ver in "${g_filter_full_versions[@]}"; do + short_ver=$(sed -E 's/(\.[0-9]+){2}(-rc.*)?$//' <<<"${full_ver}") + g_filter_short_versions+=("${short_ver}") done + + temp="$(printf "'%s' " "${g_filter_short_versions[@]}")" + log_info "g_filter_short_versions: (${temp%" "})" +} + +function create_meta() { + local target_path=$1 + + target_file="${target_path}/meta" + + { + echo "META_DEBUG='${DEBUG}'" + echo "META_DOCKER_REGISTRY_URL='${DOCKER_REGISTRY_URL}'" + echo "META_LINUX_BASE='${LINUX_BASE}'" + echo "META_LINUX_PKG_TYPE='${LINUX_PKG_TYPE}'" + echo "META_AEROSPIKE_VERSION='${AEROSPIKE_VERSION}'" + echo "META_AEROSPIKE_EDITION='${AEROSPIKE_EDITION}'" + echo "META_AEROSPIKE_DESCRIPTION='${AEROSPIKE_DESCRIPTION}'" + echo "META_AEROSPIKE_X86_64_LINK='${AEROSPIKE_X86_64_LINK}'" + echo "META_AEROSPIKE_SHA_X86_64='${AEROSPIKE_SHA_X86_64}'" + echo "META_AEROSPIKE_AARCH64_LINK='${AEROSPIKE_AARCH64_LINK}'" + echo "META_AEROSPIKE_SHA_AARCH64='${AEROSPIKE_SHA_AARCH64}'" + } >"${target_file}" } function bash_eval_template() { @@ -35,12 +106,12 @@ function bash_eval_template() { echo "" >"${target_file}" - local line 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}" + grep -qE "[^[:space:]]*" <<<"${update}" && + echo "${update}" >>"${target_file}" else echo "${line}" >>"${target_file}" fi @@ -53,40 +124,115 @@ function bash_eval_template() { function bash_eval_templates() { local target_path=$1 - local template_file while IFS= read -r -d '' template_file; do target_file="${template_file%.template}" bash_eval_template "${template_file}" "${target_file}" done < <(find "${target_path}" -type f -name "*.template" -print0) } -function do_template() { - local distro=$1 - local edition=$2 - - log_info "do_template() - distro '${distro}' edition '${edition}'" +function copy_template() { + local target_path=$1 - if [ -z "${g_tools_version}" ]; then - # Use the first lookup, the version should be the same for each. - g_tools_version=$(find_latest_tools_version_for_server "${distro}" "${edition}" "${g_server_version}") + if [ -d "${target_path}" ]; then + log_warn "unexpected - found '${target_path}'" fi + mkdir -p "${target_path}" + + local override + for override in $(template_overrides); do + if ! version_compare_gt "${override}" "${g_server_version}"; then + local override_path="${g_data_template_dir}/${override}/" + + log_debug "copy_template - ${override_path} to ${target_path}" + cp -r "${override_path}"/* "${target_path}" + fi + done +} + +function do_template() { + local registry=$1 + local version=$2 + local edition=$3 + local distro=$4 + local distro_dir=$5 + local distro_base=$6 + + log_info "do_template() - edition '${edition}' distro '${distro}' distro_base '${distro_base}'" + # These are variables used by the template. DEBUG="${DEBUG:=false}" - LINUX_BASE="$(support_distro_to_base "${distro}")" + DOCKER_REGISTRY_URL="${c_registry_url}" + LINUX_BASE="${distro_base}" + LINUX_PKG_TYPE= AEROSPIKE_VERSION="${g_server_version}" - CONTAINER_RELEASE="${g_container_release}" AEROSPIKE_EDITION="${edition}" AEROSPIKE_DESCRIPTION="Aerospike is a real-time database with predictable performance at petabyte scale with microsecond latency over billions of transactions." - AEROSPIKE_X86_64_LINK="$(get_package_link "${distro}" "${edition}" "${g_server_version}" "${g_tools_version}" "x86_64")" - AEROSPIKE_SHA_X86_64="$(fetch_package_sha "${distro}" "${edition}" "${g_server_version}" "${g_tools_version}" "x86_64")" - AEROSPIKE_AARCH64_LINK="$(get_package_link "${distro}" "${edition}" "${g_server_version}" "${g_tools_version}" "aarch64")" - AEROSPIKE_SHA_AARCH64="$(fetch_package_sha "${distro}" "${edition}" "${g_server_version}" "${g_tools_version}" "aarch64")" + AEROSPIKE_X86_64_LINK= + AEROSPIKE_SHA_X86_64= + AEROSPIKE_AARCH64_LINK= + AEROSPIKE_SHA_AARCH64= + + if grep -qo "ubuntu:" <<<"${distro_base}"; then + LINUX_PKG_TYPE="deb" + elif grep -qEo "ubi[89]-" <<<"${distro_base}"; then + LINUX_PKG_TYPE="rpm" + else + log_warn "unexpected distro_base '${distro_base}'" + exit 1 + fi + + local arch + for arch in "${c_archs[@]}"; do + case ${arch} in + aarch64) + AEROSPIKE_AARCH64_LINK="$(get_package_link "${distro}" \ + "${edition}" "${g_server_version}" "${g_tools_version}" \ + aarch64)" + AEROSPIKE_SHA_AARCH64="$(fetch_package_sha "${distro}" \ + "${edition}" "${g_server_version}" "${g_tools_version}" \ + aarch64)" + + if [ -z "${AEROSPIKE_AARCH64_LINK}" ]; then + log_warn "could not find aarch64 link" + exit 1 + fi + + if [ -z "${AEROSPIKE_SHA_AARCH64}" ]; then + log_warn "could not find aarch64 sha" + exit 1 + fi + ;; + x86_64) + AEROSPIKE_X86_64_LINK="$(get_package_link "${distro}" \ + "${edition}" "${g_server_version}" "${g_tools_version}" \ + x86_64)" + AEROSPIKE_SHA_X86_64="$(fetch_package_sha "${distro}" \ + "${edition}" "${g_server_version}" "${g_tools_version}" \ + x86_64)" + + if [ -z "${AEROSPIKE_X86_64_LINK}" ]; then + log_warn "could not find x86_64 link" + exit 1 + fi + + if [ -z "${AEROSPIKE_SHA_X86_64}" ]; then + log_warn "could not find x86_64 sha" + exit 1 + fi + ;; + *) + log_warn "unexpected arch '${arch}'" + exit 1 + ;; + esac + done log_info "DEBUG: '${DEBUG}'" + log_info "DOCKER_REGISTRY_URL: '${DOCKER_REGISTRY_URL}'" log_info "LINUX_BASE: '${LINUX_BASE}'" + log_info "LINUX_PKG_TYPE: '${LINUX_PKG_TYPE}'" log_info "AEROSPIKE_VERSION: '${AEROSPIKE_VERSION}'" - log_info "CONTAINER_RELEASE: '${CONTAINER_RELEASE}'" log_info "AEROSPIKE_EDITION: '${AEROSPIKE_EDITION}'" log_info "AEROSPIKE_DESCRIPTION: '${AEROSPIKE_DESCRIPTION}'" log_info "AEROSPIKE_X86_64_LINK: '${AEROSPIKE_X86_64_LINK}'" @@ -94,274 +240,92 @@ function do_template() { log_info "AEROSPIKE_AARCH64_LINK: '${AEROSPIKE_AARCH64_LINK}'" log_info "AEROSPIKE_SHA_AARCH64: '${AEROSPIKE_SHA_AARCH64}'" - local target_path="${edition}/${distro}" + local target_path= + target_path="$(support_image_path "${registry}" "${version}" "${edition}" \ + "${distro_dir}")" copy_template "${target_path}" + create_meta "${target_path}" bash_eval_templates "${target_path}" + cp "${g_license["${edition}"]}" "${target_path}"/LICENSE } -function usage() { - cat < -s -t - - -e Edition to update - -g Collects version information form 'git describe --abbrev=0' - -h Display this help. - -r Use if re-releasing an image - should increment by - one for each re-release. - -s Use this version instead of scraping the latest version - from artifacts. - -t Use this version instead of scraping the latest version - for a particular server version from artifacts. -EOF -} +function update_version() { + local registry=$1 + local version=$2 -function parse_args() { - g_server_edition= - g_server_version= - g_container_release='1' - g_tools_version= + g_server_version=$(grep "^${version}" <<<"$( + printf '%s\n' "${g_filter_full_versions[@]}" + )" || true) - while getopts "e:ghr:s:t:" opt; do - case "${opt}" in - e) - g_server_edition="${OPTARG}" - ;; - g) - local git_describe - git_describe="$(git describe --abbrev=0)" - - if grep -q "_" <<<"${git_describe}"; then - g_server_version="$(cut -sd _ -f 1 <<<"${git_describe}")" - g_container_release="$(cut -sd _ -f 2 <<<"${git_describe}")" - else - g_server_version="${git_describe}" - g_container_release='1' - fi - ;; - h) - usage - exit 0 - ;; - r) - g_container_release="${OPTARG}" - ;; - s) - g_server_version="${OPTARG}" - ;; - t) - g_tools_version="${OPTARG}" - ;; - *) - log_warn "** Invalid argument **" - usage - exit 1 - ;; - esac - done + if [ -z "${g_server_version}" ]; then + # HACK - artifacts for server need first 3 digits. + g_server_version=$(find_latest_server_version_for_lineage "${version}.0") + fi - shift $((OPTIND - 1)) -} + g_tools_version= -function generate_templates() { - local all_editions - IFS=' ' read -r -a all_editions <<<"$(support_all_editions)" + support_source_config "${registry}" "${version}" - # Clear prior builds. - local edition - for edition in "${all_editions[@]}"; do - find "${edition}"/* -maxdepth 0 -type d -exec rm -rf {} \; + for distro in "${c_distros[@]}"; do + # Assumes that there will always be an 'enterprise' edition. + g_tools_version=$(find_latest_tools_version_for_server \ + "${distro}" enterprise "${g_server_version}") + break done + log_info "update_version() - registry '${registry}' server '${version}' -> '${g_server_version}' tools '${g_tools_version}'" + # Generate new builds. local edition - for edition in "${g_editions[@]}"; do - local distro - for distro in "${g_distros[@]}"; do - do_template "${distro}" "${edition}" - done - done -} - -function do_bake_test_group_targets() { - local distro="${1//\./-}" - local edition=$2 - - local platform_list - IFS=' ' read -r -a platform_list <<<"$(support_platforms_for_asd "${g_server_version}" "${edition}")" - - local output="" - - local platform - for platform in "${platform_list[@]}"; do - local short_platform=${platform#*/} - local target_str="${edition}_${distro}_${short_platform}" - - output+="\"${target_str}\", " - done - - printf "%s" "${output}" -} - -function do_bake_group() { - local group=$1 + for edition in "${c_editions[@]}"; do + if support_config_filter "${edition}" "${g_filter_editions[@]}"; then + continue + fi - local output="#------------------------------------ ${group} -----------------------------------\n\n" + support_source_config "${registry}" "${version}" "${edition}" - output+="group \"${group}\" {\n targets=[" + local distro_ix + for distro_ix in "${!c_distros[@]}"; do + local distro="${c_distros[${distro_ix}]}" + local distro_dir="${c_distro_dir[${distro_ix}]}" + local distro_base="${c_distro_bases[${distro_ix}]}" - local edition - for edition in "${g_editions[@]}"; do - local distro - for distro in "${g_distros[@]}"; do - distro="${distro//\./-}" - if [[ "${group}" == "test" ]]; then - output+="$(do_bake_test_group_targets "${distro}" "${edition}")" - elif [[ "${group}" == "push" ]]; then - output+="\"${edition}_${distro}\", " - else - log_warn "unexpected group '%{group}'" - exit 1 + if support_config_filter "${distro}" "${g_filter_distros[@]}"; then + continue fi - done - done - # (Optional) Trailing comma causes no problem to Docker Buildx Bake. - output=${output%,*} - output+="]\n}\n" - - printf "%s" "${output}" -} - -function do_bake_test_target() { - local distro=$1 - local edition=$2 - - local distroTmp - local platform_list - local output="" - - distroTmp="${distro//\./-}" - IFS=' ' read -r -a platform_list <<<"$(support_platforms_for_asd "${g_server_version}" "${edition}")" - - local platform - for platform in "${platform_list[@]}"; do - local short_platform=${platform#*/} - local target_str="${edition}_${distroTmp}_${short_platform}" - - output+="target \"${target_str}\" {\n" - output+=" tags=[\"aerospike/aerospike-server-${edition}-${short_platform}:${g_server_version}\", \"aerospike/aerospike-server-${edition}-${short_platform}:latest\"]\n" - output+=" platforms=[\"${platform}\"]\n" - output+=" context=\"./${edition}/${distro}\"\n" - output+="}\n\n" - done - - printf "%s" "${output}" -} - -function do_bake_push_target() { - local distro=$1 - local edition=$2 - local distroTmp - local platform_list - - distroTmp="${distro//\./-}" - IFS=' ' read -r -a platform_list <<<"$(support_platforms_for_asd "${g_server_version}" "${edition}")" - - printf -v platforms_str '%s,' "${platform_list[@]}" - platforms_str="${platforms_str%,}" - - local target_str="${edition}_${distroTmp}" - local output="target \"${target_str}\" {\n" - - local product="aerospike/aerospike-server" - - if [ "${edition}" != "community" ]; then - product+="-${edition}" - fi - - output+=" tags=[\"${product}:${g_server_version}\"" - - if [ -n "${g_container_release}" ]; then - output+=", \"${product}:${g_server_version}_${g_container_release}\"" - fi - - if [ "${g_latest_version}" = "${g_server_version}" ]; then - output+=", \"${product}:latest\"" - fi - - output+="]\n" - output+=" platforms=[\"${platforms_str}\"]\n" - output+=" context=\"./${edition}/${distro}\"\n" - output+="}\n\n" - - printf "%s" "${output}" -} - -function generate_bake_file() { - local bake_file="bake.hcl" - - cat <<-EOF >"${bake_file}" -# This file contains the targets for the test images. -# This file is auto-generated by the update.sh script and will be wiped out by the update.sh script. -# Please don't edit this file. -# -# Build all test/push images: -# docker buildx bake -f ${bake_file} [test | push] --progressive plain [--load | --push] -# Build selected images: -# docker buildx bake -f ${bake_file} [target name, ...] --progressive plain [--load | --push] - -EOF - - local test_targets_str="" - local push_targets_str="" - - local edition - for edition in "${g_editions[@]}"; do - local distro - for distro in "${g_distros[@]}"; do - test_targets_str+="$(do_bake_test_target "${distro}" "${edition}")" - push_targets_str+="$(do_bake_push_target "${distro}" "${edition}")" + do_template "${registry}" "${version}" "${edition}" "${distro}" \ + "${distro_dir}" "${distro_base}" done done - - local test_group_str - test_group_str="$(do_bake_group "test")" - local push_group_str - push_group_str="$(do_bake_group "push")" - - { - printf "%b\n%b" "${test_group_str}" "${test_targets_str}" - printf "%b\n%b" "${push_group_str}" "${push_targets_str}" - } >>"${bake_file}" } function main() { parse_args "$@" - g_latest_version= + rm -rf "${g_images_dir:?}/"* - if [ -z "${g_server_version}" ]; then - g_server_version=$(find_latest_server_version) - g_latest_version=g_server_version - else - g_server_version=$(find_latest_server_version_for_lineage "${g_server_version}") - g_latest_version=$(find_latest_server_version) - fi + local registry + for registry in $(support_registries); do + if support_config_filter "${registry}" "${g_filter_registries[@]}"; then + continue + fi - g_distros= - IFS=' ' read -r -a g_distros <<<"$(support_distros_for_asd "${g_server_version}")" + local version + for version in $(support_versions "${registry}"); do + if support_config_filter \ + "${version}" "${g_filter_short_versions[@]}"; then + continue + fi - g_editions= + update_version "${registry}" "${version}" + done + done - if [ -z "${g_server_edition}" ]; then - IFS=' ' read -r -a g_editions <<<"$(support_editions_for_asd "${g_server_version}")" - else - g_editions=("${g_server_edition}") + if [[ "${g_has_filters}" == "true" ]]; then + log_warn "Reminder - do not commit changes when updating with filters." fi - - generate_templates - generate_bake_file } main "$@"