diff --git a/percona-server-mongodb-7.0/Dockerfile b/percona-server-mongodb-7.0/Dockerfile new file mode 100644 index 000000000..e455fa2eb --- /dev/null +++ b/percona-server-mongodb-7.0/Dockerfile @@ -0,0 +1,94 @@ +FROM oraclelinux:8 + +LABEL org.opencontainers.image.authors="info@percona.com" + +# check repository package signature in secure way +RUN set -ex; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A 99DB70FAE1D7CE227FB6488205B555B38483C65D 94E279EB8D8F25B21810ADF121EA45AB2F86D6A1; \ + gpg --batch --export --armor 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A > ${GNUPGHOME}/RPM-GPG-KEY-Percona; \ + gpg --batch --export --armor 99DB70FAE1D7CE227FB6488205B555B38483C65D > ${GNUPGHOME}/RPM-GPG-KEY-centosofficial; \ + gpg --batch --export --armor 94E279EB8D8F25B21810ADF121EA45AB2F86D6A1 > ${GNUPGHOME}/RPM-GPG-KEY-EPEL-8; \ + rpmkeys --import ${GNUPGHOME}/RPM-GPG-KEY-Percona ${GNUPGHOME}/RPM-GPG-KEY-centosofficial ${GNUPGHOME}/RPM-GPG-KEY-EPEL-8; \ + curl -Lf -o /tmp/percona-release.rpm https://repo.percona.com/yum/percona-release-latest.noarch.rpm; \ + rpmkeys --checksig /tmp/percona-release.rpm; \ + rpm -i /tmp/percona-release.rpm; \ + rm -rf "$GNUPGHOME" /tmp/percona-release.rpm; \ + rpm --import /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY + +ENV PSMDB_VERSION 7.0.2-1 +ENV OS_VER el8 +ENV FULL_PERCONA_VERSION "$PSMDB_VERSION.$OS_VER" +ENV K8S_TOOLS_VERSION "0.5.0" +ENV PSMDB_REPO release + +RUN set -ex; \ + percona-release enable psmdb-70 ${PSMDB_REPO}; \ + dnf config-manager --enable ol8_u4_security_validation; \ + dnf -y update openssh; \ + dnf -y install \ + percona-server-mongodb-mongos-${FULL_PERCONA_VERSION} \ + percona-server-mongodb-tools-${FULL_PERCONA_VERSION} \ + percona-mongodb-mongosh \ + procps-ng \ + jq \ + tar \ + oniguruma \ + cyrus-sasl-gssapi \ + policycoreutils; \ + \ + curl -Lf -o /tmp/Percona-Server-MongoDB-server.rpm http://repo.percona.com/psmdb-70/yum/${PSMDB_REPO}/8/RPMS/x86_64/percona-server-mongodb-server-${FULL_PERCONA_VERSION}.x86_64.rpm; \ + rpmkeys --checksig /tmp/Percona-Server-MongoDB-server.rpm; \ + rpm -iv /tmp/Percona-Server-MongoDB-server.rpm --nodeps; \ + rm -rf /tmp/Percona-Server-MongoDB-server.rpm; \ + dnf clean all; \ + rm -rf /var/cache/dnf /var/cache/yum /data/db && mkdir -p /data/db; \ + chown -R 1001:0 /data/db + +# the numeric UID is needed for OpenShift +RUN useradd -u 1001 -r -g 0 -m -s /sbin/nologin \ + -c "Default Application User" mongodb; \ + chmod g+rwx /var/log/mongo; \ + chown :0 /var/log/mongo + +COPY LICENSE /licenses/LICENSE.Dockerfile +RUN cp /usr/share/doc/percona-server-mongodb-server/LICENSE-Community.txt /licenses/LICENSE.Percona-Server-for-MongoDB + +ENV GOSU_VERSION=1.11 +RUN set -eux; \ + curl -Lf -o /usr/bin/gosu https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64; \ + curl -Lf -o /usr/bin/gosu.asc https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64.asc; \ + \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/bin/gosu.asc /usr/bin/gosu; \ + rm -rf "$GNUPGHOME" /usr/bin/gosu.asc; \ + \ + chmod +x /usr/bin/gosu; \ + curl -f -o /licenses/LICENSE.gosu https://raw.githubusercontent.com/tianon/gosu/${GOSU_VERSION}/LICENSE + +RUN set -ex; \ + curl -fSL https://github.com/percona/mongodb-orchestration-tools/releases/download/${K8S_TOOLS_VERSION}/k8s-mongodb-initiator -o /usr/local/bin/k8s-mongodb-initiator; \ + curl -fSL https://github.com/percona/mongodb-orchestration-tools/releases/download/${K8S_TOOLS_VERSION}/mongodb-healthcheck -o /usr/local/bin/mongodb-healthcheck; \ + curl -fSL https://github.com/percona/mongodb-orchestration-tools/releases/download/${K8S_TOOLS_VERSION}/SHA256SUMS -o /tmp/SHA256SUMS; \ + echo "$(grep 'k8s-mongodb-initiator' /tmp/SHA256SUMS | awk '{print $1}')" /usr/local/bin/k8s-mongodb-initiator | sha256sum -c -; \ + echo "$(grep 'mongodb-healthcheck' /tmp/SHA256SUMS | awk '{print $1}')" /usr/local/bin/mongodb-healthcheck | sha256sum -c -; \ + rm -f /tmp/SHA256SUMS; \ + \ + chmod 0755 /usr/local/bin/k8s-mongodb-initiator /usr/local/bin/mongodb-healthcheck + +VOLUME ["/data/db"] + +RUN set -ex; \ + curl -fSL https://cdnjs.cloudflare.com/ajax/libs/js-yaml/4.1.0/js-yaml.min.js -o /js-yaml.js; \ + echo "45dc3dd03dc07a06705a2c2989b8c7f709013f04bd5386e3279d4e447f07ebd7 /js-yaml.js" | sha256sum -c - + +COPY ps-entry.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] + +EXPOSE 27017 + +USER 1001 + +CMD ["mongod"] diff --git a/percona-server-mongodb-7.0/Dockerfile.aarch64 b/percona-server-mongodb-7.0/Dockerfile.aarch64 new file mode 100644 index 000000000..0c3ef4321 --- /dev/null +++ b/percona-server-mongodb-7.0/Dockerfile.aarch64 @@ -0,0 +1,105 @@ +FROM oraclelinux:8 + +LABEL org.opencontainers.image.authors="info@percona.com" + +# check repository package signature in secure way +RUN set -ex; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A 99DB70FAE1D7CE227FB6488205B555B38483C65D 94E279EB8D8F25B21810ADF121EA45AB2F86D6A1; \ + gpg --batch --export --armor 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A > ${GNUPGHOME}/RPM-GPG-KEY-Percona; \ + gpg --batch --export --armor 99DB70FAE1D7CE227FB6488205B555B38483C65D > ${GNUPGHOME}/RPM-GPG-KEY-centosofficial; \ + gpg --batch --export --armor 94E279EB8D8F25B21810ADF121EA45AB2F86D6A1 > ${GNUPGHOME}/RPM-GPG-KEY-EPEL-8; \ + rpmkeys --import ${GNUPGHOME}/RPM-GPG-KEY-Percona ${GNUPGHOME}/RPM-GPG-KEY-centosofficial ${GNUPGHOME}/RPM-GPG-KEY-EPEL-8; \ + curl -Lf -o /tmp/percona-release.rpm https://repo.percona.com/yum/percona-release-latest.noarch.rpm; \ + rpmkeys --checksig /tmp/percona-release.rpm; \ + rpm -i /tmp/percona-release.rpm; \ + rm -rf "$GNUPGHOME" /tmp/percona-release.rpm; \ + rpm --import /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY + +ENV PSMDB_VERSION 7.0.2-1 +ENV OS_VER el8 +ENV FULL_PERCONA_VERSION "$PSMDB_VERSION.$OS_VER" +ENV K8S_TOOLS_VERSION "0.5.0" +ENV PSMDB_REPO experimental + +RUN set -ex; \ + sed -i "s|x86_64|x86_64 aarch64|" /usr/bin/percona-release; \ + percona-release enable psmdb-70 ${PSMDB_REPO}; \ + dnf config-manager --enable ol8_u4_security_validation; \ + dnf -y update openssh; \ + dnf -y install \ + percona-server-mongodb-mongos-${FULL_PERCONA_VERSION} \ + percona-server-mongodb-tools-${FULL_PERCONA_VERSION} \ + percona-mongodb-mongosh \ + procps-ng \ + jq \ + tar \ + oniguruma \ + cyrus-sasl-gssapi \ + policycoreutils; \ + \ + ARCH="$(uname -m)"; \ + curl -Lf -o /tmp/Percona-Server-MongoDB-server.rpm http://repo.percona.com/psmdb-70/yum/${PSMDB_REPO}/8/RPMS/${ARCH}/percona-server-mongodb-server-${FULL_PERCONA_VERSION}.${ARCH}.rpm; \ + rpmkeys --checksig /tmp/Percona-Server-MongoDB-server.rpm; \ + rpm -iv /tmp/Percona-Server-MongoDB-server.rpm --nodeps; \ + rm -rf /tmp/Percona-Server-MongoDB-server.rpm; \ + dnf clean all; \ + rm -rf /var/cache/dnf /var/cache/yum /data/db && mkdir -p /data/db; \ + chown -R 1001:0 /data/db + +# the numeric UID is needed for OpenShift +RUN useradd -u 1001 -r -g 0 -m -s /sbin/nologin \ + -c "Default Application User" mongodb; \ + chmod g+rwx /var/log/mongo; \ + chown :0 /var/log/mongo + +COPY LICENSE /licenses/LICENSE.Dockerfile +RUN cp /usr/share/doc/percona-server-mongodb-server/LICENSE-Community.txt /licenses/LICENSE.Percona-Server-for-MongoDB + +ENV GOSU_VERSION=1.11 +RUN set -eux; \ + ARCH="$(uname -m)"; \ + case "${ARCH}" in \ + aarch64 ) \ + GOSU_ARCH="arm64"; \ + ;; \ + x86_64 ) \ + GOSU_ARCH="amd64"; \ + ;; \ + esac; \ + curl -Lf -o /usr/bin/gosu https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${GOSU_ARCH}; \ + curl -Lf -o /usr/bin/gosu.asc https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${GOSU_ARCH}.asc; \ + \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/bin/gosu.asc /usr/bin/gosu; \ + rm -rf "$GNUPGHOME" /usr/bin/gosu.asc; \ + \ + chmod +x /usr/bin/gosu; \ + curl -f -o /licenses/LICENSE.gosu https://raw.githubusercontent.com/tianon/gosu/${GOSU_VERSION}/LICENSE + +RUN set -ex; \ + curl -fSL https://github.com/percona/mongodb-orchestration-tools/releases/download/${K8S_TOOLS_VERSION}/k8s-mongodb-initiator -o /usr/local/bin/k8s-mongodb-initiator; \ + curl -fSL https://github.com/percona/mongodb-orchestration-tools/releases/download/${K8S_TOOLS_VERSION}/mongodb-healthcheck -o /usr/local/bin/mongodb-healthcheck; \ + curl -fSL https://github.com/percona/mongodb-orchestration-tools/releases/download/${K8S_TOOLS_VERSION}/SHA256SUMS -o /tmp/SHA256SUMS; \ + echo "$(grep 'k8s-mongodb-initiator' /tmp/SHA256SUMS | awk '{print $1}')" /usr/local/bin/k8s-mongodb-initiator | sha256sum -c -; \ + echo "$(grep 'mongodb-healthcheck' /tmp/SHA256SUMS | awk '{print $1}')" /usr/local/bin/mongodb-healthcheck | sha256sum -c -; \ + rm -f /tmp/SHA256SUMS; \ + \ + chmod 0755 /usr/local/bin/k8s-mongodb-initiator /usr/local/bin/mongodb-healthcheck + +VOLUME ["/data/db"] + +RUN set -ex; \ + curl -fSL https://cdnjs.cloudflare.com/ajax/libs/js-yaml/4.1.0/js-yaml.min.js -o /js-yaml.js; \ + echo "45dc3dd03dc07a06705a2c2989b8c7f709013f04bd5386e3279d4e447f07ebd7 /js-yaml.js" | sha256sum -c - + +COPY ps-entry.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] + +EXPOSE 27017 + +USER 1001 + +CMD ["mongod"] diff --git a/percona-server-mongodb-7.0/Dockerfile.debug b/percona-server-mongodb-7.0/Dockerfile.debug new file mode 100644 index 000000000..af6a32160 --- /dev/null +++ b/percona-server-mongodb-7.0/Dockerfile.debug @@ -0,0 +1,50 @@ +FROM percona/percona-server-mongodb:7.0 + +LABEL org.label-schema.schema-version="1.0" +LABEL org.label-schema.name="Percona Server for MongoDB" +LABEL org.label-schema.vendor="Percona" +LABEL org.label-schema.description="Percona Server for MongoDB is our free and \ +open-source drop-in replacement for MongoDB Community Edition. \ +It offers all the features and benefits of MongoDB Community Edition, \ +plus additional enterprise-grade functionality." +LABEL org.label-schema.license="SSPLv1" + +LABEL org.opencontainers.image.title="Percona Server for MongoDB" +LABEL org.opencontainers.image.vendor="Percona" +LABEL org.opencontainers.image.description="Percona Server for MongoDB is our free and \ +open-source drop-in replacement for MongoDB Community Edition. \ +It offers all the features and benefits of MongoDB Community Edition, \ +plus additional enterprise-grade functionality." +LABEL org.opencontainers.image.license="SSPLv1" +LABEL org.opencontainers.image.authors="info@percona.com" + +LABEL org.label-schema.schema-version=${PSMDB_VERSION} +LABEL org.opencontainers.image.version=${PSMDB_VERSION} + +USER 0 + +RUN set -ex; \ + sed -i 's/exec "$@"/exec "$@" -vvv || sleep infinity/' /entrypoint.sh; \ + dnf -y install \ + net-tools \ + gdb \ + nc \ + telnet \ + cyrus-sasl-gssapi \ + percona-server-mongodb-server-debuginfo-${FULL_PERCONA_VERSION} \ + percona-server-mongodb-tools-debuginfo-${FULL_PERCONA_VERSION} \ + percona-server-mongodb-mongos-debuginfo-${FULL_PERCONA_VERSION} \ + percona-server-mongodb-debugsource-${FULL_PERCONA_VERSION} \ + percona-server-mongodb-tools-${FULL_PERCONA_VERSION}; \ + dnf clean all; \ + rm -rf /var/cache/dnf /var/cache/yum + +VOLUME ["/data/db"] + +ENTRYPOINT ["/entrypoint.sh"] + +EXPOSE 27017 + +USER 1001 + +CMD ["mongod"] diff --git a/percona-server-mongodb-7.0/Dockerfile.k8s b/percona-server-mongodb-7.0/Dockerfile.k8s new file mode 100644 index 000000000..e47493e9e --- /dev/null +++ b/percona-server-mongodb-7.0/Dockerfile.k8s @@ -0,0 +1,141 @@ +FROM redhat/ubi8-minimal + +# Please don't remove old-style LABEL since it's needed for RedHat certification +LABEL name="Percona Server for MongoDB" \ + release="7.0" \ + vendor="Percona" \ + summary="Percona Server for MongoDB is our free and open-source drop-in replacement for MongoDB Community Edition" \ + description="Percona Server for MongoDB is our free and open-source drop-in replacement for MongoDB Community Edition. It offers all the features and benefits of MongoDB Community Edition, plus additional enterprise-grade functionality." \ + maintainer="Percona Development " +LABEL org.label-schema.license="SSPLv1" + +LABEL org.opencontainers.image.title="Percona Server for MongoDB" +LABEL org.opencontainers.image.vendor="Percona" +LABEL org.opencontainers.image.description="Percona Server for MongoDB is our free and \ +open-source drop-in replacement for MongoDB Community Edition. \ +It offers all the features and benefits of MongoDB Community Edition, \ +plus additional enterprise-grade functionality." +LABEL org.opencontainers.image.license="SSPLv1" +LABEL org.opencontainers.image.authors="info@percona.com" + +ENV PSMDB_VERSION 7.0.2-1 +ENV OS_VER el8 +ENV FULL_PERCONA_VERSION "$PSMDB_VERSION.$OS_VER" +ENV K8S_TOOLS_VERSION "0.5.0" +ENV PSMDB_REPO release +LABEL org.label-schema.schema-version=${PSMDB_VERSION} +LABEL org.opencontainers.image.version=${PSMDB_VERSION} + +# check repository package signature in secure way +RUN set -ex; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A 99DB70FAE1D7CE227FB6488205B555B38483C65D 94E279EB8D8F25B21810ADF121EA45AB2F86D6A1; \ + gpg --batch --export --armor 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A > ${GNUPGHOME}/RPM-GPG-KEY-Percona; \ + gpg --batch --export --armor 99DB70FAE1D7CE227FB6488205B555B38483C65D > ${GNUPGHOME}/RPM-GPG-KEY-centosofficial; \ + gpg --batch --export --armor 94E279EB8D8F25B21810ADF121EA45AB2F86D6A1 > ${GNUPGHOME}/RPM-GPG-KEY-EPEL-8; \ + rpmkeys --import ${GNUPGHOME}/RPM-GPG-KEY-Percona ${GNUPGHOME}/RPM-GPG-KEY-centosofficial ${GNUPGHOME}/RPM-GPG-KEY-EPEL-8; \ + microdnf install -y findutils; \ + curl -Lf -o /tmp/percona-release.rpm https://repo.percona.com/yum/percona-release-latest.noarch.rpm; \ + rpmkeys --checksig /tmp/percona-release.rpm; \ + rpm -i /tmp/percona-release.rpm; \ + rm -rf "$GNUPGHOME" /tmp/percona-release.rpm; \ + rpm --import /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY; \ + percona-release enable psmdb-70 ${PSMDB_REPO} + +RUN set -ex; \ + curl -Lf -o /tmp/jq.rpm http://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/jq-1.5-12.el8.x86_64.rpm; \ + curl -Lf -o /tmp/oniguruma.rpm http://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/oniguruma-6.8.2-2.el8.x86_64.rpm; \ + rpmkeys --checksig /tmp/jq.rpm /tmp/oniguruma.rpm; \ + \ + rpm -i /tmp/jq.rpm /tmp/oniguruma.rpm; \ + rm -rf /tmp/jq.rpm /tmp/oniguruma.rpm + +RUN set -ex; \ + microdnf install -y \ + percona-server-mongodb-mongos-${FULL_PERCONA_VERSION} \ + percona-server-mongodb-tools-${FULL_PERCONA_VERSION} \ + percona-mongodb-mongosh \ + shadow-utils \ + curl \ + tar \ + procps-ng \ + cyrus-sasl-gssapi \ + policycoreutils; \ + \ + curl -Lf -o /tmp/Percona-Server-MongoDB-server.rpm http://repo.percona.com/psmdb-70/yum/${PSMDB_REPO}/8/RPMS/x86_64/percona-server-mongodb-server-${FULL_PERCONA_VERSION}.x86_64.rpm; \ + rpmkeys --checksig /tmp/Percona-Server-MongoDB-server.rpm; \ + rpm -iv /tmp/Percona-Server-MongoDB-server.rpm --nodeps; \ + rm -rf /tmp/Percona-Server-MongoDB-server.rpm; \ + microdnf clean all; \ + rm -rf /var/cache/dnf /var/cache/yum /data/db && mkdir -p /data/db; \ + chown -R 1001:0 /data/db + +# the numeric UID is needed for OpenShift +RUN useradd -u 1001 -r -g 0 -m -s /sbin/nologin \ + -c "Default Application User" mongodb; \ + chmod g+rwx /var/log/mongo; \ + chown :0 /var/log/mongo + +COPY LICENSE /licenses/LICENSE.Dockerfile +RUN cp /usr/share/doc/percona-server-mongodb-server/LICENSE-Community.txt /licenses/LICENSE.Percona-Server-for-MongoDB + +ENV GOSU_VERSION=1.11 +RUN set -eux; \ + curl -Lf -o /usr/bin/gosu https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64; \ + curl -Lf -o /usr/bin/gosu.asc https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64.asc; \ + \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/bin/gosu.asc /usr/bin/gosu; \ + rm -rf "$GNUPGHOME" /usr/bin/gosu.asc; \ + \ + chmod +x /usr/bin/gosu; \ + curl -f -o /licenses/LICENSE.gosu https://raw.githubusercontent.com/tianon/gosu/${GOSU_VERSION}/LICENSE + +RUN set -ex; \ + curl -fSL https://github.com/percona/mongodb-orchestration-tools/releases/download/${K8S_TOOLS_VERSION}/k8s-mongodb-initiator -o /usr/local/bin/k8s-mongodb-initiator; \ + curl -fSL https://github.com/percona/mongodb-orchestration-tools/releases/download/${K8S_TOOLS_VERSION}/mongodb-healthcheck -o /usr/local/bin/mongodb-healthcheck; \ + curl -fSL https://github.com/percona/mongodb-orchestration-tools/releases/download/${K8S_TOOLS_VERSION}/SHA256SUMS -o /tmp/SHA256SUMS; \ + echo "$(grep 'k8s-mongodb-initiator' /tmp/SHA256SUMS | awk '{print $1}')" /usr/local/bin/k8s-mongodb-initiator | sha256sum -c -; \ + echo "$(grep 'mongodb-healthcheck' /tmp/SHA256SUMS | awk '{print $1}')" /usr/local/bin/mongodb-healthcheck | sha256sum -c -; \ + rm -f /tmp/SHA256SUMS; \ + \ + chmod 0755 /usr/local/bin/k8s-mongodb-initiator /usr/local/bin/mongodb-healthcheck + +VOLUME ["/data/db"] + +RUN set -ex; \ + curl -fSL https://cdnjs.cloudflare.com/ajax/libs/js-yaml/4.1.0/js-yaml.min.js -o /js-yaml.js; \ + echo "45dc3dd03dc07a06705a2c2989b8c7f709013f04bd5386e3279d4e447f07ebd7 /js-yaml.js" | sha256sum -c - + +COPY ps-entry.sh /entrypoint.sh + +ARG DEBUG +RUN if [[ -n $DEBUG ]] ; then \ + set -ex; \ + sed -i 's/exec "$@"/exec "$@" -vvv || sleep infinity/' /entrypoint.sh; \ + curl -Lf -o /tmp/telnet.rpm http://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/telnet-0.17-76.el8.x86_64.rpm; \ + rpm -i /tmp/telnet.rpm; \ + rm -f /tmp/telnet.rpm; \ + + microdnf install -y \ + net-tools \ + sudo \ + gdb \ + nc \ + percona-server-mongodb-server-debuginfo-${FULL_PERCONA_VERSION} \ + percona-server-mongodb-tools-debuginfo-${FULL_PERCONA_VERSION} \ + percona-server-mongodb-mongos-debuginfo-${FULL_PERCONA_VERSION} \ + percona-server-mongodb-tools-${FULL_PERCONA_VERSION} \ + percona-server-mongodb-debugsource-${FULL_PERCONA_VERSION}; \ + microdnf clean all; \ + rm -rf /var/cache/dnf /var/cache/yum; \ + fi + +ENTRYPOINT ["/entrypoint.sh"] + +EXPOSE 27017 + +USER 1001 + +CMD ["mongod"] diff --git a/percona-server-mongodb-7.0/Dockerfile.ubi8 b/percona-server-mongodb-7.0/Dockerfile.ubi8 new file mode 100644 index 000000000..82c5a5662 --- /dev/null +++ b/percona-server-mongodb-7.0/Dockerfile.ubi8 @@ -0,0 +1,99 @@ +FROM redhat/ubi8-minimal + +LABEL org.opencontainers.image.authors="info@percona.com" + +ENV PSMDB_VERSION 7.0.2-1 +ENV OS_VER el8 +ENV FULL_PERCONA_VERSION "$PSMDB_VERSION.$OS_VER" +ENV K8S_TOOLS_VERSION "0.5.0" +ENV PSMDB_REPO release + +# check repository package signature in secure way +RUN set -ex; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A 99DB70FAE1D7CE227FB6488205B555B38483C65D 94E279EB8D8F25B21810ADF121EA45AB2F86D6A1; \ + gpg --batch --export --armor 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A > ${GNUPGHOME}/RPM-GPG-KEY-Percona; \ + gpg --batch --export --armor 99DB70FAE1D7CE227FB6488205B555B38483C65D > ${GNUPGHOME}/RPM-GPG-KEY-centosofficial; \ + gpg --batch --export --armor 94E279EB8D8F25B21810ADF121EA45AB2F86D6A1 > ${GNUPGHOME}/RPM-GPG-KEY-EPEL-8; \ + rpmkeys --import ${GNUPGHOME}/RPM-GPG-KEY-Percona ${GNUPGHOME}/RPM-GPG-KEY-centosofficial ${GNUPGHOME}/RPM-GPG-KEY-EPEL-8; \ + microdnf install -y findutils; \ + curl -Lf -o /tmp/percona-release.rpm https://repo.percona.com/yum/percona-release-latest.noarch.rpm; \ + rpmkeys --checksig /tmp/percona-release.rpm; \ + rpm -i /tmp/percona-release.rpm; \ + rm -rf "$GNUPGHOME" /tmp/percona-release.rpm; \ + rpm --import /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY; \ + percona-release enable psmdb-70 ${PSMDB_REPO} + +RUN set -ex; \ + curl -Lf -o /tmp/jq.rpm http://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/jq-1.5-12.el8.x86_64.rpm; \ + curl -Lf -o /tmp/oniguruma.rpm http://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/oniguruma-6.8.2-2.el8.x86_64.rpm; \ + rpmkeys --checksig /tmp/jq.rpm /tmp/oniguruma.rpm; \ + rpm -i /tmp/jq.rpm /tmp/oniguruma.rpm; \ + rm -rf /tmp/jq.rpm /tmp/oniguruma.rpm + +RUN set -ex; \ + microdnf -y install \ + percona-server-mongodb-mongos-${FULL_PERCONA_VERSION} \ + percona-server-mongodb-tools-${FULL_PERCONA_VERSION} \ + percona-mongodb-mongosh \ + shadow-utils \ + procps-ng \ + tar \ + cyrus-sasl-gssapi \ + policycoreutils; \ + \ + curl -Lf -o /tmp/Percona-Server-MongoDB-server.rpm http://repo.percona.com/psmdb-70/yum/${PSMDB_REPO}/8/RPMS/x86_64/percona-server-mongodb-server-${FULL_PERCONA_VERSION}.x86_64.rpm; \ + rpmkeys --checksig /tmp/Percona-Server-MongoDB-server.rpm; \ + rpm -iv /tmp/Percona-Server-MongoDB-server.rpm --nodeps; \ + rm -rf /tmp/Percona-Server-MongoDB-server.rpm; \ + microdnf clean all; \ + rm -rf /var/cache/dnf /var/cache/yum /data/db && mkdir -p /data/db; \ + chown -R 1001:0 /data/db + +# the numeric UID is needed for OpenShift +RUN useradd -u 1001 -r -g 0 -m -s /sbin/nologin \ + -c "Default Application User" mongodb; \ + chmod g+rwx /var/log/mongo; \ + chown :0 /var/log/mongo + +COPY LICENSE /licenses/LICENSE.Dockerfile +RUN cp /usr/share/doc/percona-server-mongodb-server/LICENSE-Community.txt /licenses/LICENSE.Percona-Server-for-MongoDB + +ENV GOSU_VERSION=1.11 +RUN set -eux; \ + curl -Lf -o /usr/bin/gosu https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64; \ + curl -Lf -o /usr/bin/gosu.asc https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64.asc; \ + \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/bin/gosu.asc /usr/bin/gosu; \ + rm -rf "$GNUPGHOME" /usr/bin/gosu.asc; \ + \ + chmod +x /usr/bin/gosu; \ + curl -f -o /licenses/LICENSE.gosu https://raw.githubusercontent.com/tianon/gosu/${GOSU_VERSION}/LICENSE + +RUN set -ex; \ + curl -fSL https://github.com/percona/mongodb-orchestration-tools/releases/download/${K8S_TOOLS_VERSION}/k8s-mongodb-initiator -o /usr/local/bin/k8s-mongodb-initiator; \ + curl -fSL https://github.com/percona/mongodb-orchestration-tools/releases/download/${K8S_TOOLS_VERSION}/mongodb-healthcheck -o /usr/local/bin/mongodb-healthcheck; \ + curl -fSL https://github.com/percona/mongodb-orchestration-tools/releases/download/${K8S_TOOLS_VERSION}/SHA256SUMS -o /tmp/SHA256SUMS; \ + echo "$(grep 'k8s-mongodb-initiator' /tmp/SHA256SUMS | awk '{print $1}')" /usr/local/bin/k8s-mongodb-initiator | sha256sum -c -; \ + echo "$(grep 'mongodb-healthcheck' /tmp/SHA256SUMS | awk '{print $1}')" /usr/local/bin/mongodb-healthcheck | sha256sum -c -; \ + rm -f /tmp/SHA256SUMS; \ + \ + chmod 0755 /usr/local/bin/k8s-mongodb-initiator /usr/local/bin/mongodb-healthcheck + +VOLUME ["/data/db"] + +RUN set -ex; \ + curl -fSL https://cdnjs.cloudflare.com/ajax/libs/js-yaml/4.1.0/js-yaml.min.js -o /js-yaml.js; \ + echo "45dc3dd03dc07a06705a2c2989b8c7f709013f04bd5386e3279d4e447f07ebd7 /js-yaml.js" | sha256sum -c - + +COPY ps-entry.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] + +EXPOSE 27017 + +USER 1001 + +CMD ["mongod"] diff --git a/percona-server-mongodb-7.0/Dockerfile.ubi9 b/percona-server-mongodb-7.0/Dockerfile.ubi9 new file mode 100644 index 000000000..95ded5f91 --- /dev/null +++ b/percona-server-mongodb-7.0/Dockerfile.ubi9 @@ -0,0 +1,95 @@ +FROM redhat/ubi9-minimal + +LABEL org.opencontainers.image.authors="info@percona.com" + +ENV PSMDB_VERSION 7.0.2-1 +ENV OS_VER el9 +ENV FULL_PERCONA_VERSION "$PSMDB_VERSION.$OS_VER" +ENV K8S_TOOLS_VERSION "0.5.0" +ENV PSMDB_REPO release + +# check repository package signature in secure way +RUN set -ex; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A 99DB70FAE1D7CE227FB6488205B555B38483C65D 94E279EB8D8F25B21810ADF121EA45AB2F86D6A1; \ + gpg --batch --export --armor 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A > ${GNUPGHOME}/RPM-GPG-KEY-Percona; \ + gpg --batch --export --armor 99DB70FAE1D7CE227FB6488205B555B38483C65D > ${GNUPGHOME}/RPM-GPG-KEY-centosofficial; \ + gpg --batch --export --armor 94E279EB8D8F25B21810ADF121EA45AB2F86D6A1 > ${GNUPGHOME}/RPM-GPG-KEY-EPEL-8; \ + rpmkeys --import ${GNUPGHOME}/RPM-GPG-KEY-Percona ${GNUPGHOME}/RPM-GPG-KEY-centosofficial ${GNUPGHOME}/RPM-GPG-KEY-EPEL-8; \ + microdnf install -y findutils; \ + curl -Lf -o /tmp/percona-release.rpm https://repo.percona.com/yum/percona-release-latest.noarch.rpm; \ + rpmkeys --checksig /tmp/percona-release.rpm; \ + rpm -i /tmp/percona-release.rpm; \ + rm -rf "$GNUPGHOME" /tmp/percona-release.rpm; \ + rpm --import /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY; \ + percona-release enable psmdb-70 ${PSMDB_REPO} + +RUN set -ex; \ + microdnf install -y jq + +RUN set -ex; \ + microdnf -y install \ + percona-server-mongodb-mongos-${FULL_PERCONA_VERSION} \ + percona-server-mongodb-tools-${FULL_PERCONA_VERSION} \ + percona-mongodb-mongosh \ + shadow-utils \ + procps-ng \ + tar \ + cyrus-sasl-gssapi \ + policycoreutils; \ + \ + curl -Lf -o /tmp/Percona-Server-MongoDB-server.rpm http://repo.percona.com/psmdb-70/yum/${PSMDB_REPO}/9/RPMS/x86_64/percona-server-mongodb-server-${FULL_PERCONA_VERSION}.x86_64.rpm; \ + rpmkeys --checksig /tmp/Percona-Server-MongoDB-server.rpm; \ + rpm -iv /tmp/Percona-Server-MongoDB-server.rpm --nodeps; \ + rm -rf /tmp/Percona-Server-MongoDB-server.rpm; \ + microdnf clean all; \ + rm -rf /var/cache/dnf /var/cache/yum /data/db && mkdir -p /data/db; \ + chown -R 1001:0 /data/db + +# the numeric UID is needed for OpenShift +RUN useradd -u 1001 -r -g 0 -m -s /sbin/nologin \ + -c "Default Application User" mongodb; \ + chmod g+rwx /var/log/mongo; \ + chown :0 /var/log/mongo + +COPY LICENSE /licenses/LICENSE.Dockerfile +RUN cp /usr/share/doc/percona-server-mongodb-server/LICENSE-Community.txt /licenses/LICENSE.Percona-Server-for-MongoDB + +ENV GOSU_VERSION=1.11 +RUN set -eux; \ + curl -Lf -o /usr/bin/gosu https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64; \ + curl -Lf -o /usr/bin/gosu.asc https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64.asc; \ + \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/bin/gosu.asc /usr/bin/gosu; \ + rm -rf "$GNUPGHOME" /usr/bin/gosu.asc; \ + \ + chmod +x /usr/bin/gosu; \ + curl -f -o /licenses/LICENSE.gosu https://raw.githubusercontent.com/tianon/gosu/${GOSU_VERSION}/LICENSE + +RUN set -ex; \ + curl -fSL https://github.com/percona/mongodb-orchestration-tools/releases/download/${K8S_TOOLS_VERSION}/k8s-mongodb-initiator -o /usr/local/bin/k8s-mongodb-initiator; \ + curl -fSL https://github.com/percona/mongodb-orchestration-tools/releases/download/${K8S_TOOLS_VERSION}/mongodb-healthcheck -o /usr/local/bin/mongodb-healthcheck; \ + curl -fSL https://github.com/percona/mongodb-orchestration-tools/releases/download/${K8S_TOOLS_VERSION}/SHA256SUMS -o /tmp/SHA256SUMS; \ + echo "$(grep 'k8s-mongodb-initiator' /tmp/SHA256SUMS | awk '{print $1}')" /usr/local/bin/k8s-mongodb-initiator | sha256sum -c -; \ + echo "$(grep 'mongodb-healthcheck' /tmp/SHA256SUMS | awk '{print $1}')" /usr/local/bin/mongodb-healthcheck | sha256sum -c -; \ + rm -f /tmp/SHA256SUMS; \ + \ + chmod 0755 /usr/local/bin/k8s-mongodb-initiator /usr/local/bin/mongodb-healthcheck + +VOLUME ["/data/db"] + +RUN set -ex; \ + curl -fSL https://cdnjs.cloudflare.com/ajax/libs/js-yaml/4.1.0/js-yaml.min.js -o /js-yaml.js; \ + echo "45dc3dd03dc07a06705a2c2989b8c7f709013f04bd5386e3279d4e447f07ebd7 /js-yaml.js" | sha256sum -c - + +COPY ps-entry.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] + +EXPOSE 27017 + +USER 1001 + +CMD ["mongod"] diff --git a/percona-server-mongodb-7.0/LICENSE b/percona-server-mongodb-7.0/LICENSE new file mode 100644 index 000000000..b5a2afb6b --- /dev/null +++ b/percona-server-mongodb-7.0/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2010-2018 Percona LLC + + 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/percona-server-mongodb-7.0/README-build.md b/percona-server-mongodb-7.0/README-build.md new file mode 100644 index 000000000..0a682500d --- /dev/null +++ b/percona-server-mongodb-7.0/README-build.md @@ -0,0 +1,12 @@ + +Build image + + `docker build -t percona-server-mongodb .` + +Tag image + + `docker tag percona/percona-server-mongodb:7.0` + +Push to hub + + `docker push percona/percona-server-mongodb:7.0` diff --git a/percona-server-mongodb-7.0/README.md b/percona-server-mongodb-7.0/README.md new file mode 100644 index 000000000..beae83642 --- /dev/null +++ b/percona-server-mongodb-7.0/README.md @@ -0,0 +1,81 @@ +![logo](https://www.percona.com/sites/all/themes/percona2015/images/product-logos/server-mongoDB-big.png) + +# What is Percona Server for MongoDB? + +Percona Server for MongoDB® is a free, enhanced, fully compatible, open source, drop-in replacement for the MongoDB® Community Edition that includes enterprise-grade features and functionality. + +For more information and related downloads for Percona Server and other Percona products, please visit http://www.percona.com. + +# Percona Server for MongoDB Docker Images + +These are the only official Percona Server for MongoDB Docker images, created and maintained by the Percona team. The image has the Percona Fractal Tree based storage engine `PerconaFT` and `WiredTiger` enabled. The available versions are: + + Percona Server for MontoDB 7.0.0 (tag: 7.0) + +Images are updated when new releases are published. + +# How to Use the Images + +## Start a Percona Server for MongoDB Instance + +Start a Percona Server for MongoDB container as follows: + + docker run --name container-name -d percona/percona-server-mongodb:tag + +Where `container-name` is the name you want to assign to your container and `tag` is the tag specifying the version you want. See the list above for relevant tags, or look at the [full list of tags](https://hub.docker.com/r/percona/percona-server-mongodb/tags/). + +## Connect to Percona Server from an Application in Another Docker Container + +This image exposes the standard MongoDB port (27017), so container linking makes the instance available to other containers. Start other containers like this in order to link it to the Percona Server for MongoDB container: + + docker run --name app-container-name --link container-name -d app-that-uses-mongodb + +## Connect to Percona Server for MongoDB from the MongoDB Command Line Client + +The following command starts another container instance and runs the `mongo` command line client against your original container, allowing you to execute SQL statements against your database: + + docker run -it --link container-name --rm percona/percona-server-mongodb:tag mongo -h container-name + +where `container-name` is the name of your database container. + + +# Notes, Tips, Gotchas + +## Where to Store Data + +There are many two ways to store data used by applications that run in Docker containers. We maintain our usual stance and encourage users to investigate the options and use the method that best suits their use case. Here are some of the options available: + +* Let Docker manage the storage of your database data by writing the database files to disk on the host system using its own internal volume management. The current solutions, devicemapper, aufs and overlayfs have negative performance records. +* Create a data directory on the host system (outside the container on high performance storage) and mount this to a directory visible from inside the container. This places the database files in a known location on the host system, and makes it easy for tools and applications on the host system to access the files. The user needs to make sure that the directory exists, and that permissions and other security mechanisms on the host system are set up correctly. + +The Docker documentation is a good starting point for understanding the different storage options and variations, and there are multiple blog and forum postings that discuss and give advice in this area. We will simply show the basic procedure here for the latter option above: + +1. Create a data directory on a suitable volume on your host system, e.g. `/local/datadir`. +2. Start your container like this: + +``` + docker run --name container-name -v /local/datadir:/data/db -d percona/percona-server-mongodb:tag +``` + +The `-v /local/datadir:/data/db` part of the command mounts the `/local/datadir` directory from the underlying host system as `/data/db` inside the container, where MongoDB by default will write its data files. + +## Port forwarding + +Docker allows mapping of ports on the container to ports on the host system by using the -p option. If you start the container as follows, you can connect to the database by connecting your client to a port on the host machine. This can greatly simplfy consolidating many instances to a single host. In this example port 6603, the we use the address of the Docker host to connect to the TCP port the Docker deamon is forwarding from: + + docker run --name container-name `-p 6603:27017` -d percona/percona-server-mongodb + mongo docker_host_ip:6603 + +## Passing options to the server + +You can pass arbitrary command line options to the MySQL server by appending them to the `run command`: + + docker run --name my-container-name -d percona/percona-server-mongodb --option1=value --option2=value + +# Supported Docker Versions + +These images are officially supported by the MySQL team on Docker version 1.9. Support for older versions (down to 1.0) is provided on a best-effort basis, but we strongly recommend running on the most recent version, since that is assumed for parts of the documentation above. + +# User Feedback + +We welcome your feedback! diff --git a/percona-server-mongodb-7.0/ps-entry.sh b/percona-server-mongodb-7.0/ps-entry.sh new file mode 100755 index 000000000..29c2765b2 --- /dev/null +++ b/percona-server-mongodb-7.0/ps-entry.sh @@ -0,0 +1,464 @@ +#!/bin/bash +set -Eeuo pipefail + +if [ "${1:0:1}" = '-' ]; then + set -- mongod "$@" +fi + +originalArgOne="$1" + +# allow the container to be started with `--user` +# all mongo* commands should be dropped to the correct user +if [[ "$originalArgOne" == mongo* ]] && [ "$(id -u)" = '0' ]; then + if [ "$originalArgOne" = 'mongod' ]; then + if [ -d "/data/configdb" ]; then + find /data/configdb \! -user mongodb -exec chown mongodb '{}' + + fi + if [ -d "/data/db" ]; then + find /data/db \! -user mongodb -exec chown mongodb '{}' + + fi + fi + + # make sure we can write to stdout and stderr as "mongodb" + # (for our "initdb" code later; see "--logpath" below) + chown --dereference mongodb "/proc/$$/fd/1" "/proc/$$/fd/2" || : + # ignore errors thanks to https://github.com/docker-library/mongo/issues/149 + + exec gosu mongodb:1001 "$BASH_SOURCE" "$@" +fi + +# you should use numactl to start your mongod instances, including the config servers, mongos instances, and any clients. +# https://docs.mongodb.com/manual/administration/production-notes/#configuring-numa-on-linux +if [[ "$originalArgOne" == mongo* ]]; then + numa='numactl --interleave=all' + if $numa true &> /dev/null; then + set -- $numa "$@" + fi +fi + +# usage: file_env VAR [DEFAULT] +# ie: file_env 'XYZ_DB_PASSWORD' 'example' +# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of +# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) +file_env() { + local var="$1" + local fileVar="${var}_FILE" + local def="${2:-}" + if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then + echo >&2 "error: both $var and $fileVar are set (but are exclusive)" + exit 1 + fi + local val="$def" + if [ "${!var:-}" ]; then + val="${!var}" + elif [ "${!fileVar:-}" ]; then + val="$(< "${!fileVar}")" + fi + export "$var"="$val" + unset "$fileVar" +} + +# see https://github.com/docker-library/mongo/issues/147 (mongod is picky about duplicated arguments) +_mongod_hack_have_arg() { + local checkArg="$1"; shift + local arg + for arg; do + case "$arg" in + "$checkArg"|"$checkArg"=*) + return 0 + ;; + esac + done + return 1 +} +# _mongod_hack_get_arg_val '--some-arg' "$@" +_mongod_hack_get_arg_val() { + local checkArg="$1"; shift + while [ "$#" -gt 0 ]; do + local arg="$1"; shift + case "$arg" in + "$checkArg") + echo "$1" + return 0 + ;; + "$checkArg"=*) + echo "${arg#$checkArg=}" + return 0 + ;; + esac + done + return 1 +} +declare -a mongodHackedArgs +# _mongod_hack_ensure_arg '--some-arg' "$@" +# set -- "${mongodHackedArgs[@]}" +_mongod_hack_ensure_arg() { + local ensureArg="$1"; shift + mongodHackedArgs=( "$@" ) + if ! _mongod_hack_have_arg "$ensureArg" "$@"; then + mongodHackedArgs+=( "$ensureArg" ) + fi +} +# _mongod_hack_ensure_no_arg '--some-unwanted-arg' "$@" +# set -- "${mongodHackedArgs[@]}" +_mongod_hack_ensure_no_arg() { + local ensureNoArg="$1"; shift + mongodHackedArgs=() + while [ "$#" -gt 0 ]; do + local arg="$1"; shift + if [ "$arg" = "$ensureNoArg" ]; then + continue + fi + mongodHackedArgs+=( "$arg" ) + done +} +# _mongod_hack_ensure_no_arg '--some-unwanted-arg' "$@" +# set -- "${mongodHackedArgs[@]}" +_mongod_hack_ensure_no_arg_val() { + local ensureNoArg="$1"; shift + mongodHackedArgs=() + while [ "$#" -gt 0 ]; do + local arg="$1"; shift + case "$arg" in + "$ensureNoArg") + shift # also skip the value + continue + ;; + "$ensureNoArg"=*) + # value is already included + continue + ;; + esac + mongodHackedArgs+=( "$arg" ) + done +} +# _mongod_hack_ensure_arg_val '--some-arg' 'some-val' "$@" +# set -- "${mongodHackedArgs[@]}" +_mongod_hack_ensure_arg_val() { + local ensureArg="$1"; shift + local ensureVal="$1"; shift + _mongod_hack_ensure_no_arg_val "$ensureArg" "$@" + mongodHackedArgs+=( "$ensureArg" "$ensureVal" ) +} + +# required by mongodb 4.2 +# _mongod_hack_rename_arg_save_val '--arg-to-rename' '--arg-to-rename-to' "$@" +# set -- "${mongodHackedArgs[@]}" +_mongod_hack_rename_arg_save_val() { + local oldArg="$1"; shift + local newArg="$1"; shift + if ! _mongod_hack_have_arg "$oldArg" "$@"; then + return 0 + fi + local val="" + mongodHackedArgs=() + while [ "$#" -gt 0 ]; do + local arg="$1"; shift + if [ "$arg" = "$oldArg" ]; then + val="$1"; shift + continue + elif [[ "$arg" =~ "$oldArg"=(.*) ]]; then + val=${BASH_REMATCH[1]} + continue + fi + mongodHackedArgs+=("$arg") + done + mongodHackedArgs+=("$newArg" "$val") +} + +# required by mongodb 4.2 +# _mongod_hack_rename_arg'--arg-to-rename' '--arg-to-rename-to' "$@" +# set -- "${mongodHackedArgs[@]}" +_mongod_hack_rename_arg() { + local oldArg="$1"; shift + local newArg="$1"; shift + if _mongod_hack_have_arg "$oldArg" "$@"; then + _mongod_hack_ensure_no_arg "$oldArg" "$@" + _mongod_hack_ensure_arg "$newArg" "${mongodHackedArgs[@]}" + fi +} + +# _js_escape 'some "string" value' +_js_escape() { + jq --null-input --arg 'str' "$1" '$str' +} + +jsonConfigFile="${TMPDIR:-/tmp}/docker-entrypoint-config.json" +tempConfigFile="${TMPDIR:-/tmp}/docker-entrypoint-temp-config.json" +_parse_config() { + if [ -s "$tempConfigFile" ]; then + return 0 + fi + + local configPath + if configPath="$(_mongod_hack_get_arg_val --config "$@")"; then + # if --config is specified, parse it into a JSON file so we can remove a few problematic keys (especially SSL-related keys) + # see https://docs.mongodb.com/manual/reference/configuration-options/ + mongosh --norc --nodb --quiet --eval "load('/js-yaml.js'); printjson(jsyaml.load(cat($(_js_escape "$configPath"))))" > "$jsonConfigFile" + jq 'del(.systemLog, .processManagement, .net, .security)' "$jsonConfigFile" > "$tempConfigFile" + return 0 + fi + + return 1 +} +dbPath= +_dbPath() { + if [ -n "$dbPath" ]; then + echo "$dbPath" + return + fi + + if ! dbPath="$(_mongod_hack_get_arg_val --dbpath "$@")"; then + if _parse_config "$@"; then + dbPath="$(jq -r '.storage.dbPath // empty' "$jsonConfigFile")" + fi + fi + + : "${dbPath:=/data/db}" + + echo "$dbPath" +} + +if [ "$originalArgOne" = 'mongod' ]; then + file_env 'MONGO_INITDB_ROOT_USERNAME' + file_env 'MONGO_INITDB_ROOT_PASSWORD' + # pre-check a few factors to see if it's even worth bothering with initdb + shouldPerformInitdb= + if [ "$MONGO_INITDB_ROOT_USERNAME" ] && [ "$MONGO_INITDB_ROOT_PASSWORD" ]; then + # if we have a username/password, let's set "--auth" + _mongod_hack_ensure_arg '--auth' "$@" + set -- "${mongodHackedArgs[@]}" + shouldPerformInitdb='true' + elif [ "$MONGO_INITDB_ROOT_USERNAME" ] || [ "$MONGO_INITDB_ROOT_PASSWORD" ]; then + cat >&2 <<-'EOF' + + error: missing 'MONGO_INITDB_ROOT_USERNAME' or 'MONGO_INITDB_ROOT_PASSWORD' + both must be specified for a user to be created + + EOF + exit 1 + fi + + if [ -z "$shouldPerformInitdb" ]; then + # if we've got any /docker-entrypoint-initdb.d/* files to parse later, we should initdb + for f in /docker-entrypoint-initdb.d/*; do + case "$f" in + *.sh|*.js) # this should match the set of files we check for below + shouldPerformInitdb="$f" + break + ;; + esac + done + fi + + # check for a few known paths (to determine whether we've already initialized and should thus skip our initdb scripts) + if [ -n "$shouldPerformInitdb" ]; then + dbPath="$(_dbPath "$@")" + for path in \ + "$dbPath/WiredTiger" \ + "$dbPath/journal" \ + "$dbPath/local.0" \ + "$dbPath/storage.bson" \ + ; do + if [ -e "$path" ]; then + shouldPerformInitdb= + break + fi + done + fi + + if [ -n "$shouldPerformInitdb" ]; then + mongodHackedArgs=( "$@" ) + if _parse_config "$@"; then + _mongod_hack_ensure_arg_val --config "$tempConfigFile" "${mongodHackedArgs[@]}" + fi + _mongod_hack_ensure_arg_val --bind_ip 127.0.0.1 "${mongodHackedArgs[@]}" + _mongod_hack_ensure_arg_val --port 27017 "${mongodHackedArgs[@]}" + _mongod_hack_ensure_no_arg --bind_ip_all "${mongodHackedArgs[@]}" + + # remove "--auth" and "--replSet" for our initial startup (see https://docs.mongodb.com/manual/tutorial/enable-authentication/#start-mongodb-without-access-control) + # https://github.com/docker-library/mongo/issues/211 + _mongod_hack_ensure_no_arg --auth "${mongodHackedArgs[@]}" + if [ "$MONGO_INITDB_ROOT_USERNAME" ] && [ "$MONGO_INITDB_ROOT_PASSWORD" ]; then + _mongod_hack_ensure_no_arg_val --replSet "${mongodHackedArgs[@]}" + fi + + # "BadValue: need sslPEMKeyFile when SSL is enabled" vs "BadValue: need to enable SSL via the sslMode flag when using SSL configuration parameters" + tlsMode='disabled' + if _mongod_hack_have_arg '--tlsCertificateKeyFile' "${mongodHackedArgs[@]}"; then + tlsMode='preferTLS' + elif _mongod_hack_have_arg '--sslPEMKeyFile' "${mongodHackedArgs[@]}"; then + tlsMode='preferSSL' + fi + # 4.2 switched all configuration/flag names from "SSL" to "TLS" + if [ "$tlsMode" = 'preferTLS' ] || mongod --help 2>&1 | grep -q -- ' --tlsMode '; then + _mongod_hack_ensure_arg_val --tlsMode "$tlsMode" "${mongodHackedArgs[@]}" + else + _mongod_hack_ensure_arg_val --sslMode "$tlsMode" "${mongodHackedArgs[@]}" + fi + + if stat "/proc/$$/fd/1" > /dev/null && [ -w "/proc/$$/fd/1" ]; then + # https://github.com/mongodb/mongo/blob/38c0eb538d0fd390c6cb9ce9ae9894153f6e8ef5/src/mongo/db/initialize_server_global_state.cpp#L237-L251 + # https://github.com/docker-library/mongo/issues/164#issuecomment-293965668 + _mongod_hack_ensure_arg_val --logpath "/proc/$$/fd/1" "${mongodHackedArgs[@]}" + else + initdbLogPath="$(_dbPath "$@")/docker-initdb.log" + echo >&2 "warning: initdb logs cannot write to '/proc/$$/fd/1', so they are in '$initdbLogPath' instead" + _mongod_hack_ensure_arg_val --logpath "$initdbLogPath" "${mongodHackedArgs[@]}" + fi + _mongod_hack_ensure_arg --logappend "${mongodHackedArgs[@]}" + + pidfile="${TMPDIR:-/tmp}/docker-entrypoint-temp-mongod.pid" + rm -f "$pidfile" + _mongod_hack_ensure_arg_val --pidfilepath "$pidfile" "${mongodHackedArgs[@]}" + + "${mongodHackedArgs[@]}" --fork + + mongo=( mongosh --host 127.0.0.1 --port 27017 --quiet ) + + # check to see that our "mongod" actually did start up (catches "--help", "--version", MongoDB 3.2 being silly, slow prealloc, etc) + # https://jira.mongodb.org/browse/SERVER-16292 + tries=30 + while true; do + if ! { [ -s "$pidfile" ] && ps "$(< "$pidfile")" &> /dev/null; }; then + # bail ASAP if "mongod" isn't even running + echo >&2 + echo >&2 "error: $originalArgOne does not appear to have stayed running -- perhaps it had an error?" + echo >&2 + exit 1 + fi + if "${mongo[@]}" 'admin' --eval 'quit(0)' &> /dev/null; then + # success! + break + fi + (( tries-- )) + if [ "$tries" -le 0 ]; then + echo >&2 + echo >&2 "error: $originalArgOne does not appear to have accepted connections quickly enough -- perhaps it had an error?" + echo >&2 + exit 1 + fi + sleep 1 + done + + if [ "$MONGO_INITDB_ROOT_USERNAME" ] && [ "$MONGO_INITDB_ROOT_PASSWORD" ]; then + rootAuthDatabase='admin' + + "${mongo[@]}" "$rootAuthDatabase" <<-EOJS + db.createUser({ + user: $(_js_escape "$MONGO_INITDB_ROOT_USERNAME"), + pwd: $(_js_escape "$MONGO_INITDB_ROOT_PASSWORD"), + roles: [ { role: 'root', db: $(_js_escape "$rootAuthDatabase") } ] + }) + EOJS + fi + + export MONGO_INITDB_DATABASE="${MONGO_INITDB_DATABASE:-test}" + + echo + for f in /docker-entrypoint-initdb.d/*; do + case "$f" in + *.sh) echo "$0: running $f"; . "$f" ;; + *.js) echo "$0: running $f"; "${mongo[@]}" "$MONGO_INITDB_DATABASE" "$f"; echo ;; + *) echo "$0: ignoring $f" ;; + esac + echo + done + + "${mongodHackedArgs[@]}" --shutdown + rm -f "$pidfile" + + echo + echo 'MongoDB init process complete; ready for start up.' + echo + fi + + mongodHackedArgs=("$@") + MONGO_SSL_DIR=${MONGO_SSL_DIR:-/etc/mongodb-ssl} + CA=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt + if [ -f /var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt ]; then + CA=/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt + fi + if [ -f "${MONGO_SSL_DIR}/ca.crt" ]; then + CA="${MONGO_SSL_DIR}/ca.crt" + fi + if [ -f "${MONGO_SSL_DIR}/tls.key" ] && [ -f "${MONGO_SSL_DIR}/tls.crt" ]; then + cat "${MONGO_SSL_DIR}/tls.key" "${MONGO_SSL_DIR}/tls.crt" >/tmp/tls.pem + _mongod_hack_ensure_arg_val --sslPEMKeyFile /tmp/tls.pem "${mongodHackedArgs[@]}" + if [ -f "${CA}" ]; then + _mongod_hack_ensure_arg_val --sslCAFile "${CA}" "${mongodHackedArgs[@]}" + fi + fi + MONGO_SSL_INTERNAL_DIR=${MONGO_SSL_INTERNAL_DIR:-/etc/mongodb-ssl-internal} + if [ -f "${MONGO_SSL_INTERNAL_DIR}/tls.key" ] && [ -f "${MONGO_SSL_INTERNAL_DIR}/tls.crt" ]; then + cat "${MONGO_SSL_INTERNAL_DIR}/tls.key" "${MONGO_SSL_INTERNAL_DIR}/tls.crt" >/tmp/tls-internal.pem + _mongod_hack_ensure_arg_val --sslClusterFile /tmp/tls-internal.pem "${mongodHackedArgs[@]}" + if [ -f "${MONGO_SSL_INTERNAL_DIR}/ca.crt" ]; then + _mongod_hack_ensure_arg_val --sslClusterCAFile "${MONGO_SSL_INTERNAL_DIR}/ca.crt" "${mongodHackedArgs[@]}" + fi + fi + + MONGODB_VERSION=$(mongod --version | head -1 | awk '{print $3}' | awk -F'.' '{print $1"."$2}') + if [ "$MONGODB_VERSION" == 'v4.2' ] || [ "$MONGODB_VERSION" == 'v4.4' ] || [ "$MONGODB_VERSION" == 'v5.0' ] || [ "$MONGODB_VERSION" == 'v6.0' ] || [ "$MONGODB_VERSION" == 'v7.0' ]; then + _mongod_hack_rename_arg_save_val --sslMode --tlsMode "${mongodHackedArgs[@]}" + + if _mongod_hack_have_arg '--tlsMode' "${mongodHackedArgs[@]}"; then + tlsMode="none" + if _mongod_hack_have_arg 'allowSSL' "${mongodHackedArgs[@]}"; then + tlsMode='allowTLS' + elif _mongod_hack_have_arg 'preferSSL' "${mongodHackedArgs[@]}"; then + tlsMode='preferTLS' + elif _mongod_hack_have_arg 'requireSSL' "${mongodHackedArgs[@]}"; then + tlsMode='requireTLS' + fi + + if [ "$tlsMode" != "none" ]; then + _mongod_hack_ensure_no_arg_val --tlsMode "${mongodHackedArgs[@]}" + _mongod_hack_ensure_arg_val --tlsMode "$tlsMode" "${mongodHackedArgs[@]}" + fi + fi + + _mongod_hack_rename_arg_save_val --sslPEMKeyFile --tlsCertificateKeyFile "${mongodHackedArgs[@]}" + if ! _mongod_hack_have_arg '--tlsMode' "${mongodHackedArgs[@]}"; then + if _mongod_hack_have_arg '--tlsCertificateKeyFile' "${mongodHackedArgs[@]}"; then + _mongod_hack_ensure_arg_val --tlsMode "preferTLS" "${mongodHackedArgs[@]}" + fi + fi + _mongod_hack_rename_arg '--sslAllowInvalidCertificates' '--tlsAllowInvalidCertificates' "${mongodHackedArgs[@]}" + _mongod_hack_rename_arg '--sslAllowInvalidHostnames' '--tlsAllowInvalidHostnames' "${mongodHackedArgs[@]}" + _mongod_hack_rename_arg '--sslAllowConnectionsWithoutCertificates' '--tlsAllowConnectionsWithoutCertificates' "${mongodHackedArgs[@]}" + _mongod_hack_rename_arg '--sslFIPSMode' '--tlsFIPSMode' "${mongodHackedArgs[@]}" + + + _mongod_hack_rename_arg_save_val --sslPEMKeyPassword --tlsCertificateKeyFilePassword "${mongodHackedArgs[@]}" + _mongod_hack_rename_arg_save_val --sslClusterFile --tlsClusterFile "${mongodHackedArgs[@]}" + _mongod_hack_rename_arg_save_val --sslCertificateSelector --tlsCertificateSelector "${mongodHackedArgs[@]}" + _mongod_hack_rename_arg_save_val --sslClusterCertificateSelector --tlsClusterCertificateSelector "${mongodHackedArgs[@]}" + _mongod_hack_rename_arg_save_val --sslClusterPassword --tlsClusterPassword "${mongodHackedArgs[@]}" + _mongod_hack_rename_arg_save_val --sslCAFile --tlsCAFile "${mongodHackedArgs[@]}" + _mongod_hack_rename_arg_save_val --sslClusterCAFile --tlsClusterCAFile "${mongodHackedArgs[@]}" + _mongod_hack_rename_arg_save_val --sslCRLFile --tlsCRLFile "${mongodHackedArgs[@]}" + _mongod_hack_rename_arg_save_val --sslDisabledProtocols --tlsDisabledProtocols "${mongodHackedArgs[@]}" + fi + + set -- "${mongodHackedArgs[@]}" + + # MongoDB 3.6+ defaults to localhost-only binding + haveBindIp= + if _mongod_hack_have_arg --bind_ip "$@" || _mongod_hack_have_arg --bind_ip_all "$@"; then + haveBindIp=1 + elif _parse_config "$@" && jq --exit-status '.net.bindIp // .net.bindIpAll' "$jsonConfigFile" > /dev/null; then + haveBindIp=1 + fi + if [ -z "$haveBindIp" ]; then + # so if no "--bind_ip" is specified, let's add "--bind_ip_all" + set -- "$@" --bind_ip_all + fi + + unset "${!MONGO_INITDB_@}" +fi + +rm -f "$jsonConfigFile" "$tempConfigFile" + +set -o xtrace +exec "$@"