You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2021/10/28 14:42:49 UTC
[couchdb-erlfdb] branch devcontainer created (now 4e7c1f0)
This is an automated email from the ASF dual-hosted git repository.
kocolosk pushed a change to branch devcontainer
in repository https://gitbox.apache.org/repos/asf/couchdb-erlfdb.git.
at 4e7c1f0 Create a DB if the test cluster doesn't have one
This branch includes the following new commits:
new 1a2202c Add a development container for VS Code
new bf2002c Install Python language bindings
new 7820a96 Use FoundationDB 6.2.x for now
new 4e7c1f0 Create a DB if the test cluster doesn't have one
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[couchdb-erlfdb] 01/04: Add a development container for VS Code
Posted by ko...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kocolosk pushed a commit to branch devcontainer
in repository https://gitbox.apache.org/repos/asf/couchdb-erlfdb.git
commit 1a2202c943e31f76c2f1ad212b8c862f040e0fea
Author: Adam Kocoloski <ko...@apache.org>
AuthorDate: Thu Oct 28 10:41:11 2021 -0400
Add a development container for VS Code
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.
---
.devcontainer/Dockerfile | 27 +++++++++++++++++++++++++++
.devcontainer/devcontainer.json | 12 ++++++++++++
.devcontainer/docker-compose.yaml | 38 ++++++++++++++++++++++++++++++++++++++
3 files changed, 77 insertions(+)
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
new file mode 100644
index 0000000..a02146a
--- /dev/null
+++ b/.devcontainer/Dockerfile
@@ -0,0 +1,27 @@
+ARG FDB_VERSION
+ARG ERLANG_VERSION
+
+# Grab fdbcli and client library from same image as server
+FROM foundationdb/foundationdb:${FDB_VERSION} as fdb
+
+# Debian image with Erlang installed (we need elixir for test suite)
+FROM erlang:${ERLANG_VERSION}
+
+# The FROM directive above sweeps out the ARGs so we need to re-declare here
+# in order to use it again to download the FDB client package
+ARG FDB_VERSION
+
+RUN set -ex; \
+ wget https://www.foundationdb.org/downloads/${FDB_VERSION}/ubuntu/installers/foundationdb-clients_${FDB_VERSION}-1_amd64.deb; \
+ mkdir /var/lib/foundationdb; \
+ dpkg -i foundationdb-clients_${FDB_VERSION}-1_amd64.deb
+
+# `dig` is used by the script that creates the FDB cluster file
+RUN set -ex; \
+ apt-get update; \
+ apt-get install -y --no-install-recommends \
+ dnsutils
+
+COPY --from=fdb /var/fdb/scripts/create_cluster_file.bash /usr/local/bin/
+
+CMD sleep infinity
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 0000000..0a3c33c
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,12 @@
+{
+ "dockerComposeFile": "docker-compose.yaml",
+ "service": "erlfdb",
+ "workspaceFolder": "/usr/src/erlfdb",
+
+ // Needs to run at start to translate service name into coordinator IP
+ "postStartCommand": ["bash", "/usr/local/bin/create_cluster_file.bash"],
+
+ "extensions": [
+ "erlang-ls.erlang-ls"
+ ]
+}
diff --git a/.devcontainer/docker-compose.yaml b/.devcontainer/docker-compose.yaml
new file mode 100644
index 0000000..5648b60
--- /dev/null
+++ b/.devcontainer/docker-compose.yaml
@@ -0,0 +1,38 @@
+services:
+ erlfdb:
+ build:
+ context: .
+ dockerfile: Dockerfile
+ args:
+ ERLANG_VERSION: "24"
+
+ # This should always match the value in fdb.image
+ FDB_VERSION: "6.3.18"
+
+ environment:
+ # This needs to match the name of the FoundationDB service below
+ FDB_COORDINATOR: fdb
+
+ # The location where the Dockerfile installs the FDB cluster file
+ # retrieved from the `fdb` image. CouchDB looks for the cluster file in
+ # this location by default. If you want to install it somewhere else you
+ # you need to change "[erlfdb] cluster_file" and ERL_ZFLAGS to match.
+ FDB_CLUSTER_FILE: /usr/local/etc/foundationdb/fdb.cluster
+
+ # The test suite will default to trying to start its own fdbserver
+ # process. This environment variable tells it to use the fdbserver
+ # running in the `fdb` image instead. Quite a hacky solution.
+ ERL_ZFLAGS: "-erlfdb test_cluster_file <<\\\"/usr/local/etc/foundationdb/fdb.cluster\\\">>"
+
+ volumes:
+ # Mounts the project folder to '/usr/src/erlfdb'. The target path inside
+ # the container should match what your application expects. In this case,
+ # the compose file is in a sub-folder, so you will mount '..'. You would
+ # then reference this path as the 'workspaceFolder' in
+ # '.devcontainer/devcontainer.json' so VS Code starts here.
+ - ..:/usr/src/erlfdb:cached
+
+ network_mode: service:fdb
+
+ fdb:
+ image: foundationdb/foundationdb:6.3.18
[couchdb-erlfdb] 03/04: Use FoundationDB 6.2.x for now
Posted by ko...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kocolosk pushed a commit to branch devcontainer
in repository https://gitbox.apache.org/repos/asf/couchdb-erlfdb.git
commit 7820a962ea740287b9fdd542a5bc47831269da4d
Author: Adam Kocoloski <ko...@apache.org>
AuthorDate: Thu Oct 28 10:41:11 2021 -0400
Use FoundationDB 6.2.x for now
Our bindings appear to hardcode API version 620. We'll address that
separately, but for now stick with the older version.
---
.devcontainer/docker-compose.yaml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.devcontainer/docker-compose.yaml b/.devcontainer/docker-compose.yaml
index 5648b60..f93df97 100644
--- a/.devcontainer/docker-compose.yaml
+++ b/.devcontainer/docker-compose.yaml
@@ -7,7 +7,7 @@ services:
ERLANG_VERSION: "24"
# This should always match the value in fdb.image
- FDB_VERSION: "6.3.18"
+ FDB_VERSION: "6.2.29"
environment:
# This needs to match the name of the FoundationDB service below
@@ -35,4 +35,4 @@ services:
network_mode: service:fdb
fdb:
- image: foundationdb/foundationdb:6.3.18
+ image: foundationdb/foundationdb:6.2.29
[couchdb-erlfdb] 04/04: Create a DB if the test cluster doesn't
have one
Posted by ko...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kocolosk pushed a commit to branch devcontainer
in repository https://gitbox.apache.org/repos/asf/couchdb-erlfdb.git
commit 4e7c1f01845fa311c76f2d3c95d421936d3fb3b4
Author: Adam Kocoloski <ko...@apache.org>
AuthorDate: Thu Oct 28 10:41:11 2021 -0400
Create a DB if the test cluster doesn't have one
The FoundationDB image does not always ship with a configured database,
so we'll attempt to create one when initializing the test suite.
Note that this can cause the FDB server to lose data if it is in a
misconfigured state. We only run this command on test clusters, but we
ought to warn users not to run the test suite against a production FDB
cluster all the same.
---
src/erlfdb_util.erl | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/erlfdb_util.erl b/src/erlfdb_util.erl
index 58fa12d..a87f43e 100644
--- a/src/erlfdb_util.erl
+++ b/src/erlfdb_util.erl
@@ -52,6 +52,8 @@ init_test_cluster(Options) ->
ok = application:ensure_started(erlfdb),
case application:get_env(erlfdb, test_cluster_file) of
{ok, ClusterFile} ->
+ % Create a database if one does not already exist
+ init_fdb_db(ClusterFile, Options),
{ok, ClusterFile};
undefined ->
init_test_cluster_int(Options)
[couchdb-erlfdb] 02/04: Install Python language bindings
Posted by ko...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kocolosk pushed a commit to branch devcontainer
in repository https://gitbox.apache.org/repos/asf/couchdb-erlfdb.git
commit bf2002cba335f318e99d956327168c3126290b64
Author: Adam Kocoloski <ko...@apache.org>
AuthorDate: Thu Oct 28 10:41:11 2021 -0400
Install Python language bindings
This makes it (slightly) easier to run the bindings tester since we can
skip building FoundationDB itself.
---
.devcontainer/Dockerfile | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index a02146a..59e124f 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -11,11 +11,19 @@ FROM erlang:${ERLANG_VERSION}
# in order to use it again to download the FDB client package
ARG FDB_VERSION
+# Install the FDB client used underneath erlfdb
RUN set -ex; \
wget https://www.foundationdb.org/downloads/${FDB_VERSION}/ubuntu/installers/foundationdb-clients_${FDB_VERSION}-1_amd64.deb; \
mkdir /var/lib/foundationdb; \
dpkg -i foundationdb-clients_${FDB_VERSION}-1_amd64.deb
+# FDB bindings tester uses the Python bindings
+RUN set -ex; \
+ wget https://www.foundationdb.org/downloads/${FDB_VERSION}/bindings/python/foundationdb-${FDB_VERSION}.tar.gz; \
+ tar zxf foundationdb-${FDB_VERSION}.tar.gz; \
+ cd foundationdb-${FDB_VERSION}; \
+ python3 setup.py install
+
# `dig` is used by the script that creates the FDB cluster file
RUN set -ex; \
apt-get update; \