This creates a development environment with a FoundationDB server and an erlfdb client in two containers, sharing a network through Docker Compose.
It uses the FDB image published to Docker Hub for the FDB container, and downloads the FDB client packages from foundationdb.org to provide the development headers and libraries. Once the Docker Compose setup is running, VS Code executes the create_cluster_file.bash script to write down a cluster file containing the IP address in the compose network where the FDB service can be found.
I also did some work to make it easy to run the bindings tests following Paul's original instructions. The Dockerfile does a shallow clone of the FoundationDB repo and applies a patch file to register our Escript tester as a known tester. It also install the Python bindings so we don't need to build FDB from source in order to execute the tests. With that it's possible to run the bindings tests out of the box:
make
ERL_LIBS=/usr/src/erlfdb/ /usr/src/foundationdb/bindings/bindingtester/bindingtester.py erlang
Requests for Reviewer
~I did make one change to erlfdb itself that's worth discussing. I made it so that the test suite will try to run configure new single ssd even when a user supplied a custom test_cluster_file in the erlfdb application environment. Previously we only ran that command when the test suite was starting its own server. This is a safe operation when a cluster is already properly configured, but if a cluster is in a misconfigured state the command could cause the cluster to drop whatever data it might have been storing previously.~
I figured out what I think is a better approach here using the .devcontainer lifecycle hooks. Now this PR does not change any lines of actual erlfdb code and erlfdb will not try to configure a new database in a user's external FDB server if that server is selected via the test_cluster_file.
Testing Recommendation
Open the repo in VS Code and it should offer to reopen inside the container. Open a terminal in the editor once the container is build and run make; erlfdb should build and run unit tests successfully. The run the bindings tests as indicated above.
Now that I've tweaked this so it doesn't modify any project source code I'd argue it's OK to merge without a review. I've been using it quite successfully for the past couple of weeks.
This creates a development environment with a FoundationDB server and an erlfdb client in two containers, sharing a network through Docker Compose.
It uses the FDB image published to Docker Hub for the FDB container, and downloads the FDB client packages from foundationdb.org to provide the development headers and libraries. Once the Docker Compose setup is running, VS Code executes the
create_cluster_file.bash
script to write down a cluster file containing the IP address in the compose network where the FDB service can be found.I also did some work to make it easy to run the bindings tests following Paul's original instructions. The Dockerfile does a shallow clone of the FoundationDB repo and applies a patch file to register our Escript tester as a known tester. It also install the Python bindings so we don't need to build FDB from source in order to execute the tests. With that it's possible to run the bindings tests out of the box:
Requests for Reviewer
~I did make one change to erlfdb itself that's worth discussing. I made it so that the test suite will try to run
configure new single ssd
even when a user supplied a customtest_cluster_file
in the erlfdb application environment. Previously we only ran that command when the test suite was starting its own server. This is a safe operation when a cluster is already properly configured, but if a cluster is in a misconfigured state the command could cause the cluster to drop whatever data it might have been storing previously.~I figured out what I think is a better approach here using the .devcontainer lifecycle hooks. Now this PR does not change any lines of actual erlfdb code and erlfdb will not try to configure a new database in a user's external FDB server if that server is selected via the
test_cluster_file
.Testing Recommendation
Open the repo in VS Code and it should offer to reopen inside the container. Open a terminal in the editor once the container is build and run
make
; erlfdb should build and run unit tests successfully. The run the bindings tests as indicated above.