Skip to content

Commit 651631d

Browse files
committed
Fix issues caused by foundationdb.org breakage
The foundationdb.org collapse and subsequent move to GitHub created a bit of fallout: * Update package URLs from foundationdb.org to github.com * Install Python package via pip as it's not published on GitHub * Bump version to 6.3.23 as pypi has limited release selection * Vendor the create_cluster_file.bash script (FDB elected to remove it from their published container builds).
1 parent 20ae851 commit 651631d

File tree

3 files changed

+62
-17
lines changed

3 files changed

+62
-17
lines changed

.devcontainer/Dockerfile

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,11 @@ ARG FDB_VERSION
1313

1414
# Install the FDB client used underneath erlfdb
1515
RUN set -ex; \
16-
wget https://www.foundationdb.org/downloads/${FDB_VERSION}/ubuntu/installers/foundationdb-clients_${FDB_VERSION}-1_amd64.deb; \
16+
wget https://github.com/apple/foundationdb/releases/download/${FDB_VERSION}/foundationdb-clients_${FDB_VERSION}-1_amd64.deb; \
1717
mkdir /var/lib/foundationdb; \
1818
dpkg -i foundationdb-clients_${FDB_VERSION}-1_amd64.deb; \
1919
rm foundationdb-clients_${FDB_VERSION}-1_amd64.deb
2020

21-
# FDB bindings tester uses the Python bindings; install them from a
22-
# package to avoid building FDB from source
23-
RUN set -ex; \
24-
wget https://www.foundationdb.org/downloads/${FDB_VERSION}/bindings/python/foundationdb-${FDB_VERSION}.tar.gz; \
25-
tar zxf foundationdb-${FDB_VERSION}.tar.gz; \
26-
cd foundationdb-${FDB_VERSION}; \
27-
if [ "${FDB_VERSION}" < "6.3.0" ]; then \
28-
python setup.py install; \
29-
else \
30-
python3 setup.py install; \
31-
fi; \
32-
rm ../foundationdb-${FDB_VERSION}.tar.gz
3321

3422
# Clone FoundationDB repo to retrieve bindings tester package and
3523
# patch it to support erlfdb
@@ -43,9 +31,14 @@ RUN set -ex; \
4331
RUN set -ex; \
4432
apt-get update; \
4533
apt-get install -y --no-install-recommends \
46-
dnsutils; \
34+
dnsutils \
35+
python3-setuptools \
36+
python3-pip; \
4737
rm -rf /var/lib/apt/lists/*
4838

49-
COPY --from=fdb /var/fdb/scripts/create_cluster_file.bash /usr/local/bin/
39+
# FDB bindings tester uses the Python bindings
40+
RUN pip3 install foundationdb==${FDB_VERSION}
41+
42+
COPY create_cluster_file.bash /usr/local/bin/
5043

5144
CMD sleep infinity
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#! /bin/bash
2+
3+
#
4+
# create_cluster_file.bash
5+
#
6+
# This source file is part of the FoundationDB open source project
7+
#
8+
# Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
9+
#
10+
# Licensed under the Apache License, Version 2.0 (the "License");
11+
# you may not use this file except in compliance with the License.
12+
# You may obtain a copy of the License at
13+
#
14+
# http://www.apache.org/licenses/LICENSE-2.0
15+
#
16+
# Unless required by applicable law or agreed to in writing, software
17+
# distributed under the License is distributed on an "AS IS" BASIS,
18+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19+
# See the License for the specific language governing permissions and
20+
# limitations under the License.
21+
#
22+
23+
# This script creates a cluster file for a server or client.
24+
# This takes the cluster file path from the FDB_CLUSTER_FILE
25+
# environment variable, with a default of /etc/foundationdb/fdb.cluster
26+
#
27+
# The name of the coordinator must be defined in the FDB_COORDINATOR environment
28+
# variable, and it must be a name that can be resolved through DNS.
29+
30+
function create_cluster_file() {
31+
FDB_CLUSTER_FILE=${FDB_CLUSTER_FILE:-/etc/foundationdb/fdb.cluster}
32+
mkdir -p $(dirname $FDB_CLUSTER_FILE)
33+
34+
if [[ -n "$FDB_CLUSTER_FILE_CONTENTS" ]]; then
35+
echo "$FDB_CLUSTER_FILE_CONTENTS" > $FDB_CLUSTER_FILE
36+
elif [[ -n $FDB_COORDINATOR ]]; then
37+
coordinator_ip=$(dig +short $FDB_COORDINATOR)
38+
if [[ -z "$coordinator_ip" ]]; then
39+
echo "Failed to look up coordinator address for $FDB_COORDINATOR" 1>&2
40+
exit 1
41+
fi
42+
coordinator_port=${FDB_COORDINATOR_PORT:-4500}
43+
echo "docker:docker@$coordinator_ip:$coordinator_port" > $FDB_CLUSTER_FILE
44+
else
45+
echo "FDB_COORDINATOR environment variable not defined" 1>&2
46+
exit 1
47+
fi
48+
}
49+
50+
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
51+
create_cluster_file "$@"
52+
fi

.devcontainer/docker-compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ services:
77
ERLANG_VERSION: "24"
88

99
# This should always match the value in fdb.image
10-
FDB_VERSION: "6.2.30"
10+
FDB_VERSION: "6.3.23"
1111

1212
environment:
1313
# This needs to match the name of the FoundationDB service below
@@ -28,4 +28,4 @@ services:
2828
network_mode: service:fdb
2929

3030
fdb:
31-
image: foundationdb/foundationdb:6.2.30
31+
image: foundationdb/foundationdb:6.3.23

0 commit comments

Comments
 (0)