From 12b4ceb4aa0ee6a6e8e52ca447bcf8f6aa3f1b0e Mon Sep 17 00:00:00 2001 From: Jon Chambers Date: Fri, 27 Jun 2025 09:51:35 -0400 Subject: [PATCH] Configure FoundationDB service container's database via Docker, removing `fdbcli` dependency --- .github/workflows/test.yml | 22 +++++++++++++++++-- ...rFoundationDbDatabaseLifecycleManager.java | 10 --------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c226ccff7..271628419 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,6 +17,7 @@ jobs: # Note: this should generally match the version of the FoundationDB SERVER deployed in production; it's okay if # it's a little behind the CLIENT version. image: foundationdb/foundationdb:7.3.62 + options: --name foundationdb steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -32,8 +33,25 @@ jobs: HOME: /root - name: Install APT packages # ca-certificates: required for AWS CRT client - run: apt update && apt install -y ca-certificates - - name: Download and install FoundationDB client library + run: | + # Add Docker's official GPG key: + apt update + apt install -y ca-certificates curl + install -m 0755 -d /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc + chmod a+r /etc/apt/keyrings/docker.asc + + # Add Docker repository to apt sources: + echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \ + tee /etc/apt/sources.list.d/docker.list > /dev/null + + # ca-certificates: required for AWS CRT client + apt update && apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin ca-certificates + - name: Configure FoundationDB database + run: docker exec foundationdb /usr/bin/fdbcli --exec 'configure new single memory' + - name: Download and install FoundationDB client run: | ./mvnw -e -B -Pexclude-spam-filter clean prepare-package -DskipTests=true cp service/target/jib-extra/usr/lib/libfdb_c.x86_64.so /usr/lib/libfdb_c.x86_64.so diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/storage/ServiceContainerFoundationDbDatabaseLifecycleManager.java b/service/src/test/java/org/whispersystems/textsecuregcm/storage/ServiceContainerFoundationDbDatabaseLifecycleManager.java index 973771d17..0ed9dc4c7 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/storage/ServiceContainerFoundationDbDatabaseLifecycleManager.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/storage/ServiceContainerFoundationDbDatabaseLifecycleManager.java @@ -38,16 +38,6 @@ class ServiceContainerFoundationDbDatabaseLifecycleManager implements Foundation fileWriter.write(String.format("docker:docker@%s:4500", foundationDbServiceContainerName)); } - // If we don't initialize the database before trying to use it, things will just hang in a mysterious, message-free - // way. Note that the `new` keyword in `configure new single memory` means that we can't accidentally clobber an - // existing database (though initialization may fail if there's already a database present). - new ProcessBuilder("/usr/bin/fdbcli", - "-C", clusterFile.getAbsolutePath(), - "--exec", "configure new single memory") - .start() - .onExit() - .join(); - database = fdb.open(clusterFile.getAbsolutePath()); }