Skip to content

Commit 85b6158

Browse files
committed
use shared library instead of mongocryptd
1 parent 7c48af2 commit 85b6158

File tree

3 files changed

+30
-19
lines changed

3 files changed

+30
-19
lines changed

.github/workflows/encrypted_settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
from mongodb_settings import * # noqa: F403
55
from pymongo.encryption import AutoEncryptionOpts
66

7+
os.environ["LD_LIBRARY_PATH"] = os.environ["GITHUB_WORKSPACE"] + "/lib/"
8+
79
DATABASES["encrypted"] = { # noqa: F405
810
"ENGINE": "django_mongodb_backend",
911
"NAME": "djangotests_encrypted",
1012
"OPTIONS": {
1113
"auto_encryption_opts": AutoEncryptionOpts(
1214
key_vault_namespace="djangotests_encrypted.__keyVault",
1315
kms_providers={"local": {"key": os.urandom(96)}},
16+
crypt_shared_lib_path=os.environ["GITHUB_WORKSPACE"] + "/lib/mongo_crypt_v1.so",
1417
),
1518
"directConnection": True,
1619
},

.github/workflows/test-python-atlas.yml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,26 +52,10 @@ jobs:
5252
- name: Start local Atlas
5353
working-directory: .
5454
run: bash .github/workflows/start_local_atlas.sh mongodb/mongodb-atlas-local:8.0.15
55-
- name: Install mongosh
55+
- name: Download crypt shared
5656
run: |
57-
wget -q https://downloads.mongodb.com/compass/mongosh-2.2.10-linux-x64.tgz
58-
tar -xzf mongosh-*-linux-x64.tgz
59-
sudo cp mongosh-*-linux-x64/bin/mongosh /usr/local/bin/
60-
mongosh --version
61-
- name: Install mongocryptd from Enterprise tarball
62-
run: |
63-
curl -sSL -o mongodb-enterprise.tgz "https://downloads.mongodb.com/linux/mongodb-linux-x86_64-enterprise-ubuntu2204-8.0.15.tgz"
64-
tar -xzf mongodb-enterprise.tgz
65-
sudo cp mongodb-linux-x86_64-enterprise-ubuntu2204-8.0.15/bin/mongocryptd /usr/local/bin/
66-
- name: Start mongocryptd
67-
run: |
68-
nohup mongocryptd --logpath=/tmp/mongocryptd.log &
69-
- name: Verify MongoDB installation
70-
run: |
71-
mongosh --eval 'db.runCommand({ connectionStatus: 1 })'
72-
- name: Verify mongocryptd is running
73-
run: |
74-
pgrep mongocryptd
57+
wget https://downloads.mongodb.com/linux/mongo_crypt_shared_v1-linux-x86_64-enterprise-ubuntu2404-8.2.1.tgz
58+
tar -xvzf mongo_crypt_shared_v1-linux-x86_64-enterprise-ubuntu2404-8.2.1.tgz lib/mongo_crypt_v1.so
7559
- name: Run tests
7660
run: python3 django_repo/tests/runtests_.py
7761
permissions:

docs/howto/queryable-encryption.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,5 +285,29 @@ settings::
285285
},
286286
}
287287

288+
289+
.. admonition:: Dynamic library path configuration
290+
291+
The Automatic Encryption Shared Library is platform‑specific. Make sure to
292+
download the correct version for your operating system and architecture,
293+
and configure your environment so the system can locate it.
294+
295+
Use the following variables depending on your platform:
296+
297+
+---------------+---------------------------------+
298+
| **Platform** | **Environment Variable** |
299+
+---------------+---------------------------------+
300+
| Windows | ``PATH`` |
301+
+---------------+---------------------------------+
302+
| macOS | ``DYLD_FALLBACK_LIBRARY_PATH`` |
303+
+---------------+---------------------------------+
304+
| Linux | ``LD_LIBRARY_PATH`` |
305+
+---------------+---------------------------------+
306+
307+
For example on macOS, you can set the ``DYLD_FALLBACK_LIBRARY_PATH``
308+
environment variable in your shell before starting your Django application::
309+
310+
$ export DYLD_FALLBACK_LIBRARY_PATH="/path/to/mongo_crypt_shared_v1.dylib:$DYLD_FALLBACK_LIBRARY_PATH"
311+
288312
You are now ready to :doc:`start developing applications
289313
</topics/queryable-encryption>` with Queryable Encryption!

0 commit comments

Comments
 (0)