Skip to content

Commit e91549b

Browse files
committed
refactor docker directory
- make release images ALL based from centos:7 - keep eks images that are based from amazonlinux:2, but create strong alignment with release (centos7) images - use multi-stage Dockerfile(s) - have a single build-images script - remove per image directories (which would only contain scripts that are copied into images) - remove empty requirements.txt file for sidecar.py (the pip command, package and version are in the Dockerfile) - don't copy docker into PROJECT_BINARY_DIR
1 parent d94a2ef commit e91549b

File tree

15 files changed

+596
-490
lines changed

15 files changed

+596
-490
lines changed

cmake/InstallLayout.cmake

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,6 @@ install(DIRECTORY "${script_dir}/clients/usr/lib/cmake"
9494
DESTINATION usr/lib
9595
COMPONENT clients-versioned)
9696

97-
################################################################################
98-
# Move Docker Setup
99-
################################################################################
100-
101-
file(COPY "${PROJECT_SOURCE_DIR}/packaging/docker" DESTINATION "${PROJECT_BINARY_DIR}/packages/")
102-
10397
################################################################################
10498
# General CPack configuration
10599
################################################################################
@@ -137,7 +131,7 @@ set(CPACK_COMPONENT_CLIENTS-TGZ_DISPLAY_NAME "foundationdb-clients")
137131
set(CPACK_COMPONENT_CLIENTS-VERSIONED_DISPLAY_NAME "foundationdb${PROJECT_VERSION}-clients")
138132

139133

140-
# MacOS needs a file exiension for the LICENSE file
134+
# MacOS needs a file extension for the LICENSE file
141135
configure_file(${CMAKE_SOURCE_DIR}/LICENSE ${CMAKE_BINARY_DIR}/License.txt COPYONLY)
142136

143137
################################################################################

