201 lines
6.7 KiB
Docker
201 lines
6.7 KiB
Docker
# Dockerfile
|
|
#
|
|
# This source file is part of the FoundationDB open source project
|
|
#
|
|
# Copyright 2013-2021 Apple Inc. and the FoundationDB project authors
|
|
#
|
|
# 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.
|
|
#
|
|
FROM amazonlinux:2.0.20210326.0 as base
|
|
|
|
RUN yum install -y \
|
|
bind-utils-9.11.4-26.P2.amzn2.5.2 \
|
|
binutils-2.29.1-30.amzn2 \
|
|
curl-7.76.1-7.amzn2.0.2 \
|
|
gdb-8.0.1-36.amzn2.0.1 \
|
|
hostname-3.13-3.amzn2.0.2 \
|
|
jq-1.5-1.amzn2.0.2 \
|
|
less-458-9.amzn2.0.2 \
|
|
libsanitizer-7.3.1-13.amzn2 \
|
|
lsof-4.87-6.amzn2 \
|
|
net-tools-2.0-0.22.20131004git.amzn2.0.2 \
|
|
nmap-ncat-6.40-13.amzn2 \
|
|
perf-4.14.252-195.483.amzn2 \
|
|
perl-5.16.3-299.amzn2.0.1 \
|
|
procps-ng-3.3.10-26.amzn2 \
|
|
strace-4.26-1.amzn2.0.1 \
|
|
sysstat-10.1.5-12.amzn2 \
|
|
tar-1.26-35.amzn2 \
|
|
tcpdump-4.9.2-4.amzn2.1 \
|
|
telnet-0.17-65.amzn2 \
|
|
traceroute-2.0.22-2.amzn2.0.1 \
|
|
unzip-6.0-43.amzn2 \
|
|
vim-enhanced-8.1.1602-1.amzn2 && \
|
|
yum clean all && \
|
|
rm -rf /var/cache/yum
|
|
|
|
WORKDIR /tmp
|
|
|
|
RUN curl -Ls https://github.com/krallin/tini/releases/download/v0.19.0/tini-amd64 -o tini && \
|
|
echo "93dcc18adc78c65a028a84799ecf8ad40c936fdfc5f2a57b1acda5a8117fa82c tini" > tini-sha.txt && \
|
|
sha256sum --quiet -c tini-sha.txt && \
|
|
chmod +x tini && \
|
|
mv tini /usr/bin/ && \
|
|
rm -rf /tmp/*
|
|
|
|
RUN curl -Ls https://amazon-eks.s3.amazonaws.com/1.19.6/2021-01-05/bin/linux/amd64/kubectl -o kubectl && \
|
|
echo "08ff68159bbcb844455167abb1d0de75bbfe5ae1b051f81ab060a1988027868a kubectl" > kubectl.txt && \
|
|
sha256sum --quiet -c kubectl.txt && \
|
|
mv kubectl /usr/local/bin/kubectl && \
|
|
chmod 755 /usr/local/bin/kubectl && \
|
|
curl -Ls https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.2.43.zip -o "awscliv2.zip" && \
|
|
echo "9a8b3c4e7f72bbcc55e341dce3af42479f2730c225d6d265ee6f9162cfdebdfd awscliv2.zip" > awscliv2.txt && \
|
|
sha256sum --quiet -c awscliv2.txt && \
|
|
unzip -qq awscliv2.zip && \
|
|
./aws/install && \
|
|
rm -rf /tmp/*
|
|
|
|
WORKDIR /
|
|
|
|
FROM golang:1.17.11-bullseye AS go-build
|
|
|
|
COPY fdbkubernetesmonitor/ /fdbkubernetesmonitor
|
|
WORKDIR /fdbkubernetesmonitor
|
|
RUN go build -o /fdb-kubernetes-monitor *.go
|
|
|
|
FROM base as foundationdb-base
|
|
|
|
WORKDIR /tmp
|
|
ARG FDB_VERSION=6.3.22
|
|
ARG FDB_LIBRARY_VERSIONS="${FDB_VERSION}"
|
|
ARG FDB_WEBSITE=https://github.com/apple/foundationdb/releases/download
|
|
|
|
RUN mkdir -p /var/fdb/{logs,tmp,lib} && \
|
|
mkdir -p /usr/lib/fdb/multiversion && \
|
|
echo ${FDB_VERSION} > /var/fdb/version
|
|
|
|
# Set up a non-root user
|
|
RUN groupadd --gid 4059 \
|
|
fdb && \
|
|
useradd --gid 4059 \
|
|
--uid 4059 \
|
|
--no-create-home \
|
|
--shell /bin/bash \
|
|
fdb && \
|
|
chown -R fdb:fdb /var/fdb
|
|
|
|
COPY website /tmp/website/
|
|
|
|
# Install FoundationDB Binaries
|
|
RUN for file in fdbserver fdbbackup fdbcli fdbmonitor; do \
|
|
curl --fail -Ls ${FDB_WEBSITE}/${FDB_VERSION}/$file.x86_64 -o $file; \
|
|
chmod u+x $file; \
|
|
mv $file /usr/bin; \
|
|
done
|
|
|
|
# Setup all symlinks for the other binaries that are a copy of fdbbackup
|
|
RUN for file in fdbdr fdbrestore backup_agent dr_agent fastrestore_tool; do \
|
|
ln -s /usr/bin/fdbbackup /usr/bin/$file; \
|
|
done
|
|
|
|
# Install additional FoundationDB Client Libraries
|
|
RUN for version in $FDB_LIBRARY_VERSIONS; do \
|
|
curl --fail -Ls ${FDB_WEBSITE}/${version}/libfdb_c.x86_64.so -o /usr/lib/fdb/multiversion/libfdb_c_${version%.*}.so; \
|
|
done
|
|
|
|
# Install additional FoundationDB Client Libraries (for sidecar)
|
|
RUN mkdir -p /var/fdb/lib && \
|
|
for version in $FDB_LIBRARY_VERSIONS; do \
|
|
curl --fail -Ls ${FDB_WEBSITE}/${version}/libfdb_c.x86_64.so -o /var/fdb/lib/libfdb_c_${version%.*}.so; \
|
|
done
|
|
|
|
RUN curl -Ls $FDB_WEBSITE/$FDB_VERSION/libfdb_c.x86_64.so -o /usr/lib/libfdb_c.so
|
|
|
|
RUN rm -rf /tmp/*
|
|
WORKDIR /
|
|
|
|
FROM foundationdb-base as fdb-kubernetes-monitor
|
|
|
|
# Install the kubernetes monitor binary
|
|
COPY --from=go-build /fdb-kubernetes-monitor /usr/bin/
|
|
|
|
# Runtime Configuration Options
|
|
USER fdb
|
|
WORKDIR /var/fdb
|
|
VOLUME /var/fdb/data
|
|
ENTRYPOINT ["/usr/bin/fdb-kubernetes-monitor"]
|
|
|
|
FROM foundationdb-base as foundationdb-kubernetes-sidecar
|
|
|
|
RUN yum -y install \
|
|
python3-3.7.10-1.amzn2.0.1 \
|
|
python3-pip-20.2.2-1.amzn2.0.3 && \
|
|
yum clean all && \
|
|
rm -rf /var/cache/yum && \
|
|
pip3 install watchdog==0.9.0
|
|
|
|
WORKDIR /
|
|
ADD entrypoint.bash sidecar.py /
|
|
RUN chmod a+x /entrypoint.bash /sidecar.py
|
|
USER fdb
|
|
VOLUME /var/input-files
|
|
VOLUME /var/output-files
|
|
ENV LISTEN_PORT 8080
|
|
ENTRYPOINT ["/usr/bin/tini", "-g", "--", "/entrypoint.bash"]
|
|
|
|
FROM foundationdb-base as foundationdb
|
|
|
|
WORKDIR /tmp
|
|
RUN curl -LsO https://raw.githubusercontent.com/brendangregg/FlameGraph/90533539b75400297092f973163b8a7b067c66d3/stackcollapse-perf.pl && \
|
|
curl -LsO https://raw.githubusercontent.com/brendangregg/FlameGraph/90533539b75400297092f973163b8a7b067c66d3/flamegraph.pl && \
|
|
echo "a682ac46497d6fdbf9904d1e405d3aea3ad255fcb156f6b2b1a541324628dfc0 flamegraph.pl" > flamegraph-sha.txt && \
|
|
echo "5bcfb73ff2c2ab7bf2ad2b851125064780b58c51cc602335ec0001bec92679a5 stackcollapse-perf.pl" >> flamegraph-sha.txt && \
|
|
sha256sum --quiet -c flamegraph-sha.txt && \
|
|
chmod +x stackcollapse-perf.pl flamegraph.pl && \
|
|
mv stackcollapse-perf.pl flamegraph.pl /usr/bin && \
|
|
rm -rf /tmp/*
|
|
WORKDIR /
|
|
# Set Up Runtime Scripts and Directories
|
|
ADD fdb.bash /var/fdb/scripts/
|
|
RUN chmod a+x /var/fdb/scripts/fdb.bash
|
|
VOLUME /var/fdb/data
|
|
ENV FDB_PORT 4500
|
|
ENV FDB_CLUSTER_FILE /var/fdb/fdb.cluster
|
|
ENV FDB_NETWORKING_MODE container
|
|
ENV FDB_COORDINATOR ""
|
|
ENV FDB_COORDINATOR_PORT 4500
|
|
ENV FDB_CLUSTER_FILE_CONTENTS ""
|
|
ENV FDB_PROCESS_CLASS unset
|
|
ENTRYPOINT ["/usr/bin/tini", "-g", "--", "/var/fdb/scripts/fdb.bash"]
|
|
|
|
FROM base as ycsb
|
|
|
|
RUN yum -y install \
|
|
java-11-amazon-corretto-11.0.13+8-1.amzn2 && \
|
|
yum clean all && \
|
|
rm -rf /var/cache/yum
|
|
|
|
# TODO: Log4J complains that it's eating the HTracer logs. Even without it, we get per-operation
|
|
# time series graphs of throughput, median, 90, 99, 99.9 and 99.99 (in usec).
|
|
ADD run_ycsb.sh /usr/local/bin/run_ycsb.sh
|
|
RUN mkdir -p /var/log/fdb-trace-logs && \
|
|
chmod +x /usr/local/bin/run_ycsb.sh
|
|
|
|
ADD YCSB /YCSB
|
|
WORKDIR /YCSB
|
|
ENV FDB_NETWORK_OPTION_EXTERNAL_CLIENT_DIRECTORY=/var/dynamic-conf/lib/multiversion/
|
|
ENV FDB_NETWORK_OPTION_TRACE_ENABLE=/var/log/fdb-trace-logs
|
|
ENV LD_LIBRARY_PATH=/var/dynamic-conf/lib/
|
|
ENV BUCKET=""
|
|
CMD ["run_ycsb.sh"]
|