packaging/docker/Dockerfile

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
# Dockerfile
2+
#
3+
# This source file is part of the FoundationDB open source project
4+
#
5+
# Copyright 2013-2021 Apple Inc. and the FoundationDB project authors
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
#
19+
FROM centos:7.9.2009 as base
20+
21+
RUN yum install -y \
22+
epel-release-7-11 \
23+
centos-release-scl-2-3.el7.centos && \
24+
yum install -y \
25+
bind-utils-9.11.4-26.P2.el7_9.7 \
26+
binutils-2.27-44.base.el7_9.1 \
27+
curl-7.29.0-59.el7_9.1 \
28+
gdb-7.6.1-120.el7 \
29+
hostname-3.13-3.el7_7.1 \
30+
jq-1.6-2.el7 \
31+
less-458-9.el7 \
32+
lsof-4.87-6.el7 \
33+
net-tools-2.0-0.25.20131004git.el7 \
34+
nmap-ncat-6.40-19.el7 \
35+
perf-3.10.0-1160.45.1.el7 \
36+
perl-5.16.3-299.el7_9 \
37+
procps-ng-3.3.10-28.el7 \
38+
strace-4.24-6.el7 \
39+
sysstat-10.1.5-19.el7 \
40+
tar-1.26-35.el7 \
41+
tcpdump-4.9.2-4.el7_7.1 \
42+
telnet-0.17-66.el7 \
43+
traceroute-2.0.22-2.el7 \
44+
unzip-6.0-22.el7_9 \
45+
vim-enhanced-7.4.629-8.el7_9 && \
46+
yum clean all && \
47+
rm -rf /var/cache/yum
48+
49+
WORKDIR /tmp
50+
51+
RUN curl -Ls https://github.com/krallin/tini/releases/download/v0.19.0/tini-amd64 -o tini && \
52+
echo "93dcc18adc78c65a028a84799ecf8ad40c936fdfc5f2a57b1acda5a8117fa82c tini" > tini-amd64.sha256sum && \
53+
sha256sum -c tini-amd64.sha256sum && \
54+
chmod +x tini && \
55+
mv tini /usr/bin/ && \
56+
rm -rf /tmp/*
57+
58+
WORKDIR /
59+
60+
FROM golang:1.16.7-bullseye AS go-build
61+
62+
COPY fdbkubernetesmonitor/ /fdbkubernetesmonitor
63+
WORKDIR /fdbkubernetesmonitor
64+
RUN go build -o /fdb-kubernetes-monitor ./...
65+
66+
FROM base as foundationdb-base
67+
68+
WORKDIR /tmp
69+
ARG FDB_VERSION=6.3.22
70+
ARG FDB_LIBRARY_VERSIONS="${FDB_VERSION}"
71+
ARG FDB_WEBSITE=https://www.foundationdb.org
72+
73+
RUN mkdir -p /var/fdb/{logs,tmp,lib} && \
74+
mkdir -p /usr/lib/fdb/multiversion && \
75+
echo ${FDB_VERSION} > /var/fdb/version
76+
77+
# Set up a non-root user
78+
RUN groupadd --gid 4059 fdb && \
79+
useradd --gid 4059 --uid 4059 --no-create-home --shell /bin/bash fdb && \
80+
chown -R fdb:fdb /var/fdb
81+
82+
COPY website /tmp/website/
83+
84+
# Install FoundationDB Binaries
85+
RUN curl $FDB_WEBSITE/downloads/$FDB_VERSION/linux/fdb_$FDB_VERSION.tar.gz | tar zxf - --strip-components=1 && \
86+
for file in fdbbackup fdbcli fdbdr fdbmonitor fdbrestore fdbserver backup_agent dr_agent fastrestore_tool; do \
87+
chmod u+x $file; \
88+
mv $file /usr/bin; \
89+
done
90+
91+
# Install additional FoundationDB Client Libraries
92+
RUN for version in $FDB_LIBRARY_VERSIONS; do \
93+
curl $FDB_WEBSITE/downloads/$version/linux/libfdb_c_$version.so -o /usr/lib/fdb/multiversion/libfdb_c_${version%.*}.so; \
94+
done
95+
96+
# Install additional FoundationDB Client Libraries (for sidecar)
97+
RUN mkdir -p /var/fdb/lib && \
98+
for version in $FDB_LIBRARY_VERSIONS; do \
99+
curl $FDB_WEBSITE/downloads/$version/linux/libfdb_c_$version.so -o /var/fdb/lib/libfdb_c_${version%.*}.so; \
100+
done
101+
102+
RUN curl $FDB_WEBSITE/downloads/$FDB_VERSION/linux/libfdb_c_$FDB_VERSION.so -o /usr/lib/libfdb_c.so
103+
104+
RUN rm -rf /tmp/*
105+
WORKDIR /
106+
107+
FROM foundationdb-base as fdb-kubernetes-monitor
108+
109+
# Install the kubernetes monitor binary
110+
COPY --from=go-build /fdb-kubernetes-monitor /usr/bin/
111+
112+
# Runtime Configuration Options
113+
USER fdb
114+
WORKDIR /var/fdb
115+
VOLUME /var/fdb/data
116+
ENTRYPOINT ["/usr/bin/fdb-kubernetes-monitor"]
117+
118+
FROM foundationdb-base as foundationdb-kubernetes-sidecar
119+
120+
RUN yum -y install \
121+
rh-python38-2.0-4.el7 \
122+
yum clean all && \
123+
rm -rf /var/cache/yum && \
124+
source /opt/rh/rh-python38/enable && \
125+
pip3 install watchdog==0.9.0
126+
127+
WORKDIR /
128+
ADD entrypoint.bash sidecar.py /
129+
RUN chmod a+x /entrypoint.bash /sidecar.py
130+
USER fdb
131+
VOLUME /var/input-files
132+
VOLUME /var/output-files
133+
ENV LISTEN_PORT 8080
134+
ENTRYPOINT ["/usr/bin/tini", "-g", "--", "/entrypoint.bash"]
135+
136+
FROM foundationdb-base as foundationdb
137+
138+
WORKDIR /tmp
139+
RUN curl -LsO https://raw.githubusercontent.com/brendangregg/FlameGraph/90533539b75400297092f973163b8a7b067c66d3/stackcollapse-perf.pl && \
140+
curl -LsO https://raw.githubusercontent.com/brendangregg/FlameGraph/90533539b75400297092f973163b8a7b067c66d3/flamegraph.pl && \
141+
echo "a682ac46497d6fdbf9904d1e405d3aea3ad255fcb156f6b2b1a541324628dfc0 flamegraph.pl" > flamegraph.sha256sum && \
142+
echo "5bcfb73ff2c2ab7bf2ad2b851125064780b58c51cc602335ec0001bec92679a5 stackcollapse-perf.pl" >> flamegraph.sha256sum && \
143+
sha256sum -c flamegraph.sha256sum && \
144+
chmod +x stackcollapse-perf.pl flamegraph.pl && \
145+
mv stackcollapse-perf.pl flamegraph.pl /usr/bin && \
146+
rm -rf /tmp/*
147+
WORKDIR /
148+
# Set Up Runtime Scripts and Directories
149+
ADD fdb.bash /var/fdb/scripts/
150+
RUN chmod a+x /var/fdb/scripts/fdb.bash
151+
VOLUME /var/fdb/data
152+
ENV FDB_PORT 4500
153+
ENV FDB_CLUSTER_FILE /var/fdb/fdb.cluster
154+
ENV FDB_NETWORKING_MODE container
155+
ENV FDB_COORDINATOR ""
156+
ENV FDB_COORDINATOR_PORT 4500
157+
ENV FDB_CLUSTER_FILE_CONTENTS ""
158+
ENV FDB_PROCESS_CLASS unset
159+
ENTRYPOINT ["/usr/bin/tini", "-g", "--", "/var/fdb/scripts/fdb.bash"]
160+
161+
FROM base as ycsb
162+
163+
RUN yum -y install \
164+
java-11-openjdk-11.0.13.0.8-1.el7_9 && \
165+
yum clean all && \
166+
rm -rf /var/cache/yum
167+
168+
WORKDIR /tmp
169+
RUN curl -Ls https://amazon-eks.s3.amazonaws.com/1.19.6/2021-01-05/bin/linux/amd64/kubectl -o kubectl && \
170+
echo "08ff68159bbcb844455167abb1d0de75bbfe5ae1b051f81ab060a1988027868a kubectl" > kubectl.txt && \
171+
sha256sum -c kubectl.txt && \
172+
mv kubectl /usr/local/bin/kubectl && \
173+
chmod 755 /usr/local/bin/kubectl && \
174+
curl https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.2.43.zip -o "awscliv2.zip" && \
175+
echo "9a8b3c4e7f72bbcc55e341dce3af42479f2730c225d6d265ee6f9162cfdebdfd awscliv2.zip" > awscliv2.txt && \
176+
sha256sum -c awscliv2.txt && \
177+
unzip -qq awscliv2.zip && \
178+
./aws/install && \
179+
rm -rf /tmp/*
180+
181+
# TODO: Log4J complains that it's eating the HTracer logs. Even without it, we get per-operation
182+
# time series graphs of throughput, median, 90, 99, 99.9 and 99.99 (in usec).
183+
ADD run_ycsb.sh /usr/local/bin/run_ycsb.sh
184+
RUN mkdir -p /var/log/fdb-trace-logs && \
185+
chmod +x /usr/local/bin/run_ycsb.sh
186+
187+
ADD YCSB /YCSB
188+
WORKDIR /YCSB
189+
ENV FDB_NETWORK_OPTION_EXTERNAL_CLIENT_DIRECTORY=/var/dynamic-conf/lib/multiversion/
190+
ENV FDB_NETWORK_OPTION_TRACE_ENABLE=/var/log/fdb-trace-logs
191+
ENV LD_LIBRARY_PATH=/var/dynamic-conf/lib/
192+
ENV BUCKET=""
193+
CMD ["run_ycsb.sh"]

0 commit comments

Comments
 (0)